Gentoo Archives: gentoo-commits

From: Magnus Granberg <zorry@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:testing commit in: sys-devel/gcc/, eclass/
Date: Sat, 07 Apr 2012 19:11:30
Message-Id: 1333825802.4462a08a4a276088d8b5cc608f9e31848844a0da.zorry@gentoo
1 commit: 4462a08a4a276088d8b5cc608f9e31848844a0da
2 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org>
3 AuthorDate: Sat Apr 7 19:10:02 2012 +0000
4 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org>
5 CommitDate: Sat Apr 7 19:10:02 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=4462a08a
7
8 toolchain eclass eapi4 port
9
10 ---
11 eclass/{toolchain2.eclass => toolchain.eclass} | 1145 +++++++++++-------------
12 eclass/toolchain2.eclass | 566 +++----------
13 sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild | 18 +-
14 3 files changed, 655 insertions(+), 1074 deletions(-)
15
16 diff --git a/eclass/toolchain2.eclass b/eclass/toolchain.eclass
17 similarity index 96%
18 copy from eclass/toolchain2.eclass
19 copy to eclass/toolchain.eclass
20 index b5c0aa0..aa00f09 100644
21 --- a/eclass/toolchain2.eclass
22 +++ b/eclass/toolchain.eclass
23 @@ -23,13 +23,11 @@ if [[ ${PV} == *_pre9999* ]] ; then
24 inherit git-2
25 fi
26
27 -EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
28 DESCRIPTION="The GNU Compiler Collection"
29
30 FEATURES=${FEATURES/multilib-strict/}
31 #----<< eclass stuff >>----
32
33 -
34 #---->> globals <<----
35 export CTARGET=${CTARGET:-${CHOST}}
36 if [[ ${CTARGET} = ${CHOST} ]] ; then
37 @@ -91,7 +89,6 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
38
39 #----<< globals >>----
40
41 -
42 #---->> SLOT+IUSE logic <<----
43 IUSE="build multislot nls nptl test vanilla"
44
45 @@ -319,7 +316,6 @@ get_gcc_src_uri() {
46 SRC_URI=$(get_gcc_src_uri)
47 #---->> S + SRC_URI essentials >>----
48
49 -
50 #---->> support checks <<----
51
52 # Grab a variable from the build system (taken from linux-info.eclass)
53 @@ -544,13 +540,8 @@ copy_minispecs_gcc_specs() {
54 #----<< specs + env.d logic >>----
55
56 #---->> pkg_* <<----
57 -toolchain_pkg_setup() {
58 - if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
59 - [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]]
60 - then
61 - 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." \
62 - "This is to try and cut down on people filing bugs for a compiler we do not currently support."
63 - fi
64 +
65 +pkg_setup() {
66
67 # Setup variables which would normally be in the profile
68 if is_crosscompile ; then
69 @@ -574,11 +565,11 @@ toolchain_pkg_setup() {
70 unset LANGUAGES #265283
71 }
72
73 -toolchain_pkg_preinst() {
74 +pkg_preinst() {
75 :
76 }
77
78 -toolchain_pkg_postinst() {
79 +pkg_postinst() {
80 do_gcc_config
81
82 if ! is_crosscompile ; then
83 @@ -630,13 +621,13 @@ toolchain_pkg_postinst() {
84 fi
85 }
86
87 -toolchain_pkg_prerm() {
88 +pkg_prerm() {
89 # Don't let these files be uninstalled #87647
90 touch -c "${ROOT}"/sbin/fix_libtool_files.sh \
91 "${ROOT}"/$(get_libdir)/rcscripts/awk/fixlafiles.awk
92 }
93
94 -toolchain_pkg_postrm() {
95 +pkg_postrm() {
96 # to make our lives easier (and saner), we do the fix_libtool stuff here.
97 # rather than checking SLOT's and trying in upgrade paths, we just see if
98 # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
99 @@ -672,7 +663,7 @@ toolchain_pkg_postrm() {
100
101 #---->> pkg_* <<----
102
103 -#---->> src_* <<----
104 +#---->> some function for src_* <<----
105
106 guess_patch_type_in_dir() {
107 [[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \
108 @@ -713,125 +704,6 @@ do_gcc_rename_java_bins() {
109 die "Failed to fixup file ${jfile} for rename to grmic"
110 done
111 }
112 -toolchain_src_unpack() {
113 - [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
114 -
115 - if [[ ${PV} == *9999* ]]; then
116 - git-2_src_unpack
117 - else
118 - gcc_quick_unpack
119 - fi
120 -
121 - export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
122 - cd "${S}"
123 -
124 - if ! use vanilla ; then
125 - if [[ -n ${PATCH_VER} ]] ; then
126 - guess_patch_type_in_dir "${WORKDIR}"/patch
127 - EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
128 - epatch "${WORKDIR}"/patch
129 - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
130 - fi
131 - if [[ -n ${UCLIBC_VER} ]] ; then
132 - guess_patch_type_in_dir "${WORKDIR}"/uclibc
133 - EPATCH_MULTI_MSG="Applying uClibc patches ..." \
134 - epatch "${WORKDIR}"/uclibc
135 - fi
136 - fi
137 - do_gcc_HTB_patches
138 - do_gcc_PIE_patches
139 - epatch_user
140 -
141 - use hardened && make_gcc_hard
142 -
143 - # install the libstdc++ python into the right location
144 - # http://gcc.gnu.org/PR51368
145 - if tc_version_is_at_least 4.5 ; then
146 - sed -i \
147 - '/^pythondir =/s:=.*:= $(datadir)/python:' \
148 - "${S}"/libstdc++-v3/python/Makefile.in || die
149 - fi
150 -
151 - # No idea when this first started being fixed, but let's go with 4.3.x for now
152 - if ! tc_version_is_at_least 4.3 ; then
153 - fix_files=""
154 - for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
155 - [[ -e ${x} ]] && fix_files="${fix_files} ${x}"
156 - done
157 - ht_fix_file ${fix_files} */configure *.sh */Makefile.in
158 - fi
159 -
160 - setup_multilib_osdirnames
161 -
162 - gcc_version_patch
163 - if tc_version_is_at_least 4.1 ; then
164 - if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
165 - # BASE-VER must be a three-digit version number
166 - # followed by an optional -pre string
167 - # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
168 - # If BASE-VER differs from ${PV/_/-} then libraries get installed in
169 - # the wrong directory.
170 - echo ${PV/_/-} > "${S}"/gcc/BASE-VER
171 - fi
172 - fi
173 -
174 - # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
175 - if tc_version_is_at_least 4.3 && use gcj ; then
176 - if tc_version_is_at_least "4.5" ; then
177 - einfo "Copying ecj-4.5.jar"
178 - cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
179 - elif tc_version_is_at_least "4.3" ; then
180 - einfo "Copying ecj-4.3.jar"
181 - cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
182 - fi
183 - fi
184 -
185 - # disable --as-needed from being compiled into gcc specs
186 - # natively when using a gcc version < 3.4.4
187 - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992
188 - if ! tc_version_is_at_least 3.4.4 ; then
189 - sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
190 - fi
191 -
192 - # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
193 - # in line with gcc-4.
194 - if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then
195 - do_gcc_rename_java_bins
196 - fi
197 -
198 - # Prevent libffi from being installed
199 - sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
200 - sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
201 -
202 - # Fixup libtool to correctly generate .la files with portage
203 - cd "${S}"
204 - elibtoolize --portage --shallow --no-uclibc
205 -
206 - gnuconfig_update
207 -
208 - # update configure files
209 - local f
210 - einfo "Fixing misc issues in configure files"
211 - tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
212 - for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
213 - ebegin " Updating ${f/${S}\/} [LANG]"
214 - patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
215 - || eerror "Please file a bug about this"
216 - eend $?
217 - done
218 - sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
219 -
220 - if [[ -x contrib/gcc_update ]] ; then
221 - einfo "Touching generated files"
222 - ./contrib/gcc_update --touch | \
223 - while read f ; do
224 - einfo " ${f%%...}"
225 - done
226 - fi
227 -
228 - disable_multilib_libjava || die "failed to disable multilib java"
229 -}
230 -
231 gcc-abi-map() {
232 # Convert the ABI name we use in Gentoo to what gcc uses
233 local map=()
234 @@ -846,7 +718,6 @@ gcc-abi-map() {
235 [[ $1 == ${l[0]} ]] && echo ${l[1]} && break
236 done
237 }
238 -
239 gcc-multilib-configure() {
240 # if multilib is disabled, get out quick!
241 if ! is_multilib ; then
242 @@ -875,7 +746,6 @@ gcc-multilib-configure() {
243 esac
244 fi
245 }
246 -
247 gcc-compiler-configure() {
248 gcc-multilib-configure
249
250 @@ -1036,74 +906,493 @@ gcc-compiler-configure() {
251 einfo "configuring for GCC_LANG: ${GCC_LANG}"
252 confgcc+=" --enable-languages=${GCC_LANG}"
253 }
254 +has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
255 +toolchain_death_notice() {
256 + pushd "${WORKDIR}"/build >/dev/null
257 + tar jcf gcc-build-logs.tar.bz2 $(find -name config.log)
258 + eerror
259 + eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report"
260 + eerror
261 + popd >/dev/null
262 +}
263 +# This is mostly a stub function to be overwritten in an ebuild
264 +gcc_do_filter_flags() {
265 + strip-flags
266
267 -gcc_do_configure() {
268 - local confgcc
269 + # In general gcc does not like optimization, and add -O2 where
270 + # it is safe. This is especially true for gcc 3.3 + 3.4
271 + replace-flags -O? -O2
272
273 - # Sanity check for USE=nocxx -> USE=cxx migration
274 - if in_iuse cxx && in_iuse nocxx ; then
275 - if (use cxx && use nocxx) || (use !cxx && use !nocxx) ; then
276 - eerror "We are migrating USE=nocxx to USE=cxx, but your USE settings do not make"
277 - eerror "sense. Please make sure these two flags line up logically in your setup."
278 - die "USE='cxx nocxx' and USE='-cxx -nocxx' make no sense"
279 - fi
280 - fi
281 + # ... sure, why not?
282 + strip-unsupported-flags
283
284 - # Set configuration based on path variables
285 - confgcc+=" \
286 - --prefix=${PREFIX} \
287 - --bindir=${BINPATH} \
288 - --includedir=${INCLUDEPATH} \
289 - --datadir=${DATAPATH} \
290 - --mandir=${DATAPATH}/man \
291 - --infodir=${DATAPATH}/info \
292 - --with-gxx-include-dir=${STDCXX_INCDIR}"
293 - # On Darwin we need libdir to be set in order to get correct install names
294 - # for things like libobjc-gnu, libgcj and libfortran. If we enable it on
295 - # non-Darwin we screw up the behaviour this eclass relies on. We in
296 - # particular need this over --libdir for bug #255315.
297 - [[ ${CTARGET} == *-darwin* ]] && \
298 - confgcc+=" --enable-version-specific-runtime-libs"
299 + # dont want to funk ourselves
300 + filter-flags '-mabi*' -m31 -m32 -m64
301
302 - # All our cross-compile logic goes here ! woo !
303 - confgcc+=" --host=${CHOST}"
304 - if is_crosscompile || tc-is-cross-compiler ; then
305 - # Straight from the GCC install doc:
306 - # "GCC has code to correctly determine the correct value for target
307 - # for nearly all native systems. Therefore, we highly recommend you
308 - # not provide a configure target when configuring a native compiler."
309 - confgcc+=" --target=${CTARGET}"
310 - fi
311 - [[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}"
312 + case ${GCC_BRANCH_VER} in
313 + 3.2|3.3)
314 + replace-cpu-flags k8 athlon64 opteron i686 x86-64
315 + replace-cpu-flags pentium-m pentium3m pentium3
316 + case $(tc-arch) in
317 + amd64|x86) filter-flags '-mtune=*' ;;
318 + # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used,
319 + # the compiler wrongly assumes a 32bit target
320 + ppc64) filter-flags "-mcpu=*";;
321 + esac
322 + case $(tc-arch) in
323 + amd64) replace-cpu-flags core2 nocona;;
324 + x86) replace-cpu-flags core2 prescott;;
325 + esac
326
327 - # ppc altivec support
328 - confgcc+=" $(use_enable altivec)"
329 + replace-cpu-flags G3 750
330 + replace-cpu-flags G4 7400
331 + replace-cpu-flags G5 7400
332
333 - # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
334 - # significantly increase compile time by several hours. This will allow
335 - # users to control this feature in the event they need the support.
336 - tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
337 + # XXX: should add a sed or something to query all supported flags
338 + # from the gcc source and trim everything else ...
339 + filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
340 + filter-flags -f{no-,}stack-protector{,-all}
341 + filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
342 + ;;
343 + 3.4|4.*)
344 + case $(tc-arch) in
345 + x86|amd64) filter-flags '-mcpu=*';;
346 + *-macos)
347 + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127
348 + [[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER} == 4.1 ]] && \
349 + filter-flags '-mcpu=*' '-march=*' '-mtune=*'
350 + ;;
351 + esac
352 + ;;
353 + esac
354
355 - # Graphite support was added in 4.4, which depends on external libraries
356 - # for optimizations. Current versions use cloog-ppl (cloog fork with Parma
357 - # PPL backend). Sometime in the future we will use upstream cloog with the
358 - # ISL backend (note: PPL will still be a requirement). cloog-ppl's include
359 - # path was modified to prevent collisions between the two packages (library
360 - # names are different).
361 + # Compile problems with these (bug #6641 among others)...
362 + #filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr"
363 +
364 + # CFLAGS logic (verified with 3.4.3):
365 + # CFLAGS:
366 + # This conflicts when creating a crosscompiler, so set to a sane
367 + # default in this case:
368 + # used in ./configure and elsewhere for the native compiler
369 + # used by gcc when creating libiberty.a
370 + # used by xgcc when creating libstdc++ (and probably others)!
371 + # this behavior should be removed...
372 #
373 - # We disable the PPL version check so we can use >=ppl-0.11.
374 - if tc_version_is_at_least "4.4"; then
375 - confgcc+=" $(use_with graphite ppl)"
376 - confgcc+=" $(use_with graphite cloog)"
377 - if use graphite; then
378 - confgcc+=" --disable-ppl-version-check"
379 - confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
380 - fi
381 - fi
382 + # CXXFLAGS:
383 + # used by xgcc when creating libstdc++
384 + #
385 + # STAGE1_CFLAGS (not used in creating a crosscompile gcc):
386 + # used by ${CHOST}-gcc for building stage1 compiler
387 + #
388 + # BOOT_CFLAGS (not used in creating a crosscompile gcc):
389 + # used by xgcc for building stage2/3 compiler
390
391 - # LTO support was added in 4.5, which depends upon elfutils. This allows
392 - # users to enable that option, and pull in the additional library. In 4.6,
393 - # the dependency is no longer required.
394 + if is_crosscompile ; then
395 + # Set this to something sane for both native and target
396 + CFLAGS="-O2 -pipe"
397 +
398 + local VAR="CFLAGS_"${CTARGET//-/_}
399 + CXXFLAGS=${!VAR}
400 + fi
401 +
402 + export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
403 +}
404 +gcc_slot_java() {
405 + local x
406 +
407 + # Move Java headers to compiler-specific dir
408 + for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
409 + [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
410 + done
411 + for x in gcj gnu java javax org ; do
412 + if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
413 + dodir /${LIBPATH}/include/${x}
414 + mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
415 + rm -rf "${D}"${PREFIX}/include/${x}
416 + fi
417 + done
418 +
419 + if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
420 + dodir /${LIBPATH}/security
421 + mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
422 + rm -rf "${D}"${PREFIX}/lib*/security
423 + fi
424 +
425 + # Move random gcj files to compiler-specific directories
426 + for x in libgcj.spec logging.properties ; do
427 + x="${D}${PREFIX}/lib/${x}"
428 + [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
429 + done
430 +
431 + # SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
432 + for x in "${D}"${PREFIX}/lib*/pkgconfig/libgcj*.pc ; do
433 + [[ -f ${x} ]] || continue
434 + sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${x}"
435 + mv "${x}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die
436 + done
437 +
438 + # Rename jar because it could clash with Kaffe's jar if this gcc is
439 + # primary compiler (aka don't have the -<version> extension)
440 + cd "${D}"${BINPATH}
441 + [[ -f jar ]] && mv -f jar gcj-jar
442 +}
443 +
444 +# Move around the libs to the right location. For some reason,
445 +# when installing gcc, it dumps internal libraries into /usr/lib
446 +# instead of the private gcc lib path
447 +gcc_movelibs() {
448 + # older versions of gcc did not support --print-multi-os-directory
449 + tc_version_is_at_least 3.0 || return 0
450 +
451 + local multiarg removedirs=""
452 + for multiarg in $($(XGCC) -print-multi-lib) ; do
453 + multiarg=${multiarg#*;}
454 + multiarg=${multiarg//@/ -}
455 +
456 + local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
457 + local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
458 + local TODIR=${D}${LIBPATH}/${MULTIDIR}
459 + local FROMDIR=
460 +
461 + [[ -d ${TODIR} ]] || mkdir -p ${TODIR}
462 +
463 + for FROMDIR in \
464 + ${LIBPATH}/${OS_MULTIDIR} \
465 + ${LIBPATH}/../${MULTIDIR} \
466 + ${PREFIX}/lib/${OS_MULTIDIR} \
467 + ${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
468 + do
469 + removedirs="${removedirs} ${FROMDIR}"
470 + FROMDIR=${D}${FROMDIR}
471 + if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
472 + local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
473 + if [[ -n ${files} ]] ; then
474 + mv ${files} "${TODIR}"
475 + fi
476 + fi
477 + done
478 + fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
479 + done
480 +
481 + # We remove directories separately to avoid this case:
482 + # mv SRC/lib/../lib/*.o DEST
483 + # rmdir SRC/lib/../lib/
484 + # mv SRC/lib/../lib32/*.o DEST # Bork
485 + for FROMDIR in ${removedirs} ; do
486 + rmdir "${D}"${FROMDIR} >& /dev/null
487 + done
488 + find "${D}" -type d | xargs rmdir >& /dev/null
489 +}
490 +
491 +do_gcc_HTB_patches() {
492 + use_if_iuse boundschecking || return 0
493 +
494 + # modify the bounds checking patch with a regression patch
495 + epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
496 + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
497 +}
498 +
499 +# do various updates to PIE logic
500 +do_gcc_PIE_patches() {
501 + want_pie || return 0
502 +
503 + use vanilla && return 0
504 +
505 + if tc_version_is_at_least 4.3.2; then
506 + guess_patch_type_in_dir "${WORKDIR}"/piepatch/
507 + EPATCH_MULTI_MSG="Applying pie patches ..." \
508 + epatch "${WORKDIR}"/piepatch/
509 + else
510 + guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
511 +
512 + # corrects startfile/endfile selection and shared/static/pie flag usage
513 + EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
514 + epatch "${WORKDIR}"/piepatch/upstream
515 + # adds non-default pie support (rs6000)
516 + EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
517 + epatch "${WORKDIR}"/piepatch/nondef
518 + # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
519 + EPATCH_MULTI_MSG="Applying default pie patches ..." \
520 + epatch "${WORKDIR}"/piepatch/def
521 + fi
522 +
523 + # we want to be able to control the pie patch logic via something other
524 + # than ALL_CFLAGS...
525 + sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
526 + -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
527 + -i "${S}"/gcc/Makefile.in
528 + # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
529 + if tc_version_is_at_least 4.7.0 ; then
530 + sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
531 + -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
532 + -i "${S}"/gcc/Makefile.in
533 + fi
534 +
535 + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
536 +}
537 +
538 +#---->> some function for src_* <<----
539 +
540 +#---->> src_* <<----
541 +src_unpack() {
542 + [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
543 +
544 + if [[ ${PV} == *9999* ]]; then
545 + git-2_src_unpack
546 + return
547 + fi
548 +
549 + pushd "${WORKDIR}" > /dev/null
550 + export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
551 + export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
552 + export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
553 + export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
554 + export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
555 +
556 + if [[ -n ${GCC_A_FAKEIT} ]] ; then
557 + unpack ${GCC_A_FAKEIT}
558 + elif [[ -n ${PRERELEASE} ]] ; then
559 + unpack gcc-${PRERELEASE}.tar.bz2
560 + elif [[ -n ${SNAPSHOT} ]] ; then
561 + unpack gcc-${SNAPSHOT}.tar.bz2
562 + elif [[ ${PV} != *9999* ]] ; then
563 + unpack gcc-${GCC_RELEASE_VER}.tar.bz2
564 + # We want branch updates to be against a release tarball
565 + if [[ -n ${BRANCH_UPDATE} ]] ; then
566 + pushd "${S}" > /dev/null
567 + epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
568 + popd > /dev/null
569 + fi
570 + fi
571 +
572 + if [[ -n ${D_VER} ]] && use d ; then
573 + pushd "${S}"/gcc > /dev/null
574 + unpack gdc-${D_VER}-src.tar.bz2
575 + cd ..
576 + ebegin "Adding support for the D language"
577 + ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
578 + if ! eend $? ; then
579 + eerror "The D gcc package failed to apply"
580 + eerror "Please include this log file when posting a bug report:"
581 + eerror " ${T}/dgcc.log"
582 + die "failed to include the D language"
583 + fi
584 + popd > /dev/null
585 + fi
586 +
587 + [[ -n ${PATCH_VER} ]] && \
588 + unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
589 +
590 + [[ -n ${UCLIBC_VER} ]] && \
591 + unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
592 +
593 + if want_pie ; then
594 + unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
595 + [[ -n ${SPECS_VER} ]] && \
596 + unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
597 + fi
598 +
599 + use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
600 +
601 + popd > /dev/null
602 +
603 +}
604 +src_prepare() {
605 + export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}"
606 + cd "${S}"
607 +
608 + if ! use vanilla ; then
609 + if [[ -n ${PATCH_VER} ]] ; then
610 + guess_patch_type_in_dir "${WORKDIR}"/patch
611 + EPATCH_MULTI_MSG="Applying Gentoo patches ..." \
612 + epatch "${WORKDIR}"/patch
613 + BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}"
614 + fi
615 + if [[ -n ${UCLIBC_VER} ]] ; then
616 + guess_patch_type_in_dir "${WORKDIR}"/uclibc
617 + EPATCH_MULTI_MSG="Applying uClibc patches ..." \
618 + epatch "${WORKDIR}"/uclibc
619 + fi
620 + fi
621 + do_gcc_HTB_patches
622 + do_gcc_PIE_patches
623 + epatch_user
624 +
625 + use hardened && make_gcc_hard
626 +
627 + # install the libstdc++ python into the right location
628 + # http://gcc.gnu.org/PR51368
629 + if tc_version_is_at_least 4.5 ; then
630 + sed -i \
631 + '/^pythondir =/s:=.*:= $(datadir)/python:' \
632 + "${S}"/libstdc++-v3/python/Makefile.in || die
633 + fi
634 +
635 + # No idea when this first started being fixed, but let's go with 4.3.x for now
636 + if ! tc_version_is_at_least 4.3 ; then
637 + fix_files=""
638 + for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
639 + [[ -e ${x} ]] && fix_files="${fix_files} ${x}"
640 + done
641 + ht_fix_file ${fix_files} */configure *.sh */Makefile.in
642 + fi
643 +
644 + setup_multilib_osdirnames
645 +
646 + gcc_version_patch
647 + if tc_version_is_at_least 4.1 ; then
648 + if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
649 + # BASE-VER must be a three-digit version number
650 + # followed by an optional -pre string
651 + # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
652 + # If BASE-VER differs from ${PV/_/-} then libraries get installed in
653 + # the wrong directory.
654 + echo ${PV/_/-} > "${S}"/gcc/BASE-VER
655 + fi
656 + fi
657 +
658 + # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
659 + if tc_version_is_at_least 4.3 && use gcj ; then
660 + if tc_version_is_at_least "4.5" ; then
661 + einfo "Copying ecj-4.5.jar"
662 + cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
663 + elif tc_version_is_at_least "4.3" ; then
664 + einfo "Copying ecj-4.3.jar"
665 + cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
666 + fi
667 + fi
668 +
669 + # disable --as-needed from being compiled into gcc specs
670 + # natively when using a gcc version < 3.4.4
671 + # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992
672 + if ! tc_version_is_at_least 3.4.4 ; then
673 + sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
674 + fi
675 +
676 + # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
677 + # in line with gcc-4.
678 + if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then
679 + do_gcc_rename_java_bins
680 + fi
681 +
682 + # Prevent libffi from being installed
683 + sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in
684 + sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in
685 +
686 + # Fixup libtool to correctly generate .la files with portage
687 + cd "${S}"
688 + elibtoolize --portage --shallow --no-uclibc
689 +
690 + gnuconfig_update
691 +
692 + # update configure files
693 + local f
694 + einfo "Fixing misc issues in configure files"
695 + tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
696 + for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
697 + ebegin " Updating ${f/${S}\/} [LANG]"
698 + patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
699 + || eerror "Please file a bug about this"
700 + eend $?
701 + done
702 + sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828
703 +
704 + if [[ -x contrib/gcc_update ]] ; then
705 + einfo "Touching generated files"
706 + ./contrib/gcc_update --touch | \
707 + while read f ; do
708 + einfo " ${f%%...}"
709 + done
710 + fi
711 +
712 + disable_multilib_libjava || die "failed to disable multilib java"
713 +}
714 +src_configure() {
715 +
716 + multilib_env ${CTARGET}
717 + gcc_do_filter_flags
718 + einfo "CFLAGS=\"${CFLAGS}\""
719 + einfo "CXXFLAGS=\"${CXXFLAGS}\""
720 +
721 + # Force internal zip based jar script to avoid random
722 + # issues with 3rd party jar implementations. #384291
723 + export JAR=no
724 +
725 + # For hardened gcc 4.3 piepatchset to build the hardened specs
726 + # file (build.specs) to use when building gcc.
727 + if ! tc_version_is_at_least 4.4 && want_minispecs ; then
728 + setup_minispecs_gcc_build_specs
729 + fi
730 + # Build in a separate build tree
731 + mkdir -p "${WORKDIR}"/build
732 + pushd "${WORKDIR}"/build > /dev/null
733 +
734 + local confgcc
735 +
736 + # Sanity check for USE=nocxx -> USE=cxx migration
737 + if in_iuse cxx && in_iuse nocxx ; then
738 + if (use cxx && use nocxx) || (use !cxx && use !nocxx) ; then
739 + eerror "We are migrating USE=nocxx to USE=cxx, but your USE settings do not make"
740 + eerror "sense. Please make sure these two flags line up logically in your setup."
741 + die "USE='cxx nocxx' and USE='-cxx -nocxx' make no sense"
742 + fi
743 + fi
744 +
745 + # Set configuration based on path variables
746 + confgcc+=" \
747 + --prefix=${PREFIX} \
748 + --bindir=${BINPATH} \
749 + --includedir=${INCLUDEPATH} \
750 + --datadir=${DATAPATH} \
751 + --mandir=${DATAPATH}/man \
752 + --infodir=${DATAPATH}/info \
753 + --with-gxx-include-dir=${STDCXX_INCDIR}"
754 + # On Darwin we need libdir to be set in order to get correct install names
755 + # for things like libobjc-gnu, libgcj and libfortran. If we enable it on
756 + # non-Darwin we screw up the behaviour this eclass relies on. We in
757 + # particular need this over --libdir for bug #255315.
758 + [[ ${CTARGET} == *-darwin* ]] && \
759 + confgcc+=" --enable-version-specific-runtime-libs"
760 +
761 + # All our cross-compile logic goes here ! woo !
762 + confgcc+=" --host=${CHOST}"
763 + if is_crosscompile || tc-is-cross-compiler ; then
764 + # Straight from the GCC install doc:
765 + # "GCC has code to correctly determine the correct value for target
766 + # for nearly all native systems. Therefore, we highly recommend you
767 + # not provide a configure target when configuring a native compiler."
768 + confgcc+=" --target=${CTARGET}"
769 + fi
770 + [[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}"
771 +
772 + # ppc altivec support
773 + confgcc+=" $(use_enable altivec)"
774 +
775 + # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
776 + # significantly increase compile time by several hours. This will allow
777 + # users to control this feature in the event they need the support.
778 + tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
779 +
780 + # Graphite support was added in 4.4, which depends on external libraries
781 + # for optimizations. Current versions use cloog-ppl (cloog fork with Parma
782 + # PPL backend). Sometime in the future we will use upstream cloog with the
783 + # ISL backend (note: PPL will still be a requirement). cloog-ppl's include
784 + # path was modified to prevent collisions between the two packages (library
785 + # names are different).
786 + #
787 + # We disable the PPL version check so we can use >=ppl-0.11.
788 + if tc_version_is_at_least "4.4"; then
789 + confgcc+=" $(use_with graphite ppl)"
790 + confgcc+=" $(use_with graphite cloog)"
791 + if use graphite; then
792 + confgcc+=" --disable-ppl-version-check"
793 + confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
794 + fi
795 + fi
796 +
797 + # LTO support was added in 4.5, which depends upon elfutils. This allows
798 + # users to enable that option, and pull in the additional library. In 4.6,
799 + # the dependency is no longer required.
800 if tc_version_is_at_least "4.6" ; then
801 confgcc+=" --enable-lto"
802 elif tc_version_is_at_least "4.5" ; then
803 @@ -1226,44 +1515,19 @@ gcc_do_configure() {
804 # and now to do the actual configuration
805 addwrite /dev/zero
806 echo "${S}"/configure "$@"
807 - "${S}"/configure "$@" || die "failed to run configure"
808 -
809 + "${S}"/configure "$@" || die "failed to run configure."
810 # return to whatever directory we were in before
811 popd > /dev/null
812 -}
813
814 -has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
815 -toolchain_death_notice() {
816 - pushd "${WORKDIR}"/build >/dev/null
817 - tar jcf gcc-build-logs.tar.bz2 $(find -name config.log)
818 - eerror
819 - eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report"
820 - eerror
821 - popd >/dev/null
822 + touch "${S}"/gcc/c-gperf.h
823 }
824
825 -# This function accepts one optional argument, the make target to be used.
826 -# If ommitted, gcc_do_make will try to guess whether it should use all,
827 -# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An
828 -# example of how to use this function:
829 -#
830 -# gcc_do_make all-target-libstdc++-v3
831 -#
832 -# In addition to the target to be used, the following variables alter the
833 -# behavior of this function:
834 -#
835 -# LDFLAGS
836 -# Flags to pass to ld
837 -#
838 -# STAGE1_CFLAGS
839 -# CFLAGS to use during stage1 of a gcc bootstrap
840 -#
841 -# BOOT_CFLAGS
842 -# CFLAGS to use during stages 2+3 of a gcc bootstrap.
843 -#
844 -# Travis Tilley <lv@g.o> (04 Sep 2004)
845 -#
846 -gcc_do_make() {
847 +src_compile() {
848 + # Do not make manpages if we do not have perl ...
849 + [[ ! -x /usr/bin/perl ]] \
850 + && find "${WORKDIR}"/build -name '*.[17]' | xargs touch
851 +
852 + einfo "Compiling ${PN} ..."
853 # Fix for libtool-portage.patch
854 local OLDS=${S}
855 S=${WORKDIR}/build
856 @@ -1274,188 +1538,71 @@ gcc_do_make() {
857 if is_crosscompile || tc-is-cross-compiler ; then
858 # 3 stage bootstrapping doesnt quite work when you cant run the
859 # resulting binaries natively ^^;
860 - GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
861 - else
862 - GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
863 - fi
864 -
865 - # the gcc docs state that parallel make isnt supported for the
866 - # profiledbootstrap target, as collisions in profile collecting may occur.
867 - # boundschecking also seems to introduce parallel build issues.
868 - if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
869 - use_if_iuse boundschecking
870 - then
871 - export MAKEOPTS="${MAKEOPTS} -j1"
872 - fi
873 -
874 - if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
875 - STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
876 - elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
877 - # See bug #79852
878 - STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
879 - fi
880 -
881 - if is_crosscompile; then
882 - # In 3.4, BOOT_CFLAGS is never used on a crosscompile...
883 - # but I'll leave this in anyways as someone might have had
884 - # some reason for putting it in here... --eradicator
885 - BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
886 - else
887 - # we only want to use the system's CFLAGS if not building a
888 - # cross-compiler.
889 - BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"}
890 - fi
891 -
892 - pushd "${WORKDIR}"/build
893 -
894 - emake \
895 - LDFLAGS="${LDFLAGS}" \
896 - STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
897 - LIBPATH="${LIBPATH}" \
898 - BOOT_CFLAGS="${BOOT_CFLAGS}" \
899 - ${GCC_MAKE_TARGET} \
900 - || die "emake failed with ${GCC_MAKE_TARGET}"
901 -
902 - if ! is_crosscompile && use cxx && use doc ; then
903 - if type -p doxygen > /dev/null ; then
904 - if tc_version_is_at_least 4.3 ; then
905 - cd "${CTARGET}"/libstdc++-v3/doc
906 - emake doc-man-doxygen || ewarn "failed to make docs"
907 - elif tc_version_is_at_least 3.0 ; then
908 - cd "${CTARGET}"/libstdc++-v3
909 - emake doxygen-man || ewarn "failed to make docs"
910 - fi
911 - else
912 - ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
913 - fi
914 - fi
915 -
916 - popd
917 -}
918 -
919 -# This is mostly a stub function to be overwritten in an ebuild
920 -gcc_do_filter_flags() {
921 - strip-flags
922 -
923 - # In general gcc does not like optimization, and add -O2 where
924 - # it is safe. This is especially true for gcc 3.3 + 3.4
925 - replace-flags -O? -O2
926 -
927 - # ... sure, why not?
928 - strip-unsupported-flags
929 -
930 - # dont want to funk ourselves
931 - filter-flags '-mabi*' -m31 -m32 -m64
932 -
933 - case ${GCC_BRANCH_VER} in
934 - 3.2|3.3)
935 - replace-cpu-flags k8 athlon64 opteron i686 x86-64
936 - replace-cpu-flags pentium-m pentium3m pentium3
937 - case $(tc-arch) in
938 - amd64|x86) filter-flags '-mtune=*' ;;
939 - # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used,
940 - # the compiler wrongly assumes a 32bit target
941 - ppc64) filter-flags "-mcpu=*";;
942 - esac
943 - case $(tc-arch) in
944 - amd64) replace-cpu-flags core2 nocona;;
945 - x86) replace-cpu-flags core2 prescott;;
946 - esac
947 -
948 - replace-cpu-flags G3 750
949 - replace-cpu-flags G4 7400
950 - replace-cpu-flags G5 7400
951 -
952 - # XXX: should add a sed or something to query all supported flags
953 - # from the gcc source and trim everything else ...
954 - filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
955 - filter-flags -f{no-,}stack-protector{,-all}
956 - filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
957 - ;;
958 - 3.4|4.*)
959 - case $(tc-arch) in
960 - x86|amd64) filter-flags '-mcpu=*';;
961 - *-macos)
962 - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127
963 - [[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER} == 4.1 ]] && \
964 - filter-flags '-mcpu=*' '-march=*' '-mtune=*'
965 - ;;
966 - esac
967 - ;;
968 - esac
969 -
970 - # Compile problems with these (bug #6641 among others)...
971 - #filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr"
972 -
973 - # CFLAGS logic (verified with 3.4.3):
974 - # CFLAGS:
975 - # This conflicts when creating a crosscompiler, so set to a sane
976 - # default in this case:
977 - # used in ./configure and elsewhere for the native compiler
978 - # used by gcc when creating libiberty.a
979 - # used by xgcc when creating libstdc++ (and probably others)!
980 - # this behavior should be removed...
981 - #
982 - # CXXFLAGS:
983 - # used by xgcc when creating libstdc++
984 - #
985 - # STAGE1_CFLAGS (not used in creating a crosscompile gcc):
986 - # used by ${CHOST}-gcc for building stage1 compiler
987 - #
988 - # BOOT_CFLAGS (not used in creating a crosscompile gcc):
989 - # used by xgcc for building stage2/3 compiler
990 -
991 - if is_crosscompile ; then
992 - # Set this to something sane for both native and target
993 - CFLAGS="-O2 -pipe"
994 -
995 - local VAR="CFLAGS_"${CTARGET//-/_}
996 - CXXFLAGS=${!VAR}
997 - fi
998 -
999 - export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
1000 -}
1001 -
1002 -toolchain_src_compile() {
1003 - multilib_env ${CTARGET}
1004 - gcc_do_filter_flags
1005 - einfo "CFLAGS=\"${CFLAGS}\""
1006 - einfo "CXXFLAGS=\"${CXXFLAGS}\""
1007 + GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all}
1008 + else
1009 + GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean}
1010 + fi
1011
1012 - # Force internal zip based jar script to avoid random
1013 - # issues with 3rd party jar implementations. #384291
1014 - export JAR=no
1015 + # the gcc docs state that parallel make isnt supported for the
1016 + # profiledbootstrap target, as collisions in profile collecting may occur.
1017 + # boundschecking also seems to introduce parallel build issues.
1018 + if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] ||
1019 + use_if_iuse boundschecking
1020 + then
1021 + export MAKEOPTS="${MAKEOPTS} -j1"
1022 + fi
1023
1024 - # For hardened gcc 4.3 piepatchset to build the hardened specs
1025 - # file (build.specs) to use when building gcc.
1026 - if ! tc_version_is_at_least 4.4 && want_minispecs ; then
1027 - setup_minispecs_gcc_build_specs
1028 + if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
1029 + STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
1030 + elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
1031 + # See bug #79852
1032 + STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
1033 fi
1034 - # Build in a separate build tree
1035 - mkdir -p "${WORKDIR}"/build
1036 - pushd "${WORKDIR}"/build > /dev/null
1037
1038 - einfo "Configuring ${PN} ..."
1039 - gcc_do_configure
1040 + if is_crosscompile; then
1041 + # In 3.4, BOOT_CFLAGS is never used on a crosscompile...
1042 + # but I'll leave this in anyways as someone might have had
1043 + # some reason for putting it in here... --eradicator
1044 + BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"}
1045 + else
1046 + # we only want to use the system's CFLAGS if not building a
1047 + # cross-compiler.
1048 + BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"}
1049 + fi
1050
1051 - touch "${S}"/gcc/c-gperf.h
1052 + pushd "${WORKDIR}"/build
1053
1054 - # Do not make manpages if we do not have perl ...
1055 - [[ ! -x /usr/bin/perl ]] \
1056 - && find "${WORKDIR}"/build -name '*.[17]' | xargs touch
1057 + emake \
1058 + LDFLAGS="${LDFLAGS}" \
1059 + STAGE1_CFLAGS="${STAGE1_CFLAGS}" \
1060 + LIBPATH="${LIBPATH}" \
1061 + BOOT_CFLAGS="${BOOT_CFLAGS}" \
1062 + ${GCC_MAKE_TARGET} \
1063 + || die "emake failed with ${GCC_MAKE_TARGET}"
1064
1065 - einfo "Compiling ${PN} ..."
1066 - gcc_do_make ${GCC_MAKE_TARGET}
1067 + if ! is_crosscompile && use cxx && use doc ; then
1068 + if type -p doxygen > /dev/null ; then
1069 + if tc_version_is_at_least 4.3 ; then
1070 + cd "${CTARGET}"/libstdc++-v3/doc
1071 + emake doc-man-doxygen || ewarn "failed to make docs"
1072 + elif tc_version_is_at_least 3.0 ; then
1073 + cd "${CTARGET}"/libstdc++-v3
1074 + emake doxygen-man || ewarn "failed to make docs"
1075 + fi
1076 + else
1077 + ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
1078 + fi
1079 + fi
1080
1081 popd > /dev/null
1082 }
1083
1084 -toolchain_src_test() {
1085 +src_test() {
1086 cd "${WORKDIR}"/build
1087 emake -k check || ewarn "check failed and that sucks :("
1088 }
1089
1090 -toolchain_src_install() {
1091 +src_install() {
1092 local x=
1093
1094 cd "${WORKDIR}"/build
1095 @@ -1604,210 +1751,10 @@ toolchain_src_install() {
1096 fi
1097 }
1098
1099 -gcc_slot_java() {
1100 - local x
1101 -
1102 - # Move Java headers to compiler-specific dir
1103 - for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do
1104 - [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/
1105 - done
1106 - for x in gcj gnu java javax org ; do
1107 - if [[ -d ${D}${PREFIX}/include/${x} ]] ; then
1108 - dodir /${LIBPATH}/include/${x}
1109 - mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/
1110 - rm -rf "${D}"${PREFIX}/include/${x}
1111 - fi
1112 - done
1113 -
1114 - if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then
1115 - dodir /${LIBPATH}/security
1116 - mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security
1117 - rm -rf "${D}"${PREFIX}/lib*/security
1118 - fi
1119 -
1120 - # Move random gcj files to compiler-specific directories
1121 - for x in libgcj.spec logging.properties ; do
1122 - x="${D}${PREFIX}/lib/${x}"
1123 - [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/
1124 - done
1125 -
1126 - # SLOT up libgcj.pc if it's available (and let gcc-config worry about links)
1127 - for x in "${D}"${PREFIX}/lib*/pkgconfig/libgcj*.pc ; do
1128 - [[ -f ${x} ]] || continue
1129 - sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${x}"
1130 - mv "${x}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die
1131 - done
1132 -
1133 - # Rename jar because it could clash with Kaffe's jar if this gcc is
1134 - # primary compiler (aka don't have the -<version> extension)
1135 - cd "${D}"${BINPATH}
1136 - [[ -f jar ]] && mv -f jar gcj-jar
1137 -}
1138 -
1139 -# Move around the libs to the right location. For some reason,
1140 -# when installing gcc, it dumps internal libraries into /usr/lib
1141 -# instead of the private gcc lib path
1142 -gcc_movelibs() {
1143 - # older versions of gcc did not support --print-multi-os-directory
1144 - tc_version_is_at_least 3.0 || return 0
1145 -
1146 - local multiarg removedirs=""
1147 - for multiarg in $($(XGCC) -print-multi-lib) ; do
1148 - multiarg=${multiarg#*;}
1149 - multiarg=${multiarg//@/ -}
1150 -
1151 - local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory)
1152 - local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory)
1153 - local TODIR=${D}${LIBPATH}/${MULTIDIR}
1154 - local FROMDIR=
1155 -
1156 - [[ -d ${TODIR} ]] || mkdir -p ${TODIR}
1157 -
1158 - for FROMDIR in \
1159 - ${LIBPATH}/${OS_MULTIDIR} \
1160 - ${LIBPATH}/../${MULTIDIR} \
1161 - ${PREFIX}/lib/${OS_MULTIDIR} \
1162 - ${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR}
1163 - do
1164 - removedirs="${removedirs} ${FROMDIR}"
1165 - FROMDIR=${D}${FROMDIR}
1166 - if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then
1167 - local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null)
1168 - if [[ -n ${files} ]] ; then
1169 - mv ${files} "${TODIR}"
1170 - fi
1171 - fi
1172 - done
1173 - fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}"
1174 - done
1175 -
1176 - # We remove directories separately to avoid this case:
1177 - # mv SRC/lib/../lib/*.o DEST
1178 - # rmdir SRC/lib/../lib/
1179 - # mv SRC/lib/../lib32/*.o DEST # Bork
1180 - for FROMDIR in ${removedirs} ; do
1181 - rmdir "${D}"${FROMDIR} >& /dev/null
1182 - done
1183 - find "${D}" -type d | xargs rmdir >& /dev/null
1184 -}
1185 -
1186 #----<< src_* >>----
1187
1188 #---->> unorganized crap in need of refactoring follows
1189
1190 -# gcc_quick_unpack will unpack the gcc tarball and patches in a way that is
1191 -# consistant with the behavior of get_gcc_src_uri. The only patch it applies
1192 -# itself is the branch update if present.
1193 -#
1194 -# Travis Tilley <lv@g.o> (03 Sep 2004)
1195 -#
1196 -gcc_quick_unpack() {
1197 - pushd "${WORKDIR}" > /dev/null
1198 - export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}}
1199 - export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}}
1200 - export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}}
1201 - export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}}
1202 - export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}}
1203 -
1204 - if [[ -n ${GCC_A_FAKEIT} ]] ; then
1205 - unpack ${GCC_A_FAKEIT}
1206 - elif [[ -n ${PRERELEASE} ]] ; then
1207 - unpack gcc-${PRERELEASE}.tar.bz2
1208 - elif [[ -n ${SNAPSHOT} ]] ; then
1209 - unpack gcc-${SNAPSHOT}.tar.bz2
1210 - elif [[ ${PV} != *9999* ]] ; then
1211 - unpack gcc-${GCC_RELEASE_VER}.tar.bz2
1212 - # We want branch updates to be against a release tarball
1213 - if [[ -n ${BRANCH_UPDATE} ]] ; then
1214 - pushd "${S}" > /dev/null
1215 - epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2
1216 - popd > /dev/null
1217 - fi
1218 - fi
1219 -
1220 - if [[ -n ${D_VER} ]] && use d ; then
1221 - pushd "${S}"/gcc > /dev/null
1222 - unpack gdc-${D_VER}-src.tar.bz2
1223 - cd ..
1224 - ebegin "Adding support for the D language"
1225 - ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log
1226 - if ! eend $? ; then
1227 - eerror "The D gcc package failed to apply"
1228 - eerror "Please include this log file when posting a bug report:"
1229 - eerror " ${T}/dgcc.log"
1230 - die "failed to include the D language"
1231 - fi
1232 - popd > /dev/null
1233 - fi
1234 -
1235 - [[ -n ${PATCH_VER} ]] && \
1236 - unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2
1237 -
1238 - [[ -n ${UCLIBC_VER} ]] && \
1239 - unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
1240 -
1241 - if want_pie ; then
1242 - if [[ -n ${PIE_CORE} ]] ; then
1243 - unpack ${PIE_CORE}
1244 - else
1245 - unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
1246 - fi
1247 - [[ -n ${SPECS_VER} ]] && \
1248 - unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
1249 - fi
1250 -
1251 - use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2"
1252 -
1253 - popd > /dev/null
1254 -}
1255 -
1256 -do_gcc_HTB_patches() {
1257 - use_if_iuse boundschecking || return 0
1258 -
1259 - # modify the bounds checking patch with a regression patch
1260 - epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch"
1261 - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}"
1262 -}
1263 -
1264 -# do various updates to PIE logic
1265 -do_gcc_PIE_patches() {
1266 - want_pie || return 0
1267 -
1268 - use vanilla && return 0
1269 -
1270 - if tc_version_is_at_least 4.3.2; then
1271 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/
1272 - EPATCH_MULTI_MSG="Applying pie patches ..." \
1273 - epatch "${WORKDIR}"/piepatch/
1274 - else
1275 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
1276 -
1277 - # corrects startfile/endfile selection and shared/static/pie flag usage
1278 - EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
1279 - epatch "${WORKDIR}"/piepatch/upstream
1280 - # adds non-default pie support (rs6000)
1281 - EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
1282 - epatch "${WORKDIR}"/piepatch/nondef
1283 - # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
1284 - EPATCH_MULTI_MSG="Applying default pie patches ..." \
1285 - epatch "${WORKDIR}"/piepatch/def
1286 - fi
1287 -
1288 - # we want to be able to control the pie patch logic via something other
1289 - # than ALL_CFLAGS...
1290 - sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
1291 - -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
1292 - -i "${S}"/gcc/Makefile.in
1293 - # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
1294 - if tc_version_is_at_least 4.7.0 ; then
1295 - sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
1296 - -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
1297 - -i "${S}"/gcc/Makefile.in
1298 - fi
1299 -
1300 - BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
1301 -}
1302 -
1303 should_we_gcc_config() {
1304 # we always want to run gcc-config if we're bootstrapping, otherwise
1305 # we might get stuck with the c-only stage1 compiler
1306 @@ -2047,9 +1994,3 @@ is_treelang() {
1307 #use treelang
1308 return 0
1309 }
1310 -
1311 -# should kill these off once all the ebuilds are migrated
1312 -gcc_pkg_setup() { toolchain_pkg_setup ; }
1313 -gcc_src_unpack() { toolchain_src_unpack ; }
1314 -gcc_src_compile() { toolchain_src_compile ; }
1315 -gcc_src_test() { toolchain_src_test ; }
1316
1317 diff --git a/eclass/toolchain2.eclass b/eclass/toolchain2.eclass
1318 index b5c0aa0..41c5ffb 100644
1319 --- a/eclass/toolchain2.eclass
1320 +++ b/eclass/toolchain2.eclass
1321 @@ -1,8 +1,6 @@
1322 # Copyright 1999-2012 Gentoo Foundation
1323 # Distributed under the terms of the GNU General Public License v2
1324 # $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.532 2012/03/22 06:07:08 dirtyepic Exp $
1325 -#
1326 -# Maintainer: Toolchain Ninjas <toolchain@g.o>
1327
1328 #---->> eclass stuff <<----
1329 HOMEPAGE="http://gcc.gnu.org/"
1330 @@ -11,7 +9,7 @@ RESTRICT="strip" # cross-compilers need controlled stripping
1331
1332 inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils
1333
1334 -if [[ ${PV} == *_pre9999* ]] ; then
1335 +f [[ ${PV} == *_pre9999* ]] ; then
1336 EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git"
1337 # naming style:
1338 # gcc-4.7.1_pre9999 -> gcc-4_7-branch
1339 @@ -23,13 +21,11 @@ if [[ ${PV} == *_pre9999* ]] ; then
1340 inherit git-2
1341 fi
1342
1343 -EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
1344 +EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm
1345 DESCRIPTION="The GNU Compiler Collection"
1346 -
1347 FEATURES=${FEATURES/multilib-strict/}
1348 #----<< eclass stuff >>----
1349
1350 -
1351 #---->> globals <<----
1352 export CTARGET=${CTARGET:-${CHOST}}
1353 if [[ ${CTARGET} = ${CHOST} ]] ; then
1354 @@ -73,11 +69,8 @@ export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}}
1355
1356 PREFIX=${TOOLCHAIN_PREFIX:-/usr}
1357
1358 -if tc_version_is_at_least 3.4.0 ; then
1359 - LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
1360 -else
1361 - LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}}
1362 -fi
1363 +LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}}
1364 +
1365 INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include}
1366 if is_crosscompile ; then
1367 BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}}
1368 @@ -91,9 +84,9 @@ STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VE
1369
1370 #----<< globals >>----
1371
1372 -
1373 #---->> SLOT+IUSE logic <<----
1374 -IUSE="build multislot nls nptl test vanilla"
1375 +IUSE="build multislot nls nptl test vanilla bootstrap doc gcj gtk hardened multilib objc objc-gc mudflap"
1376 +IUSE+=" objc++ openmp fixed-point graphite ito go"
1377
1378 if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
1379 IUSE+=" altivec cxx fortran nocxx"
1380 @@ -101,18 +94,6 @@ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then
1381 [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking"
1382 [[ -n ${D_VER} ]] && IUSE+=" d"
1383 [[ -n ${SPECS_VER} ]] && IUSE+=" nossp"
1384 -
1385 - if tc_version_is_at_least 3 ; then
1386 - IUSE+=" bootstrap doc gcj gtk hardened multilib objc"
1387 -
1388 - tc_version_is_at_least "4.0" && IUSE+=" objc-gc mudflap"
1389 - tc_version_is_at_least "4.1" && IUSE+=" libssp objc++"
1390 - tc_version_is_at_least "4.2" && IUSE+=" openmp"
1391 - tc_version_is_at_least "4.3" && IUSE+=" fixed-point"
1392 - tc_version_is_at_least "4.4" && IUSE+=" graphite"
1393 - [[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto"
1394 - tc_version_is_at_least "4.6" && IUSE+=" go"
1395 - fi
1396 fi
1397
1398 # Support upgrade paths here or people get pissed
1399 @@ -131,21 +112,12 @@ RDEPEND="sys-libs/zlib
1400 !build? (
1401 nls? ( sys-devel/gettext )
1402 )"
1403 -if tc_version_is_at_least 3 ; then
1404 - RDEPEND+=" virtual/libiconv"
1405 -fi
1406 -if tc_version_is_at_least 4 ; then
1407 - GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2"
1408 - if tc_version_is_at_least 4.3 ; then
1409 - RDEPEND+=" ${GMP_MPFR_DEPS}"
1410 - elif in_iuse fortran ; then
1411 - RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
1412 - fi
1413 - if tc_version_is_at_least 4.5 ; then
1414 - RDEPEND+=" >=dev-libs/mpc-0.8.1"
1415 - fi
1416 - in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
1417 -fi
1418 +RDEPEND+=" virtual/libiconv"
1419 +RDEPEND+=" ${GMP_MPFR_DEPS}"
1420 +in_iuse fortran && RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )"
1421 +RDEPEND+=" >=dev-libs/mpc-0.8.1"
1422 +in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )"
1423 +
1424 if in_iuse graphite ; then
1425 RDEPEND+="
1426 graphite? (
1427 @@ -330,85 +302,6 @@ get_make_var() {
1428 }
1429 XGCC() { get_make_var GCC_FOR_TARGET ; }
1430
1431 -# The gentoo piessp patches allow for 3 configurations:
1432 -# 1) PIE+SSP by default
1433 -# 2) PIE by default
1434 -# 3) SSP by default
1435 -hardened_gcc_works() {
1436 - if [[ $1 == "pie" ]] ; then
1437 - # $gcc_cv_ld_pie is unreliable as it simply take the output of
1438 - # `ld --help | grep -- -pie`, that reports the option in all cases, also if
1439 - # the loader doesn't actually load the resulting executables.
1440 - # To avoid breakage, blacklist FreeBSD here at least
1441 - [[ ${CTARGET} == *-freebsd* ]] && return 1
1442 -
1443 - want_pie || return 1
1444 - use_if_iuse nopie && return 1
1445 - hardened_gcc_is_stable pie
1446 - return $?
1447 - elif [[ $1 == "ssp" ]] ; then
1448 - [[ -n ${SPECS_VER} ]] || return 1
1449 - use_if_iuse nossp && return 1
1450 - hardened_gcc_is_stable ssp
1451 - return $?
1452 - else
1453 - # laziness ;)
1454 - hardened_gcc_works pie || return 1
1455 - hardened_gcc_works ssp || return 1
1456 - return 0
1457 - fi
1458 -}
1459 -
1460 -hardened_gcc_is_stable() {
1461 - local tocheck
1462 - if [[ $1 == "pie" ]] ; then
1463 - if [[ ${CTARGET} == *-uclibc* ]] ; then
1464 - tocheck=${PIE_UCLIBC_STABLE}
1465 - else
1466 - tocheck=${PIE_GLIBC_STABLE}
1467 - fi
1468 - elif [[ $1 == "ssp" ]] ; then
1469 - if [[ ${CTARGET} == *-uclibc* ]] ; then
1470 - tocheck=${SSP_UCLIBC_STABLE}
1471 - else
1472 - tocheck=${SSP_STABLE}
1473 - fi
1474 - else
1475 - die "hardened_gcc_stable needs to be called with pie or ssp"
1476 - fi
1477 -
1478 - has $(tc-arch) ${tocheck} && return 0
1479 - return 1
1480 -}
1481 -
1482 -want_pie() {
1483 - ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1
1484 - [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0
1485 - tc_version_is_at_least 4.3.2 && return 1
1486 - [[ -z ${PIE_VER} ]] && return 1
1487 - use !nopie && return 0
1488 - return 1
1489 -}
1490 -
1491 -want_minispecs() {
1492 - if tc_version_is_at_least 4.3.2 && use hardened ; then
1493 - if ! want_pie ; then
1494 - ewarn "PIE_VER or SPECS_VER is not defiend in the GCC ebuild."
1495 - elif use vanilla ; then
1496 - ewarn "You will not get hardened features if you have the vanilla USE-flag."
1497 - elif use nopie && use nossp ; then
1498 - ewarn "You will not get hardened features if you have the nopie and nossp USE-flag."
1499 - elif ! hardened_gcc_works ; then
1500 - ewarn "Your $(tc-arch) arch is not supported."
1501 - else
1502 - return 0
1503 - fi
1504 - ewarn "Hope you know what you are doing. Hardened will not work."
1505 - return 0
1506 - fi
1507 - return 1
1508 -}
1509 -
1510 # This is to make sure we don't accidentally try to enable support for a
1511 # language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc.
1512 #
1513 @@ -420,41 +313,9 @@ gcc-lang-supported() {
1514 has $1 ${TOOLCHAIN_ALLOWED_LANGS}
1515 }
1516
1517 -#----<< support checks >>----
1518 -
1519 +#----<< support checks >>---
1520 #---->> specs + env.d logic <<----
1521
1522 -# configure to build with the hardened GCC specs as the default
1523 -make_gcc_hard() {
1524 - # defaults to enable for all hardened toolchains
1525 - local gcc_hard_flags="-DEFAULT_RELRO -DEFAULT_BIND_NOW"
1526 -
1527 - if hardened_gcc_works ; then
1528 - einfo "Updating gcc to use automatic PIE + SSP building ..."
1529 - gcc_hard_flags+=" -DEFAULT_PIE_SSP"
1530 - elif hardened_gcc_works pie ; then
1531 - einfo "Updating gcc to use automatic PIE building ..."
1532 - ewarn "SSP has not been enabled by default"
1533 - gcc_hard_flags+=" -DEFAULT_PIE"
1534 - elif hardened_gcc_works ssp ; then
1535 - einfo "Updating gcc to use automatic SSP building ..."
1536 - ewarn "PIE has not been enabled by default"
1537 - gcc_hard_flags+=" -DEFAULT_SSP"
1538 - else
1539 - # do nothing if hardened isnt supported, but dont die either
1540 - ewarn "hardened is not supported for this arch in this gcc version"
1541 - ebeep
1542 - return 0
1543 - fi
1544 -
1545 - sed -i \
1546 - -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \
1547 - "${S}"/gcc/Makefile.in || die
1548 -
1549 - # rebrand to make bug reports easier
1550 - BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
1551 -}
1552 -
1553 create_gcc_env_entry() {
1554 dodir /etc/env.d/gcc
1555 local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}"
1556 @@ -502,49 +363,11 @@ create_gcc_env_entry() {
1557 # Set which specs file to use
1558 [[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=\"${gcc_specs_file}\"" >> ${gcc_envd_file}
1559 }
1560 -setup_minispecs_gcc_build_specs() {
1561 - # Setup the "build.specs" file for gcc 4.3 to use when building.
1562 - if hardened_gcc_works pie ; then
1563 - cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs
1564 - fi
1565 - if hardened_gcc_works ssp ; then
1566 - for s in ssp sspall ; do
1567 - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
1568 - done
1569 - fi
1570 - for s in nostrict znow ; do
1571 - cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs
1572 - done
1573 - export GCC_SPECS="${WORKDIR}"/build.specs
1574 -}
1575 -copy_minispecs_gcc_specs() {
1576 - # setup the hardenedno* specs files and the vanilla specs file.
1577 - if hardened_gcc_works ; then
1578 - create_gcc_env_entry hardenednopiessp
1579 - fi
1580 - if hardened_gcc_works pie ; then
1581 - create_gcc_env_entry hardenednopie
1582 - fi
1583 - if hardened_gcc_works ssp ; then
1584 - create_gcc_env_entry hardenednossp
1585 - fi
1586 - create_gcc_env_entry vanilla
1587 - insinto ${LIBPATH}
1588 - doins "${WORKDIR}"/specs/*.specs || die "failed to install specs"
1589 - # Build system specs file which, if it exists, must be a complete set of
1590 - # specs as it completely and unconditionally overrides the builtin specs.
1591 - # For gcc 4.3
1592 - if ! tc_version_is_at_least 4.4 ; then
1593 - $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs
1594 - cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs
1595 - doins "${WORKDIR}"/specs/specs || die "failed to install the specs file"
1596 - fi
1597 -}
1598
1599 #----<< specs + env.d logic >>----
1600
1601 #---->> pkg_* <<----
1602 -toolchain_pkg_setup() {
1603 +pkg_setup() {
1604 if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] &&
1605 [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]]
1606 then
1607 @@ -569,16 +392,15 @@ toolchain_pkg_setup() {
1608 use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"'
1609 fi
1610
1611 - want_minispecs
1612
1613 unset LANGUAGES #265283
1614 }
1615
1616 -toolchain_pkg_preinst() {
1617 +pkg_preinst() {
1618 :
1619 }
1620
1621 -toolchain_pkg_postinst() {
1622 +pkg_postinst() {
1623 do_gcc_config
1624
1625 if ! is_crosscompile ; then
1626 @@ -600,15 +422,6 @@ toolchain_pkg_postinst() {
1627 ewarn "and this problem has been corrected in >=sys-devel/gcc-config-1.3.10-r1."
1628 fi
1629
1630 - if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} == 3.4 ]] ; then
1631 - echo
1632 - ewarn "You should make sure to rebuild all your C++ packages when"
1633 - ewarn "upgrading between different versions of gcc. For example,"
1634 - ewarn "when moving to gcc-3.4 from gcc-3.3, emerge gentoolkit and run:"
1635 - ewarn " # revdep-rebuild --library libstdc++.so.5"
1636 - echo
1637 - fi
1638 -
1639 if ! is_crosscompile ; then
1640 # hack to prevent collisions between SLOT
1641 [[ ! -d ${ROOT}/$(get_libdir)/rcscripts/awk ]] \
1642 @@ -630,13 +443,13 @@ toolchain_pkg_postinst() {
1643 fi
1644 }
1645
1646 -toolchain_pkg_prerm() {
1647 +pkg_prerm() {
1648 # Don't let these files be uninstalled #87647
1649 touch -c "${ROOT}"/sbin/fix_libtool_files.sh \
1650 "${ROOT}"/$(get_libdir)/rcscripts/awk/fixlafiles.awk
1651 }
1652
1653 -toolchain_pkg_postrm() {
1654 +pkg_postrm() {
1655 # to make our lives easier (and saner), we do the fix_libtool stuff here.
1656 # rather than checking SLOT's and trying in upgrade paths, we just see if
1657 # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are
1658 @@ -713,7 +526,7 @@ do_gcc_rename_java_bins() {
1659 die "Failed to fixup file ${jfile} for rename to grmic"
1660 done
1661 }
1662 -toolchain_src_unpack() {
1663 +src_unpack() {
1664 [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc"
1665
1666 if [[ ${PV} == *9999* ]]; then
1667 @@ -742,61 +555,31 @@ toolchain_src_unpack() {
1668 do_gcc_PIE_patches
1669 epatch_user
1670
1671 - use hardened && make_gcc_hard
1672 + if use hardened ; then
1673 + BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened}
1674 + fi
1675
1676 # install the libstdc++ python into the right location
1677 # http://gcc.gnu.org/PR51368
1678 - if tc_version_is_at_least 4.5 ; then
1679 - sed -i \
1680 - '/^pythondir =/s:=.*:= $(datadir)/python:' \
1681 - "${S}"/libstdc++-v3/python/Makefile.in || die
1682 - fi
1683 + sed -i \
1684 + '/^pythondir =/s:=.*:= $(datadir)/python:' \
1685 + "${S}"/libstdc++-v3/python/Makefile.in || die
1686
1687 - # No idea when this first started being fixed, but let's go with 4.3.x for now
1688 - if ! tc_version_is_at_least 4.3 ; then
1689 - fix_files=""
1690 - for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do
1691 - [[ -e ${x} ]] && fix_files="${fix_files} ${x}"
1692 - done
1693 - ht_fix_file ${fix_files} */configure *.sh */Makefile.in
1694 - fi
1695
1696 setup_multilib_osdirnames
1697
1698 gcc_version_patch
1699 - if tc_version_is_at_least 4.1 ; then
1700 - if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
1701 - # BASE-VER must be a three-digit version number
1702 - # followed by an optional -pre string
1703 - # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
1704 - # If BASE-VER differs from ${PV/_/-} then libraries get installed in
1705 - # the wrong directory.
1706 - echo ${PV/_/-} > "${S}"/gcc/BASE-VER
1707 - fi
1708 + if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then
1709 + # BASE-VER must be a three-digit version number
1710 + # followed by an optional -pre string
1711 + # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999
1712 + # If BASE-VER differs from ${PV/_/-} then libraries get installed in
1713 + # the wrong directory.
1714 + echo ${PV/_/-} > "${S}"/gcc/BASE-VER
1715 fi
1716 -
1717 - # >= gcc-4.3 doesn't bundle ecj.jar, so copy it
1718 - if tc_version_is_at_least 4.3 && use gcj ; then
1719 - if tc_version_is_at_least "4.5" ; then
1720 - einfo "Copying ecj-4.5.jar"
1721 - cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
1722 - elif tc_version_is_at_least "4.3" ; then
1723 - einfo "Copying ecj-4.3.jar"
1724 - cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die
1725 - fi
1726 - fi
1727 -
1728 - # disable --as-needed from being compiled into gcc specs
1729 - # natively when using a gcc version < 3.4.4
1730 - # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992
1731 - if ! tc_version_is_at_least 3.4.4 ; then
1732 - sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in
1733 - fi
1734 -
1735 - # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names
1736 - # in line with gcc-4.
1737 - if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then
1738 - do_gcc_rename_java_bins
1739 + if use gcj ; then
1740 + einfo "Copying ecj-4.5.jar"
1741 + cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die
1742 fi
1743
1744 # Prevent libffi from being installed
1745 @@ -812,7 +595,7 @@ toolchain_src_unpack() {
1746 # update configure files
1747 local f
1748 einfo "Fixing misc issues in configure files"
1749 - tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
1750 + epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch
1751 for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do
1752 ebegin " Updating ${f/${S}\/} [LANG]"
1753 patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \
1754 @@ -865,12 +648,7 @@ gcc-multilib-configure() {
1755 if [[ -n ${list} ]] ; then
1756 case ${CTARGET} in
1757 x86_64*)
1758 - # drop the 4.6.2 stuff once 4.7 goes stable
1759 - if tc_version_is_at_least 4.7 ||
1760 - ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) )
1761 - then
1762 - confgcc+=" --with-multilib-list=${list:1}"
1763 - fi
1764 + confgcc+=" --with-multilib-list=${list:1}"
1765 ;;
1766 esac
1767 fi
1768 @@ -879,60 +657,45 @@ gcc-multilib-configure() {
1769 gcc-compiler-configure() {
1770 gcc-multilib-configure
1771
1772 - if tc_version_is_at_least "4.0" ; then
1773 - if in_iuse mudflap ; then
1774 - confgcc+=" $(use_enable mudflap libmudflap)"
1775 - else
1776 - confgcc+=" --disable-libmudflap"
1777 - fi
1778 -
1779 - if use_if_iuse libssp ; then
1780 - confgcc+=" --enable-libssp"
1781 - else
1782 - export gcc_cv_libc_provides_ssp=yes
1783 - confgcc+=" --disable-libssp"
1784 - fi
1785 -
1786 - # If we want hardened support with the newer piepatchset for >=gcc 4.4
1787 - if tc_version_is_at_least 4.4 && want_minispecs ; then
1788 - confgcc+=" $(use_enable hardened esp)"
1789 - fi
1790 + if in_iuse mudflap ; then
1791 + confgcc+=" $(use_enable mudflap libmudflap)"
1792 + else
1793 + confgcc+=" --disable-libmudflap"
1794 + fi
1795
1796 - if tc_version_is_at_least "4.2" ; then
1797 - if in_iuse openmp ; then
1798 - # Make sure target has pthreads support. #326757 #335883
1799 - # There shouldn't be a chicken&egg problem here as openmp won't
1800 - # build without a C library, and you can't build that w/out
1801 - # already having a compiler ...
1802 - if ! is_crosscompile || \
1803 - $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
1804 - then
1805 - confgcc+=" $(use_enable openmp libgomp)"
1806 - else
1807 - # Force disable as the configure script can be dumb #359855
1808 - confgcc+=" --disable-libgomp"
1809 - fi
1810 - else
1811 - # For gcc variants where we don't want openmp (e.g. kgcc)
1812 - confgcc+=" --disable-libgomp"
1813 - fi
1814 - fi
1815 + # If we want hardened support (espf)
1816 + confgcc+=" $(use_enable hardened espf)"
1817
1818 - # Stick the python scripts in their own slotted directory
1819 - # bug #279252
1820 - #
1821 - # --with-python-dir=DIR
1822 - # Specifies where to install the Python modules used for aot-compile. DIR
1823 - # should not include the prefix used in installation. For example, if the
1824 - # Python modules are to be installed in /usr/lib/python2.5/site-packages,
1825 - # then --with-python-dir=/lib/python2.5/site-packages should be passed.
1826 - #
1827 - # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
1828 - if tc_version_is_at_least "4.4" ; then
1829 - confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python"
1830 + if in_iuse openmp ; then
1831 + # Make sure target has pthreads support. #326757 #335883
1832 + # There shouldn't be a chicken&egg problem here as openmp won't
1833 + # build without a C library, and you can't build that w/out
1834 + # already having a compiler ...
1835 + if ! is_crosscompile || \
1836 + $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null
1837 + then
1838 + confgcc+=" $(use_enable openmp libgomp)"
1839 + else
1840 + # Force disable as the configure script can be dumb #359855
1841 + confgcc+=" --disable-libgomp"
1842 fi
1843 + else
1844 + # For gcc variants where we don't want openmp (e.g. kgcc)
1845 + confgcc+=" --disable-libgomp"
1846 fi
1847
1848 + # Stick the python scripts in their own slotted directory
1849 + # bug #279252
1850 + #
1851 + # --with-python-dir=DIR
1852 + # Specifies where to install the Python modules used for aot-compile. DIR
1853 + # should not include the prefix used in installation. For example, if the
1854 + # Python modules are to be installed in /usr/lib/python2.5/site-packages,
1855 + # then --with-python-dir=/lib/python2.5/site-packages should be passed.
1856 + #
1857 + # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python"
1858 + confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python"
1859 +
1860 # For newer versions of gcc, use the default ("release"), because no
1861 # one (even upstream apparently) tests with it disabled. #317217
1862 if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then
1863 @@ -952,13 +715,13 @@ gcc-compiler-configure() {
1864
1865 # newer gcc versions like to bootstrap themselves with C++,
1866 # so we need to manually disable it ourselves
1867 - if tc_version_is_at_least 4.7 && ! is_cxx ; then
1868 + if ! is_cxx ; then
1869 confgcc+=" --disable-build-with-cxx --disable-build-poststage1-with-cxx"
1870 fi
1871
1872 # newer gcc's come with libquadmath, but only fortran uses
1873 # it, so auto punt it when we don't care
1874 - if tc_version_is_at_least 4.6 && ! is_fortran ; then
1875 + if ! is_fortran ; then
1876 confgcc+=" --disable-libquadmath"
1877 fi
1878
1879 @@ -978,8 +741,7 @@ gcc-compiler-configure() {
1880
1881 # Enable hardvfp
1882 if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] && \
1883 - tc_version_is_at_least "4.5" ; then
1884 - confgcc+=" --with-float=hard"
1885 + confgcc+=" --with-float=hard"
1886 fi
1887 ;;
1888 # Add --with-abi flags to set default ABI
1889 @@ -1016,9 +778,7 @@ gcc-compiler-configure() {
1890 is_go && GCC_LANG+=",go"
1891 if is_objc || is_objcxx ; then
1892 GCC_LANG+=",objc"
1893 - if tc_version_is_at_least "4.0" ; then
1894 - use objc-gc && confgcc+=" --enable-objc-gc"
1895 - fi
1896 + use objc-gc && confgcc+=" --enable-objc-gc"
1897 is_objcxx && GCC_LANG+=",obj-c++"
1898 fi
1899 is_treelang && GCC_LANG+=",treelang"
1900 @@ -1037,7 +797,7 @@ gcc-compiler-configure() {
1901 confgcc+=" --enable-languages=${GCC_LANG}"
1902 }
1903
1904 -gcc_do_configure() {
1905 +src_configure() {
1906 local confgcc
1907
1908 # Sanity check for USE=nocxx -> USE=cxx migration
1909 @@ -1082,7 +842,7 @@ gcc_do_configure() {
1910 # gcc has fixed-point arithmetic support in 4.3 for mips targets that can
1911 # significantly increase compile time by several hours. This will allow
1912 # users to control this feature in the event they need the support.
1913 - tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)"
1914 + confgcc+=" $(use_enable fixed-point)"
1915
1916 # Graphite support was added in 4.4, which depends on external libraries
1917 # for optimizations. Current versions use cloog-ppl (cloog fork with Parma
1918 @@ -1092,23 +852,17 @@ gcc_do_configure() {
1919 # names are different).
1920 #
1921 # We disable the PPL version check so we can use >=ppl-0.11.
1922 - if tc_version_is_at_least "4.4"; then
1923 - confgcc+=" $(use_with graphite ppl)"
1924 - confgcc+=" $(use_with graphite cloog)"
1925 - if use graphite; then
1926 - confgcc+=" --disable-ppl-version-check"
1927 - confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
1928 - fi
1929 + confgcc+=" $(use_with graphite ppl)"
1930 + confgcc+=" $(use_with graphite cloog)"
1931 + if use graphite; then
1932 + confgcc+=" --disable-ppl-version-check"
1933 + confgcc+=" --with-cloog-include=/usr/include/cloog-ppl"
1934 fi
1935
1936 # LTO support was added in 4.5, which depends upon elfutils. This allows
1937 # users to enable that option, and pull in the additional library. In 4.6,
1938 # the dependency is no longer required.
1939 - if tc_version_is_at_least "4.6" ; then
1940 - confgcc+=" --enable-lto"
1941 - elif tc_version_is_at_least "4.5" ; then
1942 - confgcc+=" $(use_enable lto)"
1943 - fi
1944 + confgcc+=" --enable-lto"
1945
1946 [[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft"
1947 [[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard"
1948 @@ -1154,7 +908,7 @@ gcc_do_configure() {
1949 fi
1950 fi
1951
1952 - tc_version_is_at_least 4.2 && confgcc+=" --disable-bootstrap"
1953 + confgcc+=" --disable-bootstrap"
1954 else
1955 if tc-is-static-only ; then
1956 confgcc+=" --disable-shared"
1957 @@ -1198,12 +952,12 @@ gcc_do_configure() {
1958 # be small, and should simplify building of 64bit kernels in a 32bit
1959 # userland by not needing sys-devel/kgcc64. #349405
1960 case $(tc-arch) in
1961 - ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=" --enable-targets=all" ;;
1962 - sparc) tc_version_is_at_least 4.4 && confgcc+=" --enable-targets=all" ;;
1963 - amd64|x86) tc_version_is_at_least 4.3 && confgcc+=" --enable-targets=all" ;;
1964 + ppc|ppc64) confgcc+=" --enable-targets=all" ;;
1965 + sparc) confgcc+=" --enable-targets=all" ;;
1966 + amd64|x86) confgcc+=" --enable-targets=all" ;;
1967 esac
1968
1969 - tc_version_is_at_least 4.3 && set -- "$@" \
1970 + set -- "$@" \
1971 --with-bugurl=http://bugs.gentoo.org/ \
1972 --with-pkgversion="${BRANDING_GCC_PKGVERSION}"
1973 set -- ${confgcc} "$@" ${EXTRA_ECONF}
1974 @@ -1230,6 +984,8 @@ gcc_do_configure() {
1975
1976 # return to whatever directory we were in before
1977 popd > /dev/null
1978 +
1979 + touch "${S}"/gcc/c-gperf.h
1980 }
1981
1982 has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice"
1983 @@ -1290,9 +1046,6 @@ gcc_do_make() {
1984
1985 if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then
1986 STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"}
1987 - elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then
1988 - # See bug #79852
1989 - STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"}
1990 fi
1991
1992 if is_crosscompile; then
1993 @@ -1318,13 +1071,8 @@ gcc_do_make() {
1994
1995 if ! is_crosscompile && use cxx && use doc ; then
1996 if type -p doxygen > /dev/null ; then
1997 - if tc_version_is_at_least 4.3 ; then
1998 - cd "${CTARGET}"/libstdc++-v3/doc
1999 - emake doc-man-doxygen || ewarn "failed to make docs"
2000 - elif tc_version_is_at_least 3.0 ; then
2001 - cd "${CTARGET}"/libstdc++-v3
2002 - emake doxygen-man || ewarn "failed to make docs"
2003 - fi
2004 + cd "${CTARGET}"/libstdc++-v3/doc
2005 + emake doc-man-doxygen || ewarn "failed to make docs"
2006 else
2007 ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed"
2008 fi
2009 @@ -1348,31 +1096,7 @@ gcc_do_filter_flags() {
2010 filter-flags '-mabi*' -m31 -m32 -m64
2011
2012 case ${GCC_BRANCH_VER} in
2013 - 3.2|3.3)
2014 - replace-cpu-flags k8 athlon64 opteron i686 x86-64
2015 - replace-cpu-flags pentium-m pentium3m pentium3
2016 - case $(tc-arch) in
2017 - amd64|x86) filter-flags '-mtune=*' ;;
2018 - # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used,
2019 - # the compiler wrongly assumes a 32bit target
2020 - ppc64) filter-flags "-mcpu=*";;
2021 - esac
2022 - case $(tc-arch) in
2023 - amd64) replace-cpu-flags core2 nocona;;
2024 - x86) replace-cpu-flags core2 prescott;;
2025 - esac
2026 -
2027 - replace-cpu-flags G3 750
2028 - replace-cpu-flags G4 7400
2029 - replace-cpu-flags G5 7400
2030 -
2031 - # XXX: should add a sed or something to query all supported flags
2032 - # from the gcc source and trim everything else ...
2033 - filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs
2034 - filter-flags -f{no-,}stack-protector{,-all}
2035 - filter-flags -fvisibility-inlines-hidden -fvisibility=hidden
2036 - ;;
2037 - 3.4|4.*)
2038 + 4.*)
2039 case $(tc-arch) in
2040 x86|amd64) filter-flags '-mcpu=*';;
2041 *-macos)
2042 @@ -1415,9 +1139,8 @@ gcc_do_filter_flags() {
2043
2044 export GCJFLAGS=${GCJFLAGS:-${CFLAGS}}
2045 }
2046 -
2047 -toolchain_src_compile() {
2048 - multilib_env ${CTARGET}
2049 +src_prepare() {
2050 + multilib_env ${CTARGET}
2051 gcc_do_filter_flags
2052 einfo "CFLAGS=\"${CFLAGS}\""
2053 einfo "CXXFLAGS=\"${CXXFLAGS}\""
2054 @@ -1426,18 +1149,11 @@ toolchain_src_compile() {
2055 # issues with 3rd party jar implementations. #384291
2056 export JAR=no
2057
2058 - # For hardened gcc 4.3 piepatchset to build the hardened specs
2059 - # file (build.specs) to use when building gcc.
2060 - if ! tc_version_is_at_least 4.4 && want_minispecs ; then
2061 - setup_minispecs_gcc_build_specs
2062 - fi
2063 # Build in a separate build tree
2064 mkdir -p "${WORKDIR}"/build
2065 pushd "${WORKDIR}"/build > /dev/null
2066 -
2067 - einfo "Configuring ${PN} ..."
2068 - gcc_do_configure
2069 -
2070 +}
2071 +src_compile() {
2072 touch "${S}"/gcc/c-gperf.h
2073
2074 # Do not make manpages if we do not have perl ...
2075 @@ -1450,12 +1166,12 @@ toolchain_src_compile() {
2076 popd > /dev/null
2077 }
2078
2079 -toolchain_src_test() {
2080 +src_test() {
2081 cd "${WORKDIR}"/build
2082 emake -k check || ewarn "check failed and that sucks :("
2083 }
2084
2085 -toolchain_src_install() {
2086 +src_install() {
2087 local x=
2088
2089 cd "${WORKDIR}"/build
2090 @@ -1488,13 +1204,6 @@ toolchain_src_install() {
2091 dodir /etc/env.d/gcc
2092 create_gcc_env_entry
2093
2094 - # Setup the gcc_env_entry for hardened gcc 4 with minispecs
2095 - if want_minispecs ; then
2096 - copy_minispecs_gcc_specs
2097 - fi
2098 - # Make sure we dont have stuff lying around that
2099 - # can nuke multiple versions of gcc
2100 -
2101 gcc_slot_java
2102
2103 # These should be symlinks
2104 @@ -1565,12 +1274,8 @@ toolchain_src_install() {
2105 # between binary and source package borks things ....
2106 if ! is_crosscompile ; then
2107 insinto "${DATAPATH}"
2108 - if tc_version_is_at_least 4.0 ; then
2109 - newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
2110 - find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
2111 - else
2112 - doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die
2113 - fi
2114 + newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die
2115 + find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \;
2116 exeinto "${DATAPATH}"
2117 doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die
2118 doexe "${GCC_FILESDIR}"/c{89,99} || die
2119 @@ -1598,10 +1303,9 @@ toolchain_src_install() {
2120 export QA_WX_LOAD="usr/lib*/go/*/*.gox"
2121
2122 # Disable RANDMMAP so PCH works. #301299
2123 - if tc_version_is_at_least 4.3 ; then
2124 - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
2125 - pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
2126 - fi
2127 + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1"
2128 + pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus"
2129 +
2130 }
2131
2132 gcc_slot_java() {
2133 @@ -1648,8 +1352,6 @@ gcc_slot_java() {
2134 # when installing gcc, it dumps internal libraries into /usr/lib
2135 # instead of the private gcc lib path
2136 gcc_movelibs() {
2137 - # older versions of gcc did not support --print-multi-os-directory
2138 - tc_version_is_at_least 3.0 || return 0
2139
2140 local multiarg removedirs=""
2141 for multiarg in $($(XGCC) -print-multi-lib) ; do
2142 @@ -1747,11 +1449,7 @@ gcc_quick_unpack() {
2143 unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2
2144
2145 if want_pie ; then
2146 - if [[ -n ${PIE_CORE} ]] ; then
2147 - unpack ${PIE_CORE}
2148 - else
2149 - unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
2150 - fi
2151 + unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2
2152 [[ -n ${SPECS_VER} ]] && \
2153 unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2
2154 fi
2155 @@ -1775,35 +1473,9 @@ do_gcc_PIE_patches() {
2156
2157 use vanilla && return 0
2158
2159 - if tc_version_is_at_least 4.3.2; then
2160 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/
2161 - EPATCH_MULTI_MSG="Applying pie patches ..." \
2162 - epatch "${WORKDIR}"/piepatch/
2163 - else
2164 - guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream
2165 -
2166 - # corrects startfile/endfile selection and shared/static/pie flag usage
2167 - EPATCH_MULTI_MSG="Applying upstream pie patches ..." \
2168 - epatch "${WORKDIR}"/piepatch/upstream
2169 - # adds non-default pie support (rs6000)
2170 - EPATCH_MULTI_MSG="Applying non-default pie patches ..." \
2171 - epatch "${WORKDIR}"/piepatch/nondef
2172 - # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined
2173 - EPATCH_MULTI_MSG="Applying default pie patches ..." \
2174 - epatch "${WORKDIR}"/piepatch/def
2175 - fi
2176 -
2177 - # we want to be able to control the pie patch logic via something other
2178 - # than ALL_CFLAGS...
2179 - sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \
2180 - -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \
2181 - -i "${S}"/gcc/Makefile.in
2182 - # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7
2183 - if tc_version_is_at_least 4.7.0 ; then
2184 - sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \
2185 - -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \
2186 - -i "${S}"/gcc/Makefile.in
2187 - fi
2188 + guess_patch_type_in_dir "${WORKDIR}"/piepatch/
2189 + EPATCH_MULTI_MSG="Applying pie patches ..." \
2190 + epatch "${WORKDIR}"/piepatch/
2191
2192 BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}"
2193 }
2194 @@ -1882,25 +1554,9 @@ do_gcc_config() {
2195 gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs}
2196 }
2197
2198 -# This function allows us to gentoo-ize gcc's version number and bugzilla
2199 -# URL without needing to use patches.
2200 gcc_version_patch() {
2201 # gcc-4.3+ has configure flags (whoo!)
2202 tc_version_is_at_least 4.3 && return 0
2203 -
2204 - local version_string=${GCC_CONFIG_VER}
2205 - [[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}"
2206 -
2207 - einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})"
2208 -
2209 - local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' )
2210 - if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then
2211 - gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" )
2212 - else
2213 - version_string="${version_string} (${BRANDING_GCC_PKGVERSION})"
2214 - gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" )
2215 - fi
2216 - sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die
2217 }
2218
2219 # This is a historical wart. The original Gentoo/amd64 port used:
2220 @@ -2047,9 +1703,3 @@ is_treelang() {
2221 #use treelang
2222 return 0
2223 }
2224 -
2225 -# should kill these off once all the ebuilds are migrated
2226 -gcc_pkg_setup() { toolchain_pkg_setup ; }
2227 -gcc_src_unpack() { toolchain_src_unpack ; }
2228 -gcc_src_compile() { toolchain_src_compile ; }
2229 -gcc_src_test() { toolchain_src_test ; }
2230
2231 diff --git a/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild b/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
2232 index b6b5078..bf2c159 100644
2233 --- a/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
2234 +++ b/sys-devel/gcc/gcc-4.8.0_alpha20120401.ebuild
2235 @@ -1,30 +1,20 @@
2236 # Copyright 1999-2012 Gentoo Foundation
2237 # Distributed under the terms of the GNU General Public License v2
2238 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.6.2.ebuild,v 1.9 2012/03/15 20:21:44 vapier Exp $
2239 -
2240 EAPI=4
2241
2242 -PATCH_VER="1.4"
2243 -
2244 -inherit toolchain2
2245 +#PATCH_VER="1.4"
2246
2247 -DESCRIPTION="The GNU Compiler Collection"
2248 +inherit toolchain
2249
2250 -LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2"
2251 KEYWORDS=""
2252
2253 RDEPEND=""
2254 DEPEND="${RDEPEND}
2255 - elibc_glibc? ( >=sys-libs/glibc-2.8 )
2256 + elibc_glibc? ( >=sys-libs/glibc-2.12 )
2257 amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) )
2258 >=${CATEGORY}/binutils-2.18"
2259
2260 if [[ ${CATEGORY} != cross-* ]] ; then
2261 - PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )"
2262 + PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.12 )"
2263 fi
2264 -
2265 -#src_unpack() {
2266 -#
2267 -# [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch
2268 -#}
2269 -