forked from gentoo/gentoo
-
Notifications
You must be signed in to change notification settings - Fork 1
/
toolchain.eclass
2575 lines (2249 loc) · 80.7 KB
/
toolchain.eclass
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# Maintainer: Toolchain Ninjas <[email protected]>
# @SUPPORTED_EAPIS: 5 6
DESCRIPTION="The GNU Compiler Collection"
HOMEPAGE="https://gcc.gnu.org/"
RESTRICT="strip" # cross-compilers need controlled stripping
inherit eutils fixheadtails flag-o-matic gnuconfig libtool multilib pax-utils toolchain-funcs prefix
if [[ ${PV} == *_pre9999* ]] ; then
EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
# naming style:
# gcc-4.7.1_pre9999 -> gcc-4_7-branch
# Note that the micro version is required or lots of stuff will break.
# To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before
# inheriting this eclass.
EGIT_BRANCH="${PN}-${PV%.?_pre9999}-branch"
EGIT_BRANCH=${EGIT_BRANCH//./_}
inherit git-2
fi
FEATURES=${FEATURES/multilib-strict/}
case ${EAPI:-0} in
0|1|2|3|4*) die "Need to upgrade to at least EAPI=5" ;;
5*|6) inherit eapi7-ver ;;
*) die "I don't speak EAPI ${EAPI}." ;;
esac
EXPORT_FUNCTIONS pkg_pretend pkg_setup src_unpack src_prepare src_configure \
src_compile src_test src_install pkg_postinst pkg_postrm
#---->> globals <<----
export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} = ${CHOST} ]] ; then
if [[ ${CATEGORY} == cross-* ]] ; then
export CTARGET=${CATEGORY#cross-}
fi
fi
: ${TARGET_ABI:=${ABI}}
: ${TARGET_MULTILIB_ABIS:=${MULTILIB_ABIS}}
: ${TARGET_DEFAULT_ABI:=${DEFAULT_ABI}}
is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
# General purpose version check. Without a second arg matches up to minor version (x.x.x)
tc_version_is_at_least() {
ver_test "${2:-${GCC_RELEASE_VER}}" -ge "$1"
}
# General purpose version range check
# Note that it matches up to but NOT including the second version
tc_version_is_between() {
tc_version_is_at_least "${1}" && ! tc_version_is_at_least "${2}"
}
GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}}
GCC_PVR=${GCC_PV}
[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR}
GCC_RELEASE_VER=$(ver_cut 1-3 ${GCC_PV})
GCC_BRANCH_VER=$(ver_cut 1-2 ${GCC_PV})
GCCMAJOR=$(ver_cut 1 ${GCC_PV})
GCCMINOR=$(ver_cut 2 ${GCC_PV})
GCCMICRO=$(ver_cut 3 ${GCC_PV})
[[ ${BRANCH_UPDATE-notset} == "notset" ]] && \
BRANCH_UPDATE=$(ver_cut 4 ${GCC_PV})
# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex.
# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)?
GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(ver_rs 3 '-' ${GCC_PV})}
# Pre-release support
if [[ ${GCC_PV} == *_pre* ]] ; then
PRERELEASE=${GCC_PV/_pre/-}
elif [[ ${GCC_PV} == *_alpha* ]] ; then
SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha}
elif [[ ${GCC_PV} == *_beta* ]] ; then
SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta}
elif [[ ${GCC_PV} == *_rc* ]] ; then
SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc}
fi
if [[ ${SNAPSHOT} == [56789].0-* ]] ; then
# The gcc-5+ releases have dropped the .0 for some reason.
SNAPSHOT=${SNAPSHOT/.0}
fi
PREFIX=${TOOLCHAIN_PREFIX:-${EPREFIX}/usr}
if tc_version_is_at_least 3.4.0 ; then
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
else
LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
fi
INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
if is_crosscompile ; then
BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
HOSTLIBPATH=${PREFIX}/${CHOST}/${CTARGET}/lib/${GCC_CONFIG_VER}
else
BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
fi
DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}}
# Dont install in /usr/include/g++-v3/, but in gcc internal directory.
# We will handle /usr/include/g++-v3/ with gcc-config ...
STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VER/\.*/}}
#---->> LICENSE+SLOT+IUSE logic <<----
if tc_version_is_at_least 4.6 ; then
LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.3+"
elif tc_version_is_at_least 4.4 ; then
LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2+"
elif tc_version_is_at_least 4.3 ; then
LICENSE="GPL-3+ LGPL-3+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+"
elif tc_version_is_at_least 4.2 ; then
LICENSE="GPL-3+ LGPL-2.1+ || ( GPL-3+ libgcc libstdc++ ) FDL-1.2+"
elif tc_version_is_at_least 3.3 ; then
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.2+"
else
LICENSE="GPL-2+ LGPL-2.1+ FDL-1.1+"
fi
if tc_version_is_at_least 8.3; then
GCC_EBUILD_TEST_FLAG='test'
else
# Don't force USE regression-test->test change on every
# gcc ebuild just yet. Let's do the change when >=gcc-8.3
# is commonly used as a main compiler.
GCC_EBUILD_TEST_FLAG='regression-test'
fi
IUSE="${GCC_EBUILD_TEST_FLAG} vanilla +nls"
TC_FEATURES=()
tc_has_feature() {
has "$1" "${TC_FEATURES[@]}"
}
if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
IUSE+=" altivec debug +cxx +fortran +nptl" TC_FEATURES+=(fortran nptl)
[[ -n ${PIE_VER} ]] && IUSE+=" nopie"
[[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
[[ -n ${D_VER} ]] && IUSE+=" d"
[[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
tc_version_is_at_least 3 && IUSE+=" doc hardened multilib objc"
tc_version_is_between 3 7 && IUSE+=" awt gcj" TC_FEATURES+=(gcj)
tc_version_is_at_least 3.3 && IUSE+=" pgo"
tc_version_is_at_least 4.0 &&
IUSE+=" objc-gc" TC_FEATURES+=(objc-gc)
tc_version_is_between 4.0 4.9 && IUSE+=" mudflap"
tc_version_is_at_least 4.1 && IUSE+=" libssp objc++"
tc_version_is_at_least 4.2 && IUSE+=" +openmp"
tc_version_is_at_least 4.3 && IUSE+=" fixed-point"
tc_version_is_at_least 4.7 && IUSE+=" go"
# Note: while <=gcc-4.7 also supported graphite, it required forked ppl
# versions which we dropped. Since graphite was also experimental in
# the older versions, we don't want to bother supporting it. #448024
tc_version_is_at_least 4.8 &&
IUSE+=" graphite +sanitize" TC_FEATURES+=(graphite)
tc_version_is_between 4.9 8 && IUSE+=" cilk"
tc_version_is_at_least 4.9 && IUSE+=" +vtv"
tc_version_is_at_least 5.0 && IUSE+=" jit"
tc_version_is_between 5.0 9 && IUSE+=" mpx"
tc_version_is_at_least 6.0 && IUSE+=" +pie +ssp +pch"
# systemtap is a gentoo-specific switch: bug #654748
tc_version_is_at_least 8.0 &&
IUSE+=" systemtap" TC_FEATURES+=(systemtap)
tc_version_is_at_least 9.0 && IUSE+=" d"
tc_version_is_at_least 9.1 && IUSE+=" lto"
fi
SLOT="${GCC_CONFIG_VER}"
#---->> DEPEND <<----
RDEPEND="sys-libs/zlib
nls? ( virtual/libintl )"
tc_version_is_at_least 3 && RDEPEND+=" virtual/libiconv"
if tc_version_is_at_least 4 ; then
GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2:0= >=dev-libs/mpfr-2.4.2:0="
if tc_version_is_at_least 4.3 ; then
RDEPEND+=" ${GMP_MPFR_DEPS}"
elif tc_has_feature fortran ; then
RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
fi
fi
tc_version_is_at_least 4.5 && RDEPEND+=" >=dev-libs/mpc-0.8.1:0="
if tc_has_feature objc-gc ; then
if tc_version_is_at_least 7 ; then
RDEPEND+=" objc-gc? ( >=dev-libs/boehm-gc-7.4.2 )"
fi
fi
if tc_has_feature graphite ; then
if tc_version_is_at_least 5.0 ; then
RDEPEND+=" graphite? ( >=dev-libs/isl-0.14:0= )"
elif tc_version_is_at_least 4.8 ; then
RDEPEND+="
graphite? (
>=dev-libs/cloog-0.18.0:0=
>=dev-libs/isl-0.11.1:0=
)"
fi
fi
DEPEND="${RDEPEND}
>=sys-devel/bison-1.875
>=sys-devel/flex-2.5.4
nls? ( sys-devel/gettext )
${GCC_EBUILD_TEST_FLAG}? (
>=dev-util/dejagnu-1.4.4
>=sys-devel/autogen-5.5.4
)"
if tc_has_feature gcj ; then
GCJ_DEPS=">=media-libs/libart_lgpl-2.1"
GCJ_GTK_DEPS="
x11-base/xorg-proto
x11-libs/libXt
x11-libs/libX11
x11-libs/libXtst
=x11-libs/gtk+-2*
virtual/pkgconfig
"
tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango"
tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip"
DEPEND+=" gcj? ( awt? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )"
fi
if tc_has_feature systemtap ; then
# gcc needs sys/sdt.h headers on target
DEPEND+=" systemtap? ( dev-util/systemtap )"
fi
PDEPEND=">=sys-devel/gcc-config-1.7"
#---->> S + SRC_URI essentials <<----
# Set the source directory depending on whether we're using
# a prerelease, snapshot, or release tarball.
S=$(
if [[ -n ${PRERELEASE} ]] ; then
echo ${WORKDIR}/gcc-${PRERELEASE}
elif [[ -n ${SNAPSHOT} ]] ; then
echo ${WORKDIR}/gcc-${SNAPSHOT}
else
echo ${WORKDIR}/gcc-${GCC_RELEASE_VER}
fi
)
gentoo_urls() {
local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI
HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI
HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI"
devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/}
echo mirror://gentoo/$1 ${devspace//URI/$1}
}
# This function handles the basics of setting the SRC_URI for a gcc ebuild.
# To use, set SRC_URI with:
#
# SRC_URI="$(get_gcc_src_uri)"
#
# Other than the variables normally set by portage, this function's behavior
# can be altered by setting the following:
#
# SNAPSHOT
# If set, this variable signals that we should be using a snapshot of
# gcc. It is expected to be in the format "YYYY-MM-DD". Note that if
# the ebuild has a _pre suffix, this variable is ignored and the
# prerelease tarball is used instead.
#
# BRANCH_UPDATE
# If set, this variable signals that we should be using the main
# release tarball (determined by ebuild version) and applying a
# CVS branch update patch against it. The location of this branch
# update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}.
# Just like with SNAPSHOT, this variable is ignored if the ebuild
# has a _pre suffix.
#
# PATCH_VER
# PATCH_GCC_VER
# This should be set to the version of the gentoo patch tarball.
# The resulting filename of this tarball will be:
# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2
#
# PIE_VER
# PIE_GCC_VER
# These variables control patching in various updates for the logic
# controlling Position Independant Executables. PIE_VER is expected
# to be the version of this patch, and PIE_GCC_VER the gcc version of
# the patch:
# An example:
# PIE_VER="8.7.6.5"
# PIE_GCC_VER="3.4.0"
# The resulting filename of this tarball will be:
# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.bz2
#
# SPECS_VER
# SPECS_GCC_VER
# This is for the minispecs files included in the hardened gcc-4.x
# The specs files for hardenedno*, vanilla and for building the "specs" file.
# SPECS_VER is expected to be the version of this patch, SPECS_GCC_VER
# the gcc version of the patch.
# An example:
# SPECS_VER="8.7.6.5"
# SPECS_GCC_VER="3.4.0"
# The resulting filename of this tarball will be:
# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2
#
# HTB_VER
# HTB_GCC_VER
# These variables control whether or not an ebuild supports Herman
# ten Brugge's bounds-checking patches. If you want to use a patch
# for an older gcc version with a new gcc, make sure you set
# HTB_GCC_VER to that version of gcc.
#
# CYGWINPORTS_GITREV
# If set, this variable signals that we should apply additional patches
# maintained by upstream Cygwin developers at github/cygwinports/gcc,
# using the specified git commit id there. The list of patches to
# apply is extracted from gcc.cygport, maintained there as well.
# This is done for compilers running on Cygwin, not for cross compilers
# with a Cygwin target.
get_gcc_src_uri() {
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
# Set where to download gcc itself depending on whether we're using a
# prerelease, snapshot, or release tarball.
if [[ ${PV} == *9999* ]] ; then
# Nothing to do w/git snapshots.
:
elif [[ -n ${PRERELEASE} ]] ; then
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2"
elif [[ -n ${SNAPSHOT} ]] ; then
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.xz"
else
GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2"
fi
else
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.xz"
else
GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2"
fi
# we want all branch updates to be against the main release
[[ -n ${BRANCH_UPDATE} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)"
fi
[[ -n ${UCLIBC_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2)"
[[ -n ${PATCH_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)"
# strawberry pie, Cappuccino and a Gauloises (it's a good thing)
[[ -n ${PIE_VER} ]] && \
PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} && \
GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})"
# gcc minispec for the hardened gcc 4 compiler
[[ -n ${SPECS_VER} ]] && \
GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)"
# gcc bounds checking patch
if [[ -n ${HTB_VER} ]] ; then
local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
GCC_SRC_URI+="
boundschecking? (
mirror://sourceforge/boundschecking/${HTBFILE}
$(gentoo_urls ${HTBFILE})
)"
fi
[[ -n ${D_VER} ]] && \
GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )"
if tc_has_feature gcj ; then
if tc_version_is_at_least 4.5 ; then
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )"
elif tc_version_is_at_least 4.3 ; then
GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )"
fi
fi
# Cygwin patches from https://github.com/cygwinports/gcc
[[ -n ${CYGWINPORTS_GITREV} ]] && \
GCC_SRC_URI+=" elibc_Cygwin? ( https://github.com/cygwinports/gcc/archive/${CYGWINPORTS_GITREV}.tar.gz
-> gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz )"
echo "${GCC_SRC_URI}"
}
SRC_URI=$(get_gcc_src_uri)
#---->> pkg_pretend <<----
toolchain_pkg_pretend() {
if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
[[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] ; then
die "Please \`export I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS=1\` or define it" \
"in your make.conf if you want to use this version."
fi
if ! use_if_iuse cxx ; then
use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"'
use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"'
use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
fi
want_minispecs
}
#---->> pkg_setup <<----
toolchain_pkg_setup() {
# we dont want to use the installed compiler's specs to build gcc
unset GCC_SPECS
unset LANGUAGES #265283
}
#---->> src_unpack <<----
toolchain_src_unpack() {
if [[ ${PV} == *9999* ]]; then
git-2_src_unpack
else
gcc_quick_unpack
fi
}
gcc_quick_unpack() {
pushd "${WORKDIR}" > /dev/null
export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
if [[ -n ${GCC_A_FAKEIT} ]] ; then
unpack ${GCC_A_FAKEIT}
elif [[ -n ${PRERELEASE} ]] ; then
unpack gcc-${PRERELEASE}.tar.bz2
elif [[ -n ${SNAPSHOT} ]] ; then
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
unpack gcc-${SNAPSHOT}.tar.xz
else
unpack gcc-${SNAPSHOT}.tar.bz2
fi
elif [[ ${PV} != *9999* ]] ; then
if tc_version_is_between 5.5 6 || tc_version_is_between 6.4 7 || tc_version_is_at_least 7.2 ; then
unpack gcc-${GCC_RELEASE_VER}.tar.xz
else
unpack gcc-${GCC_RELEASE_VER}.tar.bz2
fi
# We want branch updates to be against a release tarball
if [[ -n ${BRANCH_UPDATE} ]] ; then
pushd "${S}" > /dev/null
epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
popd > /dev/null
fi
fi
if [[ -n ${D_VER} ]] && use d ; then
pushd "${S}"/gcc > /dev/null
unpack gdc-${D_VER}-src.tar.bz2
cd ..
ebegin "Adding support for the D language"
./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
if ! eend $? ; then
eerror "The D GCC package failed to apply"
eerror "Please include this log file when posting a bug report:"
eerror " ${T}/dgcc.log"
die "failed to include the D language"
fi
popd > /dev/null
fi
[[ -n ${PATCH_VER} ]] && \
unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
[[ -n ${UCLIBC_VER} ]] && \
unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
if want_pie ; then
if [[ -n ${PIE_CORE} ]] ; then
unpack ${PIE_CORE}
else
unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
fi
[[ -n ${SPECS_VER} ]] && \
unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
fi
use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
[[ -n ${CYGWINPORTS_GITREV} ]] && use elibc_Cygwin && unpack "gcc-cygwinports-${CYGWINPORTS_GITREV}.tar.gz"
popd > /dev/null
}
#---->> src_prepare <<----
toolchain_src_prepare() {
export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
cd "${S}"
if ! use vanilla ; then
if [[ -n ${PATCH_VER} ]] ; then
guess_patch_type_in_dir "${WORKDIR}"/patch
EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
epatch "${WORKDIR}"/patch
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
fi
if [[ -n ${UCLIBC_VER} ]] ; then
guess_patch_type_in_dir "${WORKDIR}"/uclibc
EPATCH_MULTI_MSG="Applying uClibc patches ..." \
epatch "${WORKDIR}"/uclibc
fi
fi
do_gcc_HTB_patches
do_gcc_PIE_patches
do_gcc_CYGWINPORTS_patches
case ${EAPI:-0} in
5*) epatch_user;;
6) eapply_user ;;
*) die "Update toolchain_src_prepare() for ${EAPI}." ;;
esac
if ( tc_version_is_at_least 4.8.2 || use_if_iuse hardened ) && ! use vanilla ; then
make_gcc_hard
fi
# install the libstdc++ python into the right location
# http://gcc.gnu.org/PR51368
if tc_version_is_between 4.5 4.7 ; then
sed -i \
'/^pythondir =/s:=.*:= $(datadir)/python:' \
"${S}"/libstdc++-v3/python/Makefile.in || die
fi
# make sure the pkg config files install into multilib dirs.
# since we configure with just one --libdir, we can't use that
# (as gcc itself takes care of building multilibs). #435728
find "${S}" -name Makefile.in \
-exec sed -i '/^pkgconfigdir/s:=.*:=$(toolexeclibdir)/pkgconfig:' {} +
# No idea when this first started being fixed, but let's go with 4.3.x for now
if ! tc_version_is_at_least 4.3 ; then
fix_files=""
for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
[[ -e ${x} ]] && fix_files="${fix_files} ${x}"
done
ht_fix_file ${fix_files} */configure *.sh */Makefile.in
fi
setup_multilib_osdirnames
gcc_version_patch
if tc_version_is_at_least 4.1 ; then
if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
# BASE-VER must be a three-digit version number
# followed by an optional -pre string
# eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
# If BASE-VER differs from ${PV/_/-} then libraries get installed in
# the wrong directory.
echo ${PV/_/-} > "${S}"/gcc/BASE-VER
fi
fi
# >= gcc-4.3 doesn't bundle ecj.jar, so copy it
if tc_version_is_at_least 4.3 && use_if_iuse gcj ; then
if tc_version_is_at_least 4.5 ; then
einfo "Copying ecj-4.5.jar"
cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
else
einfo "Copying ecj-4.3.jar"
cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
fi
fi
# disable --as-needed from being compiled into gcc specs
# natively when using a gcc version < 3.4.4
# http://gcc.gnu.org/PR14992
if ! tc_version_is_at_least 3.4.4 ; then
sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
fi
# In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
# in line with gcc-4.
if tc_version_is_between 3.3 4.0 ; then
do_gcc_rename_java_bins
fi
# Prevent libffi from being installed
if tc_version_is_between 3.0 4.8 ; then
sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in || die
sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in || die
fi
# Fixup libtool to correctly generate .la files with portage
elibtoolize --portage --shallow --no-uclibc
gnuconfig_update
# update configure files
local f
einfo "Fixing misc issues in configure files"
for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
ebegin " Updating ${f/${S}\/} [LANG]"
patch "${f}" "${FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
|| eerror "Please file a bug about this"
eend $?
done
sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
# Prevent new texinfo from breaking old versions (see #198182, #464008)
tc_version_is_at_least 4.1 && epatch "${FILESDIR}"/gcc-configure-texinfo.patch
if [[ -x contrib/gcc_update ]] ; then
einfo "Touching generated files"
./contrib/gcc_update --touch | \
while read f ; do
einfo " ${f%%...}"
done
fi
}
guess_patch_type_in_dir() {
[[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
&& EPATCH_SUFFIX="patch.bz2" \
|| EPATCH_SUFFIX="patch"
}
do_gcc_HTB_patches() {
use_if_iuse boundschecking || return 0
# modify the bounds checking patch with a regression patch
epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
}
do_gcc_PIE_patches() {
want_pie || return 0
use vanilla && return 0
if tc_version_is_at_least 4.3.2 ; then
guess_patch_type_in_dir "${WORKDIR}"/piepatch/
EPATCH_MULTI_MSG="Applying pie patches ..." \
epatch "${WORKDIR}"/piepatch/
else
guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
# corrects startfile/endfile selection and shared/static/pie flag usage
EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
epatch "${WORKDIR}"/piepatch/upstream
# adds non-default pie support (rs6000)
EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
epatch "${WORKDIR}"/piepatch/nondef
# adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
EPATCH_MULTI_MSG="Applying default pie patches ..." \
epatch "${WORKDIR}"/piepatch/def
fi
BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
}
do_gcc_CYGWINPORTS_patches() {
[[ -n ${CYGWINPORTS_GITREV} ]] || return 0
use elibc_Cygwin || return 0
local p d="${WORKDIR}/gcc-${CYGWINPORTS_GITREV}"
# readarray -t is available since bash-4.4 only, #690686
local patches=( $(sed -e '1,/PATCH_URI="/d;/"/,$d' < "${d}"/gcc.cygport) )
for p in ${patches[*]}; do
epatch "${d}/${p}"
done
}
# configure to build with the hardened GCC specs as the default
make_gcc_hard() {
local gcc_hard_flags=""
# If we use gcc-6 or newer with pie enable to compile older gcc we need to pass -no-pie
# to stage1; bug 618908
if ! tc_version_is_at_least 6.0 && [[ $(gcc-major-version) -ge 6 ]] ; then
einfo "Disabling PIE in stage1 (only) ..."
sed -i -e "/^STAGE1_LDFLAGS/ s/$/ -no-pie/" "${S}"/Makefile.in || die
fi
# Gcc >= 6.X we can use configurations options to turn pie/ssp on as default
if tc_version_is_at_least 6.0 ; then
if use_if_iuse pie ; then
einfo "Updating gcc to use automatic PIE building ..."
fi
if use_if_iuse ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
fi
if use_if_iuse hardened ; then
# Will add some optimatizion as default.
gcc_hard_flags+=" -DEXTRA_OPTIONS"
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
fi
else
if use_if_iuse hardened ; then
# rebrand to make bug reports easier
BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
if hardened_gcc_works ; then
einfo "Updating gcc to use automatic PIE + SSP building ..."
gcc_hard_flags+=" -DEFAULT_PIE_SSP"
elif hardened_gcc_works pie ; then
einfo "Updating gcc to use automatic PIE building ..."
ewarn "SSP has not been enabled by default"
gcc_hard_flags+=" -DEFAULT_PIE"
elif hardened_gcc_works ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
ewarn "PIE has not been enabled by default"
gcc_hard_flags+=" -DEFAULT_SSP"
else
# do nothing if hardened isn't supported, but don't die either
ewarn "hardened is not supported for this arch in this gcc version"
return 0
fi
else
if hardened_gcc_works ssp ; then
einfo "Updating gcc to use automatic SSP building ..."
gcc_hard_flags+=" -DEFAULT_SSP"
fi
fi
fi
# we want to be able to control the pie patch logic via something other
# than ALL_CFLAGS...
sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
-e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
-i "${S}"/gcc/Makefile.in
# Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
if tc_version_is_at_least 4.7 ; then
sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
-e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
-i "${S}"/gcc/Makefile.in
fi
sed -i \
-e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
"${S}"/gcc/Makefile.in || die
}
# This is a historical wart. The original Gentoo/amd64 port used:
# lib32 - 32bit binaries (x86)
# lib64 - 64bit binaries (x86_64)
# lib - "native" binaries (a symlink to lib64)
# Most other distros use the logic (including mainline gcc):
# lib - 32bit binaries (x86)
# lib64 - 64bit binaries (x86_64)
# Over time, Gentoo is migrating to the latter form.
#
# Unfortunately, due to distros picking the lib32 behavior, newer gcc
# versions will dynamically detect whether to use lib or lib32 for its
# 32bit multilib. So, to keep the automagic from getting things wrong
# while people are transitioning from the old style to the new style,
# we always set the MULTILIB_OSDIRNAMES var for relevant targets.
setup_multilib_osdirnames() {
is_multilib || return 0
local config
local libdirs="../lib64 ../lib32"
# this only makes sense for some Linux targets
case ${CTARGET} in
x86_64*-linux*) config="i386" ;;
powerpc64*-linux*) config="rs6000" ;;
sparc64*-linux*) config="sparc" ;;
s390x*-linux*) config="s390" ;;
*) return 0 ;;
esac
config+="/t-linux64"
local sed_args=()
if tc_version_is_at_least 4.6 ; then
sed_args+=( -e 's:$[(]call if_multiarch[^)]*[)]::g' )
fi
if [[ ${SYMLINK_LIB} == "yes" ]] ; then
einfo "updating multilib directories to be: ${libdirs}"
if tc_version_is_at_least 4.6.4 || tc_version_is_at_least 4.7 ; then
sed_args+=( -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' )
else
sed_args+=( -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" )
fi
else
einfo "using upstream multilib; disabling lib32 autodetection"
sed_args+=( -r -e 's:[$][(]if.*,(.*)[)]:\1:' )
fi
sed -i "${sed_args[@]}" "${S}"/gcc/config/${config} || die
}
gcc_version_patch() {
# gcc-4.3+ has configure flags (whoo!)
tc_version_is_at_least 4.3 && return 0
local version_string=${GCC_CONFIG_VER}
[[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
else
version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
fi
sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
}
do_gcc_rename_java_bins() {
# bug #139918 - conflict between gcc and java-config-2 for ownership of
# /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch
# because patches would be large (thanks to the rename of man files),
# and it's clear from the sed invocations that all that changes is the
# rmi{c,registry} names to grmi{c,registry} names.
# Kevin F. Quinn 2006-07-12
einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry."
# 1) Move the man files if present (missing prior to gcc-3.4)
for manfile in rmic rmiregistry ; do
[[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue
mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1
done
# 2) Fixup references in the docs if present (mission prior to gcc-3.4)
for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi ; do
[[ -f ${S}/${jfile} ]] || continue
sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
die "Failed to fixup file ${jfile} for rename to grmiregistry"
sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} ||
die "Failed to fixup file ${jfile} for rename to grmic"
done
# 3) Fixup Makefiles to build the changed executable names
# These are present in all 3.x versions, and are the important bit
# to get gcc to build with the new names.
for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in ; do
sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} ||
die "Failed to fixup file ${jfile} for rename to grmiregistry"
# Careful with rmic on these files; it's also the name of a directory
# which should be left unchanged. Replace occurrences of 'rmic$',
# 'rmic_' and 'rmic '.
sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} ||
die "Failed to fixup file ${jfile} for rename to grmic"
done
}
#---->> src_configure <<----
toolchain_src_configure() {
downgrade_arch_flags
gcc_do_filter_flags
einfo "CFLAGS=\"${CFLAGS}\""
einfo "CXXFLAGS=\"${CXXFLAGS}\""
einfo "LDFLAGS=\"${LDFLAGS}\""
# Force internal zip based jar script to avoid random
# issues with 3rd party jar implementations. #384291
export JAR=no
# For hardened gcc 4.3 piepatchset to build the hardened specs
# file (build.specs) to use when building gcc.
if ! tc_version_is_at_least 4.4 && want_minispecs ; then
setup_minispecs_gcc_build_specs
fi
local confgcc=( --host=${CHOST} )
if is_crosscompile || tc-is-cross-compiler ; then
# Straight from the GCC install doc:
# "GCC has code to correctly determine the correct value for target
# for nearly all native systems. Therefore, we highly recommend you
# not provide a configure target when configuring a native compiler."
confgcc+=( --target=${CTARGET} )
fi
[[ -n ${CBUILD} ]] && confgcc+=( --build=${CBUILD} )
confgcc+=(
--prefix="${PREFIX}"
--bindir="${BINPATH}"
--includedir="${INCLUDEPATH}"
--datadir="${DATAPATH}"
--mandir="${DATAPATH}/man"
--infodir="${DATAPATH}/info"
--with-gxx-include-dir="${STDCXX_INCDIR}"
)
# Stick the python scripts in their own slotted directory (bug #279252)
#
# --with-python-dir=DIR
# Specifies where to install the Python modules used for aot-compile. DIR
# should not include the prefix used in installation. For example, if the
# Python modules are to be installed in /usr/lib/python2.5/site-packages,
# then --with-python-dir=/lib/python2.5/site-packages should be passed.
#
# This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
if tc_version_is_at_least 4.4 ; then
confgcc+=( --with-python-dir=${DATAPATH/$PREFIX/}/python )
fi
### language options
local GCC_LANG="c"
is_cxx && GCC_LANG+=",c++"
is_d && GCC_LANG+=",d"
is_gcj && GCC_LANG+=",java"
is_go && GCC_LANG+=",go"
is_jit && GCC_LANG+=",jit"
if is_objc || is_objcxx ; then
GCC_LANG+=",objc"
if tc_version_is_at_least 4 ; then
use objc-gc && confgcc+=( --enable-objc-gc )
fi
is_objcxx && GCC_LANG+=",obj-c++"
fi
# fortran support just got sillier! the lang value can be f77 for
# fortran77, f95 for fortran95, or just plain old fortran for the
# currently supported standard depending on gcc version.
is_fortran && GCC_LANG+=",fortran"
is_f77 && GCC_LANG+=",f77"
is_f95 && GCC_LANG+=",f95"
# We do NOT want 'ADA support' in here!
# is_ada && GCC_LANG+=",ada"
confgcc+=( --enable-languages=${GCC_LANG} )
### general options
confgcc+=(
--enable-obsolete
--enable-secureplt
--disable-werror
--with-system-zlib
)
if use nls ; then
confgcc+=( --enable-nls --without-included-gettext )
else
confgcc+=( --disable-nls )
fi
tc_version_is_at_least 3.4 || confgcc+=( --disable-libunwind-exceptions )
# Use the default ("release") checking because upstream usually neglects
# to test "disabled" so it has a history of breaking. #317217
if tc_version_is_at_least 3.4 && in_iuse debug ; then
# The "release" keyword is new to 4.0. #551636
local off=$(tc_version_is_at_least 4.0 && echo release || echo no)
confgcc+=( --enable-checking="${GCC_CHECKS_LIST:-$(usex debug yes ${off})}" )
fi
# Branding
tc_version_is_at_least 4.3 && confgcc+=(
--with-bugurl=https://bugs.gentoo.org/
--with-pkgversion="${BRANDING_GCC_PKGVERSION}"
)
# If we want hardened support with the newer piepatchset for >=gcc 4.4
if tc_version_is_at_least 4.4 && want_minispecs && in_iuse hardened ; then
confgcc+=( $(use_enable hardened esp) )
fi
# allow gcc to search for clock funcs in the main C lib.
# if it can't find them, then tough cookies -- we aren't
# going to link in -lrt to all C++ apps. #411681
if tc_version_is_at_least 4.4 && is_cxx ; then
confgcc+=( --enable-libstdcxx-time )
fi
# Build compiler using LTO
if tc_version_is_at_least 9.1 && use_if_iuse lto ; then
confgcc+=( --with-build-config=bootstrap-lto )
fi