1 |
commit: 2be925c1ee3cb673ca4bf702a232ef201d3cc9ab |
2 |
Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Apr 6 20:49:32 2012 +0000 |
4 |
Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Apr 6 20:49:32 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=2be925c1 |
7 |
|
8 |
Init commit on gcc 4.8 |
9 |
|
10 |
--- |
11 |
README | 7 +- |
12 |
eclass/toolchain2.eclass | 2055 ++++++++++++++++++++++ |
13 |
sys-devel/gcc/files/CVS/Entries | 23 + |
14 |
sys-devel/gcc/files/CVS/Repository | 1 + |
15 |
sys-devel/gcc/files/CVS/Root | 1 + |
16 |
sys-devel/gcc/files/awk/CVS/Entries | 3 + |
17 |
sys-devel/gcc/files/awk/CVS/Repository | 1 + |
18 |
sys-devel/gcc/files/awk/CVS/Root | 1 + |
19 |
sys-devel/gcc/files/awk/fixlafiles.awk | 314 ++++ |
20 |
sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la | 335 ++++ |
21 |
sys-devel/gcc/files/c89 | 20 + |
22 |
sys-devel/gcc/files/c99 | 21 + |
23 |
sys-devel/gcc/files/fix_libtool_files.sh | 72 + |
24 |
sys-devel/gcc/files/gcc-configure-LANG.patch | 64 + |
25 |
sys-devel/gcc/files/gcc-configure-texinfo.patch | 16 + |
26 |
sys-devel/gcc/files/gcc-spec-env.patch | 42 + |
27 |
sys-devel/gcc/files/mkinfodir | 233 +++ |
28 |
sys-devel/gcc/gcc-9999.ebuild | 30 + |
29 |
sys-devel/gcc/metadata.xml | 35 + |
30 |
19 files changed, 3271 insertions(+), 3 deletions(-) |
31 |
|
32 |
diff --git a/README b/README |
33 |
index 440b79d..e2a1079 100644 |
34 |
--- a/README |
35 |
+++ b/README |
36 |
@@ -1,3 +1,4 @@ |
37 |
-This overlay is for GCC 4.5 or if we do major change in the master overlay that need testing |
38 |
-before commiting it to master branch. |
39 |
-2009-08-29 Magnus Grenberg (Zorry) <zorry@×××.nu> |
40 |
+2012-04-06 Magnus Granberg <zorry@g.o> |
41 |
+ This overlay is for the work of gcc-4.8 upstream patches. |
42 |
+ |
43 |
+ |
44 |
|
45 |
diff --git a/eclass/toolchain2.eclass b/eclass/toolchain2.eclass |
46 |
new file mode 100644 |
47 |
index 0000000..b5c0aa0 |
48 |
--- /dev/null |
49 |
+++ b/eclass/toolchain2.eclass |
50 |
@@ -0,0 +1,2055 @@ |
51 |
+# Copyright 1999-2012 Gentoo Foundation |
52 |
+# Distributed under the terms of the GNU General Public License v2 |
53 |
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain.eclass,v 1.532 2012/03/22 06:07:08 dirtyepic Exp $ |
54 |
+# |
55 |
+# Maintainer: Toolchain Ninjas <toolchain@g.o> |
56 |
+ |
57 |
+#---->> eclass stuff <<---- |
58 |
+HOMEPAGE="http://gcc.gnu.org/" |
59 |
+LICENSE="GPL-2 LGPL-2.1" |
60 |
+RESTRICT="strip" # cross-compilers need controlled stripping |
61 |
+ |
62 |
+inherit eutils versionator libtool toolchain-funcs flag-o-matic gnuconfig multilib fixheadtails pax-utils |
63 |
+ |
64 |
+if [[ ${PV} == *_pre9999* ]] ; then |
65 |
+ EGIT_REPO_URI="git://gcc.gnu.org/git/gcc.git" |
66 |
+ # naming style: |
67 |
+ # gcc-4.7.1_pre9999 -> gcc-4_7-branch |
68 |
+ # Note that the micro version is required or lots of stuff will break. |
69 |
+ # To checkout master set gcc_LIVE_BRANCH="master" in the ebuild before |
70 |
+ # inheriting this eclass. |
71 |
+ EGIT_BRANCH="${PN}-${PV%.?_pre9999}-branch" |
72 |
+ EGIT_BRANCH=${EGIT_BRANCH//./_} |
73 |
+ inherit git-2 |
74 |
+fi |
75 |
+ |
76 |
+EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_test pkg_preinst src_install pkg_postinst pkg_prerm pkg_postrm |
77 |
+DESCRIPTION="The GNU Compiler Collection" |
78 |
+ |
79 |
+FEATURES=${FEATURES/multilib-strict/} |
80 |
+#----<< eclass stuff >>---- |
81 |
+ |
82 |
+ |
83 |
+#---->> globals <<---- |
84 |
+export CTARGET=${CTARGET:-${CHOST}} |
85 |
+if [[ ${CTARGET} = ${CHOST} ]] ; then |
86 |
+ if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then |
87 |
+ export CTARGET=${CATEGORY/cross-} |
88 |
+ fi |
89 |
+fi |
90 |
+is_crosscompile() { |
91 |
+ [[ ${CHOST} != ${CTARGET} ]] |
92 |
+} |
93 |
+ |
94 |
+tc_version_is_at_least() { version_is_at_least "$1" "${2:-${GCC_RELEASE_VER}}" ; } |
95 |
+ |
96 |
+GCC_PV=${TOOLCHAIN_GCC_PV:-${PV}} |
97 |
+GCC_PVR=${GCC_PV} |
98 |
+[[ ${PR} != "r0" ]] && GCC_PVR=${GCC_PVR}-${PR} |
99 |
+GCC_RELEASE_VER=$(get_version_component_range 1-3 ${GCC_PV}) |
100 |
+GCC_BRANCH_VER=$(get_version_component_range 1-2 ${GCC_PV}) |
101 |
+GCCMAJOR=$(get_version_component_range 1 ${GCC_PV}) |
102 |
+GCCMINOR=$(get_version_component_range 2 ${GCC_PV}) |
103 |
+GCCMICRO=$(get_version_component_range 3 ${GCC_PV}) |
104 |
+[[ ${BRANCH_UPDATE-notset} == "notset" ]] && BRANCH_UPDATE=$(get_version_component_range 4 ${GCC_PV}) |
105 |
+ |
106 |
+# According to gcc/c-cppbuiltin.c, GCC_CONFIG_VER MUST match this regex. |
107 |
+# ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? |
108 |
+GCC_CONFIG_VER=${GCC_CONFIG_VER:-$(replace_version_separator 3 '-' ${GCC_PV})} |
109 |
+ |
110 |
+# Pre-release support |
111 |
+if [[ ${GCC_PV} != ${GCC_PV/_pre/-} ]] ; then |
112 |
+ PRERELEASE=${GCC_PV/_pre/-} |
113 |
+fi |
114 |
+# make _alpha and _beta ebuilds automatically use a snapshot |
115 |
+if [[ ${GCC_PV} == *_alpha* ]] ; then |
116 |
+ SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_alpha} |
117 |
+elif [[ ${GCC_PV} == *_beta* ]] ; then |
118 |
+ SNAPSHOT=${GCC_BRANCH_VER}-${GCC_PV##*_beta} |
119 |
+elif [[ ${GCC_PV} == *_rc* ]] ; then |
120 |
+ SNAPSHOT=${GCC_PV%_rc*}-RC-${GCC_PV##*_rc} |
121 |
+fi |
122 |
+export GCC_FILESDIR=${GCC_FILESDIR:-${FILESDIR}} |
123 |
+ |
124 |
+PREFIX=${TOOLCHAIN_PREFIX:-/usr} |
125 |
+ |
126 |
+if tc_version_is_at_least 3.4.0 ; then |
127 |
+ LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc/${CTARGET}/${GCC_CONFIG_VER}} |
128 |
+else |
129 |
+ LIBPATH=${TOOLCHAIN_LIBPATH:-${PREFIX}/lib/gcc-lib/${CTARGET}/${GCC_CONFIG_VER}} |
130 |
+fi |
131 |
+INCLUDEPATH=${TOOLCHAIN_INCLUDEPATH:-${LIBPATH}/include} |
132 |
+if is_crosscompile ; then |
133 |
+ BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CHOST}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} |
134 |
+else |
135 |
+ BINPATH=${TOOLCHAIN_BINPATH:-${PREFIX}/${CTARGET}/gcc-bin/${GCC_CONFIG_VER}} |
136 |
+fi |
137 |
+DATAPATH=${TOOLCHAIN_DATAPATH:-${PREFIX}/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}} |
138 |
+# Dont install in /usr/include/g++-v3/, but in gcc internal directory. |
139 |
+# We will handle /usr/include/g++-v3/ with gcc-config ... |
140 |
+STDCXX_INCDIR=${TOOLCHAIN_STDCXX_INCDIR:-${LIBPATH}/include/g++-v${GCC_BRANCH_VER/\.*/}} |
141 |
+ |
142 |
+#----<< globals >>---- |
143 |
+ |
144 |
+ |
145 |
+#---->> SLOT+IUSE logic <<---- |
146 |
+IUSE="build multislot nls nptl test vanilla" |
147 |
+ |
148 |
+if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
149 |
+ IUSE+=" altivec cxx fortran nocxx" |
150 |
+ [[ -n ${PIE_VER} ]] && IUSE+=" nopie" |
151 |
+ [[ -n ${HTB_VER} ]] && IUSE+=" boundschecking" |
152 |
+ [[ -n ${D_VER} ]] && IUSE+=" d" |
153 |
+ [[ -n ${SPECS_VER} ]] && IUSE+=" nossp" |
154 |
+ |
155 |
+ if tc_version_is_at_least 3 ; then |
156 |
+ IUSE+=" bootstrap doc gcj gtk hardened multilib objc" |
157 |
+ |
158 |
+ tc_version_is_at_least "4.0" && IUSE+=" objc-gc mudflap" |
159 |
+ tc_version_is_at_least "4.1" && IUSE+=" libssp objc++" |
160 |
+ tc_version_is_at_least "4.2" && IUSE+=" openmp" |
161 |
+ tc_version_is_at_least "4.3" && IUSE+=" fixed-point" |
162 |
+ tc_version_is_at_least "4.4" && IUSE+=" graphite" |
163 |
+ [[ ${GCC_BRANCH_VER} == 4.5 ]] && IUSE+=" lto" |
164 |
+ tc_version_is_at_least "4.6" && IUSE+=" go" |
165 |
+ fi |
166 |
+fi |
167 |
+ |
168 |
+# Support upgrade paths here or people get pissed |
169 |
+if use multislot ; then |
170 |
+ SLOT="${CTARGET}-${GCC_CONFIG_VER}" |
171 |
+elif is_crosscompile; then |
172 |
+ SLOT="${CTARGET}-${GCC_BRANCH_VER}" |
173 |
+else |
174 |
+ SLOT="${GCC_BRANCH_VER}" |
175 |
+fi |
176 |
+#----<< SLOT+IUSE logic >>---- |
177 |
+ |
178 |
+#---->> DEPEND <<---- |
179 |
+ |
180 |
+RDEPEND="sys-libs/zlib |
181 |
+ !build? ( |
182 |
+ nls? ( sys-devel/gettext ) |
183 |
+ )" |
184 |
+if tc_version_is_at_least 3 ; then |
185 |
+ RDEPEND+=" virtual/libiconv" |
186 |
+fi |
187 |
+if tc_version_is_at_least 4 ; then |
188 |
+ GMP_MPFR_DEPS=">=dev-libs/gmp-4.3.2 >=dev-libs/mpfr-2.4.2" |
189 |
+ if tc_version_is_at_least 4.3 ; then |
190 |
+ RDEPEND+=" ${GMP_MPFR_DEPS}" |
191 |
+ elif in_iuse fortran ; then |
192 |
+ RDEPEND+=" fortran? ( ${GMP_MPFR_DEPS} )" |
193 |
+ fi |
194 |
+ if tc_version_is_at_least 4.5 ; then |
195 |
+ RDEPEND+=" >=dev-libs/mpc-0.8.1" |
196 |
+ fi |
197 |
+ in_iuse lto && RDEPEND+=" lto? ( || ( >=dev-libs/elfutils-0.143 dev-libs/libelf ) )" |
198 |
+fi |
199 |
+if in_iuse graphite ; then |
200 |
+ RDEPEND+=" |
201 |
+ graphite? ( |
202 |
+ >=dev-libs/cloog-ppl-0.15.10 |
203 |
+ >=dev-libs/ppl-0.11 |
204 |
+ )" |
205 |
+fi |
206 |
+ |
207 |
+DEPEND="${RDEPEND} |
208 |
+ >=sys-apps/texinfo-4.8 |
209 |
+ >=sys-devel/bison-1.875 |
210 |
+ >=sys-devel/flex-2.5.4 |
211 |
+ test? ( |
212 |
+ >=dev-util/dejagnu-1.4.4 |
213 |
+ >=sys-devel/autogen-5.5.4 |
214 |
+ )" |
215 |
+if in_iuse gcj ; then |
216 |
+ GCJ_GTK_DEPS=" |
217 |
+ x11-libs/libXt |
218 |
+ x11-libs/libX11 |
219 |
+ x11-libs/libXtst |
220 |
+ x11-proto/xproto |
221 |
+ x11-proto/xextproto |
222 |
+ =x11-libs/gtk+-2*" |
223 |
+ tc_version_is_at_least 3.4 && GCJ_GTK_DEPS+=" x11-libs/pango" |
224 |
+ GCJ_DEPS=">=media-libs/libart_lgpl-2.1" |
225 |
+ tc_version_is_at_least 4.2 && GCJ_DEPS+=" app-arch/zip app-arch/unzip" |
226 |
+ DEPEND+=" gcj? ( gtk? ( ${GCJ_GTK_DEPS} ) ${GCJ_DEPS} )" |
227 |
+fi |
228 |
+ |
229 |
+PDEPEND=">=sys-devel/gcc-config-1.5" |
230 |
+ |
231 |
+#----<< DEPEND >>---- |
232 |
+ |
233 |
+#---->> S + SRC_URI essentials <<---- |
234 |
+ |
235 |
+# Set the source directory depending on whether we're using |
236 |
+# a prerelease, snapshot, or release tarball. |
237 |
+S=$( |
238 |
+ if [[ -n ${PRERELEASE} ]] ; then |
239 |
+ echo ${WORKDIR}/gcc-${PRERELEASE} |
240 |
+ elif [[ -n ${SNAPSHOT} ]] ; then |
241 |
+ echo ${WORKDIR}/gcc-${SNAPSHOT} |
242 |
+ else |
243 |
+ echo ${WORKDIR}/gcc-${GCC_RELEASE_VER} |
244 |
+ fi |
245 |
+) |
246 |
+ |
247 |
+# This function handles the basics of setting the SRC_URI for a gcc ebuild. |
248 |
+# To use, set SRC_URI with: |
249 |
+# |
250 |
+# SRC_URI="$(get_gcc_src_uri)" |
251 |
+# |
252 |
+# Other than the variables normally set by portage, this function's behavior |
253 |
+# can be altered by setting the following: |
254 |
+# |
255 |
+# SNAPSHOT |
256 |
+# If set, this variable signals that we should be using a snapshot |
257 |
+# of gcc from ftp://sources.redhat.com/pub/gcc/snapshots/. It is |
258 |
+# expected to be in the format "YYYY-MM-DD". Note that if the ebuild |
259 |
+# has a _pre suffix, this variable is ignored and the prerelease |
260 |
+# tarball is used instead. |
261 |
+# |
262 |
+# BRANCH_UPDATE |
263 |
+# If set, this variable signals that we should be using the main |
264 |
+# release tarball (determined by ebuild version) and applying a |
265 |
+# CVS branch update patch against it. The location of this branch |
266 |
+# update patch is assumed to be in ${GENTOO_TOOLCHAIN_BASE_URI}. |
267 |
+# Just like with SNAPSHOT, this variable is ignored if the ebuild |
268 |
+# has a _pre suffix. |
269 |
+# |
270 |
+# PATCH_VER |
271 |
+# PATCH_GCC_VER |
272 |
+# This should be set to the version of the gentoo patch tarball. |
273 |
+# The resulting filename of this tarball will be: |
274 |
+# gcc-${PATCH_GCC_VER:-${GCC_RELEASE_VER}}-patches-${PATCH_VER}.tar.bz2 |
275 |
+# |
276 |
+# PIE_VER |
277 |
+# PIE_GCC_VER |
278 |
+# These variables control patching in various updates for the logic |
279 |
+# controlling Position Independant Executables. PIE_VER is expected |
280 |
+# to be the version of this patch, and PIE_GCC_VER the gcc version of |
281 |
+# the patch: |
282 |
+# An example: |
283 |
+# PIE_VER="8.7.6.5" |
284 |
+# PIE_GCC_VER="3.4.0" |
285 |
+# The resulting filename of this tarball will be: |
286 |
+# gcc-${PIE_GCC_VER:-${GCC_RELEASE_VER}}-piepatches-v${PIE_VER}.tar.bz2 |
287 |
+# |
288 |
+# SPECS_VER |
289 |
+# SPECS_GCC_VER |
290 |
+# This is for the minispecs files included in the hardened gcc-4.x |
291 |
+# The specs files for hardenedno*, vanilla and for building the "specs" file. |
292 |
+# SPECS_VER is expected to be the version of this patch, SPECS_GCC_VER |
293 |
+# the gcc version of the patch. |
294 |
+# An example: |
295 |
+# SPECS_VER="8.7.6.5" |
296 |
+# SPECS_GCC_VER="3.4.0" |
297 |
+# The resulting filename of this tarball will be: |
298 |
+# gcc-${SPECS_GCC_VER:-${GCC_RELEASE_VER}}-specs-${SPECS_VER}.tar.bz2 |
299 |
+# |
300 |
+# HTB_VER |
301 |
+# HTB_GCC_VER |
302 |
+# These variables control whether or not an ebuild supports Herman |
303 |
+# ten Brugge's bounds-checking patches. If you want to use a patch |
304 |
+# for an older gcc version with a new gcc, make sure you set |
305 |
+# HTB_GCC_VER to that version of gcc. |
306 |
+# |
307 |
+gentoo_urls() { |
308 |
+ local devspace="HTTP~vapier/dist/URI HTTP~dirtyepic/dist/URI |
309 |
+ HTTP~halcy0n/patches/URI HTTP~zorry/patches/gcc/URI" |
310 |
+ devspace=${devspace//HTTP/http:\/\/dev.gentoo.org\/} |
311 |
+ echo mirror://gentoo/$1 ${devspace//URI/$1} |
312 |
+} |
313 |
+ |
314 |
+get_gcc_src_uri() { |
315 |
+ export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} |
316 |
+ export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} |
317 |
+ export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}} |
318 |
+ export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}} |
319 |
+ export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} |
320 |
+ |
321 |
+ # Set where to download gcc itself depending on whether we're using a |
322 |
+ # prerelease, snapshot, or release tarball. |
323 |
+ if [[ -n ${PRERELEASE} ]] ; then |
324 |
+ GCC_SRC_URI="ftp://gcc.gnu.org/pub/gcc/prerelease-${PRERELEASE}/gcc-${PRERELEASE}.tar.bz2" |
325 |
+ elif [[ -n ${SNAPSHOT} ]] ; then |
326 |
+ GCC_SRC_URI="ftp://sources.redhat.com/pub/gcc/snapshots/${SNAPSHOT}/gcc-${SNAPSHOT}.tar.bz2" |
327 |
+ elif [[ ${PV} != *9999* ]] ; then |
328 |
+ GCC_SRC_URI="mirror://gnu/gcc/gcc-${GCC_PV}/gcc-${GCC_RELEASE_VER}.tar.bz2" |
329 |
+ # we want all branch updates to be against the main release |
330 |
+ [[ -n ${BRANCH_UPDATE} ]] && \ |
331 |
+ GCC_SRC_URI+=" $(gentoo_urls gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2)" |
332 |
+ fi |
333 |
+ |
334 |
+ [[ -n ${UCLIBC_VER} ]] && GCC_SRC_URI+=" $(gentoo_urls gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2)" |
335 |
+ [[ -n ${PATCH_VER} ]] && GCC_SRC_URI+=" $(gentoo_urls gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2)" |
336 |
+ |
337 |
+ # strawberry pie, Cappuccino and a Gauloises (it's a good thing) |
338 |
+ [[ -n ${PIE_VER} ]] && \ |
339 |
+ PIE_CORE=${PIE_CORE:-gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2} && \ |
340 |
+ GCC_SRC_URI+=" $(gentoo_urls ${PIE_CORE})" |
341 |
+ |
342 |
+ # gcc minispec for the hardened gcc 4 compiler |
343 |
+ [[ -n ${SPECS_VER} ]] && GCC_SRC_URI+=" $(gentoo_urls gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2)" |
344 |
+ |
345 |
+ # gcc bounds checking patch |
346 |
+ if [[ -n ${HTB_VER} ]] ; then |
347 |
+ local HTBFILE="bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" |
348 |
+ GCC_SRC_URI+=" |
349 |
+ boundschecking? ( |
350 |
+ mirror://sourceforge/boundschecking/${HTBFILE} |
351 |
+ $(gentoo_urls ${HTBFILE}) |
352 |
+ )" |
353 |
+ fi |
354 |
+ |
355 |
+ [[ -n ${D_VER} ]] && GCC_SRC_URI+=" d? ( mirror://sourceforge/dgcc/gdc-${D_VER}-src.tar.bz2 )" |
356 |
+ |
357 |
+ # >= gcc-4.3 uses ecj.jar and we only add gcj as a use flag under certain |
358 |
+ # conditions |
359 |
+ if [[ ${PN} != "kgcc64" && ${PN} != gcc-* ]] ; then |
360 |
+ if tc_version_is_at_least "4.5" ; then |
361 |
+ GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.5.jar )" |
362 |
+ elif tc_version_is_at_least "4.3" ; then |
363 |
+ GCC_SRC_URI+=" gcj? ( ftp://sourceware.org/pub/java/ecj-4.3.jar )" |
364 |
+ fi |
365 |
+ fi |
366 |
+ |
367 |
+ echo "${GCC_SRC_URI}" |
368 |
+} |
369 |
+SRC_URI=$(get_gcc_src_uri) |
370 |
+#---->> S + SRC_URI essentials >>---- |
371 |
+ |
372 |
+ |
373 |
+#---->> support checks <<---- |
374 |
+ |
375 |
+# Grab a variable from the build system (taken from linux-info.eclass) |
376 |
+get_make_var() { |
377 |
+ local var=$1 makefile=${2:-${WORKDIR}/build/Makefile} |
378 |
+ echo -e "e:\\n\\t@echo \$(${var})\\ninclude ${makefile}" | \ |
379 |
+ r=${makefile%/*} emake --no-print-directory -s -f - 2>/dev/null |
380 |
+} |
381 |
+XGCC() { get_make_var GCC_FOR_TARGET ; } |
382 |
+ |
383 |
+# The gentoo piessp patches allow for 3 configurations: |
384 |
+# 1) PIE+SSP by default |
385 |
+# 2) PIE by default |
386 |
+# 3) SSP by default |
387 |
+hardened_gcc_works() { |
388 |
+ if [[ $1 == "pie" ]] ; then |
389 |
+ # $gcc_cv_ld_pie is unreliable as it simply take the output of |
390 |
+ # `ld --help | grep -- -pie`, that reports the option in all cases, also if |
391 |
+ # the loader doesn't actually load the resulting executables. |
392 |
+ # To avoid breakage, blacklist FreeBSD here at least |
393 |
+ [[ ${CTARGET} == *-freebsd* ]] && return 1 |
394 |
+ |
395 |
+ want_pie || return 1 |
396 |
+ use_if_iuse nopie && return 1 |
397 |
+ hardened_gcc_is_stable pie |
398 |
+ return $? |
399 |
+ elif [[ $1 == "ssp" ]] ; then |
400 |
+ [[ -n ${SPECS_VER} ]] || return 1 |
401 |
+ use_if_iuse nossp && return 1 |
402 |
+ hardened_gcc_is_stable ssp |
403 |
+ return $? |
404 |
+ else |
405 |
+ # laziness ;) |
406 |
+ hardened_gcc_works pie || return 1 |
407 |
+ hardened_gcc_works ssp || return 1 |
408 |
+ return 0 |
409 |
+ fi |
410 |
+} |
411 |
+ |
412 |
+hardened_gcc_is_stable() { |
413 |
+ local tocheck |
414 |
+ if [[ $1 == "pie" ]] ; then |
415 |
+ if [[ ${CTARGET} == *-uclibc* ]] ; then |
416 |
+ tocheck=${PIE_UCLIBC_STABLE} |
417 |
+ else |
418 |
+ tocheck=${PIE_GLIBC_STABLE} |
419 |
+ fi |
420 |
+ elif [[ $1 == "ssp" ]] ; then |
421 |
+ if [[ ${CTARGET} == *-uclibc* ]] ; then |
422 |
+ tocheck=${SSP_UCLIBC_STABLE} |
423 |
+ else |
424 |
+ tocheck=${SSP_STABLE} |
425 |
+ fi |
426 |
+ else |
427 |
+ die "hardened_gcc_stable needs to be called with pie or ssp" |
428 |
+ fi |
429 |
+ |
430 |
+ has $(tc-arch) ${tocheck} && return 0 |
431 |
+ return 1 |
432 |
+} |
433 |
+ |
434 |
+want_pie() { |
435 |
+ ! use hardened && [[ -n ${PIE_VER} ]] && use nopie && return 1 |
436 |
+ [[ -n ${PIE_VER} ]] && [[ -n ${SPECS_VER} ]] && return 0 |
437 |
+ tc_version_is_at_least 4.3.2 && return 1 |
438 |
+ [[ -z ${PIE_VER} ]] && return 1 |
439 |
+ use !nopie && return 0 |
440 |
+ return 1 |
441 |
+} |
442 |
+ |
443 |
+want_minispecs() { |
444 |
+ if tc_version_is_at_least 4.3.2 && use hardened ; then |
445 |
+ if ! want_pie ; then |
446 |
+ ewarn "PIE_VER or SPECS_VER is not defiend in the GCC ebuild." |
447 |
+ elif use vanilla ; then |
448 |
+ ewarn "You will not get hardened features if you have the vanilla USE-flag." |
449 |
+ elif use nopie && use nossp ; then |
450 |
+ ewarn "You will not get hardened features if you have the nopie and nossp USE-flag." |
451 |
+ elif ! hardened_gcc_works ; then |
452 |
+ ewarn "Your $(tc-arch) arch is not supported." |
453 |
+ else |
454 |
+ return 0 |
455 |
+ fi |
456 |
+ ewarn "Hope you know what you are doing. Hardened will not work." |
457 |
+ return 0 |
458 |
+ fi |
459 |
+ return 1 |
460 |
+} |
461 |
+ |
462 |
+# This is to make sure we don't accidentally try to enable support for a |
463 |
+# language that doesnt exist. GCC 3.4 supports f77, while 4.0 supports f95, etc. |
464 |
+# |
465 |
+# Also add a hook so special ebuilds (kgcc64) can control which languages |
466 |
+# exactly get enabled |
467 |
+gcc-lang-supported() { |
468 |
+ grep ^language=\"${1}\" "${S}"/gcc/*/config-lang.in > /dev/null || return 1 |
469 |
+ [[ -z ${TOOLCHAIN_ALLOWED_LANGS} ]] && return 0 |
470 |
+ has $1 ${TOOLCHAIN_ALLOWED_LANGS} |
471 |
+} |
472 |
+ |
473 |
+#----<< support checks >>---- |
474 |
+ |
475 |
+#---->> specs + env.d logic <<---- |
476 |
+ |
477 |
+# configure to build with the hardened GCC specs as the default |
478 |
+make_gcc_hard() { |
479 |
+ # defaults to enable for all hardened toolchains |
480 |
+ local gcc_hard_flags="-DEFAULT_RELRO -DEFAULT_BIND_NOW" |
481 |
+ |
482 |
+ if hardened_gcc_works ; then |
483 |
+ einfo "Updating gcc to use automatic PIE + SSP building ..." |
484 |
+ gcc_hard_flags+=" -DEFAULT_PIE_SSP" |
485 |
+ elif hardened_gcc_works pie ; then |
486 |
+ einfo "Updating gcc to use automatic PIE building ..." |
487 |
+ ewarn "SSP has not been enabled by default" |
488 |
+ gcc_hard_flags+=" -DEFAULT_PIE" |
489 |
+ elif hardened_gcc_works ssp ; then |
490 |
+ einfo "Updating gcc to use automatic SSP building ..." |
491 |
+ ewarn "PIE has not been enabled by default" |
492 |
+ gcc_hard_flags+=" -DEFAULT_SSP" |
493 |
+ else |
494 |
+ # do nothing if hardened isnt supported, but dont die either |
495 |
+ ewarn "hardened is not supported for this arch in this gcc version" |
496 |
+ ebeep |
497 |
+ return 0 |
498 |
+ fi |
499 |
+ |
500 |
+ sed -i \ |
501 |
+ -e "/^HARD_CFLAGS = /s|=|= ${gcc_hard_flags} |" \ |
502 |
+ "${S}"/gcc/Makefile.in || die |
503 |
+ |
504 |
+ # rebrand to make bug reports easier |
505 |
+ BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/Gentoo/Gentoo Hardened} |
506 |
+} |
507 |
+ |
508 |
+create_gcc_env_entry() { |
509 |
+ dodir /etc/env.d/gcc |
510 |
+ local gcc_envd_base="/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}" |
511 |
+ |
512 |
+ if [[ -z $1 ]] ; then |
513 |
+ gcc_envd_file="${D}${gcc_envd_base}" |
514 |
+ # I'm leaving the following commented out to remind me that it |
515 |
+ # was an insanely -bad- idea. Stuff broke. GCC_SPECS isnt unset |
516 |
+ # on chroot or in non-toolchain.eclass gcc ebuilds! |
517 |
+ #gcc_specs_file="${LIBPATH}/specs" |
518 |
+ gcc_specs_file="" |
519 |
+ else |
520 |
+ gcc_envd_file="${D}${gcc_envd_base}-$1" |
521 |
+ gcc_specs_file="${LIBPATH}/$1.specs" |
522 |
+ fi |
523 |
+ |
524 |
+ # phase PATH/ROOTPATH out ... |
525 |
+ echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file} |
526 |
+ echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file} |
527 |
+ echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file} |
528 |
+ |
529 |
+ # We want to list the default ABI's LIBPATH first so libtool |
530 |
+ # searches that directory first. This is a temporary |
531 |
+ # workaround for libtool being stupid and using .la's from |
532 |
+ # conflicting ABIs by using the first one in the search path |
533 |
+ local abi=${DEFAULT_ABI} |
534 |
+ local MULTIDIR=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory) |
535 |
+ local LDPATH=${LIBPATH} |
536 |
+ [[ ${MULTIDIR} != "." ]] && LDPATH+=/${MULTIDIR} |
537 |
+ for abi in $(get_all_abis) ; do |
538 |
+ [[ ${abi} == ${DEFAULT_ABI} ]] && continue |
539 |
+ |
540 |
+ MULTIDIR=$($(XGCC) $(get_abi_CFLAGS ${abi}) --print-multi-directory) |
541 |
+ LDPATH+=:${LIBPATH} |
542 |
+ [[ ${MULTIDIR} != "." ]] && LDPATH+=/${MULTIDIR} |
543 |
+ done |
544 |
+ |
545 |
+ echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file} |
546 |
+ echo "MANPATH=\"${DATAPATH}/man\"" >> ${gcc_envd_file} |
547 |
+ echo "INFOPATH=\"${DATAPATH}/info\"" >> ${gcc_envd_file} |
548 |
+ echo "STDCXX_INCDIR=\"${STDCXX_INCDIR##*/}\"" >> ${gcc_envd_file} |
549 |
+ |
550 |
+ is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file} |
551 |
+ |
552 |
+ # Set which specs file to use |
553 |
+ [[ -n ${gcc_specs_file} ]] && echo "GCC_SPECS=\"${gcc_specs_file}\"" >> ${gcc_envd_file} |
554 |
+} |
555 |
+setup_minispecs_gcc_build_specs() { |
556 |
+ # Setup the "build.specs" file for gcc 4.3 to use when building. |
557 |
+ if hardened_gcc_works pie ; then |
558 |
+ cat "${WORKDIR}"/specs/pie.specs >> "${WORKDIR}"/build.specs |
559 |
+ fi |
560 |
+ if hardened_gcc_works ssp ; then |
561 |
+ for s in ssp sspall ; do |
562 |
+ cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs |
563 |
+ done |
564 |
+ fi |
565 |
+ for s in nostrict znow ; do |
566 |
+ cat "${WORKDIR}"/specs/${s}.specs >> "${WORKDIR}"/build.specs |
567 |
+ done |
568 |
+ export GCC_SPECS="${WORKDIR}"/build.specs |
569 |
+} |
570 |
+copy_minispecs_gcc_specs() { |
571 |
+ # setup the hardenedno* specs files and the vanilla specs file. |
572 |
+ if hardened_gcc_works ; then |
573 |
+ create_gcc_env_entry hardenednopiessp |
574 |
+ fi |
575 |
+ if hardened_gcc_works pie ; then |
576 |
+ create_gcc_env_entry hardenednopie |
577 |
+ fi |
578 |
+ if hardened_gcc_works ssp ; then |
579 |
+ create_gcc_env_entry hardenednossp |
580 |
+ fi |
581 |
+ create_gcc_env_entry vanilla |
582 |
+ insinto ${LIBPATH} |
583 |
+ doins "${WORKDIR}"/specs/*.specs || die "failed to install specs" |
584 |
+ # Build system specs file which, if it exists, must be a complete set of |
585 |
+ # specs as it completely and unconditionally overrides the builtin specs. |
586 |
+ # For gcc 4.3 |
587 |
+ if ! tc_version_is_at_least 4.4 ; then |
588 |
+ $(XGCC) -dumpspecs > "${WORKDIR}"/specs/specs |
589 |
+ cat "${WORKDIR}"/build.specs >> "${WORKDIR}"/specs/specs |
590 |
+ doins "${WORKDIR}"/specs/specs || die "failed to install the specs file" |
591 |
+ fi |
592 |
+} |
593 |
+ |
594 |
+#----<< specs + env.d logic >>---- |
595 |
+ |
596 |
+#---->> pkg_* <<---- |
597 |
+toolchain_pkg_setup() { |
598 |
+ if [[ -n ${PRERELEASE}${SNAPSHOT} || ${PV} == *9999* ]] && |
599 |
+ [[ -z ${I_PROMISE_TO_SUPPLY_PATCHES_WITH_BUGS} ]] |
600 |
+ then |
601 |
+ 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." \ |
602 |
+ "This is to try and cut down on people filing bugs for a compiler we do not currently support." |
603 |
+ fi |
604 |
+ |
605 |
+ # Setup variables which would normally be in the profile |
606 |
+ if is_crosscompile ; then |
607 |
+ multilib_env ${CTARGET} |
608 |
+ if ! is_multilib ; then |
609 |
+ MULTILIB_ABIS=${DEFAULT_ABI} |
610 |
+ fi |
611 |
+ fi |
612 |
+ |
613 |
+ # we dont want to use the installed compiler's specs to build gcc! |
614 |
+ unset GCC_SPECS |
615 |
+ |
616 |
+ if ! use_if_iuse cxx ; then |
617 |
+ use_if_iuse go && ewarn 'Go requires a C++ compiler, disabled due to USE="-cxx"' |
618 |
+ use_if_iuse objc++ && ewarn 'Obj-C++ requires a C++ compiler, disabled due to USE="-cxx"' |
619 |
+ use_if_iuse gcj && ewarn 'GCJ requires a C++ compiler, disabled due to USE="-cxx"' |
620 |
+ fi |
621 |
+ |
622 |
+ want_minispecs |
623 |
+ |
624 |
+ unset LANGUAGES #265283 |
625 |
+} |
626 |
+ |
627 |
+toolchain_pkg_preinst() { |
628 |
+ : |
629 |
+} |
630 |
+ |
631 |
+toolchain_pkg_postinst() { |
632 |
+ do_gcc_config |
633 |
+ |
634 |
+ if ! is_crosscompile ; then |
635 |
+ echo |
636 |
+ ewarn "If you have issues with packages unable to locate libstdc++.la," |
637 |
+ ewarn "then try running 'fix_libtool_files.sh' on the old gcc versions." |
638 |
+ echo |
639 |
+ ewarn "You might want to review the GCC upgrade guide when moving between" |
640 |
+ ewarn "major versions (like 4.2 to 4.3):" |
641 |
+ ewarn "http://www.gentoo.org/doc/en/gcc-upgrading.xml" |
642 |
+ echo |
643 |
+ fi |
644 |
+ |
645 |
+ # If our gcc-config version doesn't like '-' in it's version string, |
646 |
+ # tell our users that gcc-config will yell at them, but it's all good. |
647 |
+ if ! has_version '>=sys-devel/gcc-config-1.3.10-r1' && [[ ${GCC_CONFIG_VER/-/} != ${GCC_CONFIG_VER} ]] ; then |
648 |
+ ewarn "Your version of gcc-config will issue about having an invalid profile" |
649 |
+ ewarn "when switching to this profile. It is safe to ignore this warning," |
650 |
+ ewarn "and this problem has been corrected in >=sys-devel/gcc-config-1.3.10-r1." |
651 |
+ fi |
652 |
+ |
653 |
+ if ! is_crosscompile && ! use multislot && [[ ${GCCMAJOR}.${GCCMINOR} == 3.4 ]] ; then |
654 |
+ echo |
655 |
+ ewarn "You should make sure to rebuild all your C++ packages when" |
656 |
+ ewarn "upgrading between different versions of gcc. For example," |
657 |
+ ewarn "when moving to gcc-3.4 from gcc-3.3, emerge gentoolkit and run:" |
658 |
+ ewarn " # revdep-rebuild --library libstdc++.so.5" |
659 |
+ echo |
660 |
+ fi |
661 |
+ |
662 |
+ if ! is_crosscompile ; then |
663 |
+ # hack to prevent collisions between SLOT |
664 |
+ [[ ! -d ${ROOT}/$(get_libdir)/rcscripts/awk ]] \ |
665 |
+ && mkdir -p "${ROOT}"/$(get_libdir)/rcscripts/awk |
666 |
+ [[ ! -d ${ROOT}/sbin ]] \ |
667 |
+ && mkdir -p "${ROOT}"/sbin |
668 |
+ cp "${ROOT}/${DATAPATH}"/fixlafiles.awk "${ROOT}"/$(get_libdir)/rcscripts/awk/ || die "installing fixlafiles.awk" |
669 |
+ cp "${ROOT}/${DATAPATH}"/fix_libtool_files.sh "${ROOT}"/sbin/ || die "installing fix_libtool_files.sh" |
670 |
+ |
671 |
+ [[ ! -d ${ROOT}/usr/bin ]] \ |
672 |
+ && mkdir -p "${ROOT}"/usr/bin |
673 |
+ # Since these aren't critical files and portage sucks with |
674 |
+ # handling of binpkgs, don't require these to be found |
675 |
+ for x in "${ROOT}/${DATAPATH}"/c{89,99} ; do |
676 |
+ if [[ -e ${x} ]]; then |
677 |
+ cp ${x} "${ROOT}"/usr/bin/ || die "installing c89/c99" |
678 |
+ fi |
679 |
+ done |
680 |
+ fi |
681 |
+} |
682 |
+ |
683 |
+toolchain_pkg_prerm() { |
684 |
+ # Don't let these files be uninstalled #87647 |
685 |
+ touch -c "${ROOT}"/sbin/fix_libtool_files.sh \ |
686 |
+ "${ROOT}"/$(get_libdir)/rcscripts/awk/fixlafiles.awk |
687 |
+} |
688 |
+ |
689 |
+toolchain_pkg_postrm() { |
690 |
+ # to make our lives easier (and saner), we do the fix_libtool stuff here. |
691 |
+ # rather than checking SLOT's and trying in upgrade paths, we just see if |
692 |
+ # the common libstdc++.la exists in the ${LIBPATH} of the gcc that we are |
693 |
+ # unmerging. if it does, that means this was a simple re-emerge. |
694 |
+ |
695 |
+ # clean up the cruft left behind by cross-compilers |
696 |
+ if is_crosscompile ; then |
697 |
+ if [[ -z $(ls "${ROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then |
698 |
+ rm -f "${ROOT}"/etc/env.d/gcc/config-${CTARGET} |
699 |
+ rm -f "${ROOT}"/etc/env.d/??gcc-${CTARGET} |
700 |
+ rm -f "${ROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64} |
701 |
+ fi |
702 |
+ return 0 |
703 |
+ fi |
704 |
+ |
705 |
+ # ROOT isnt handled by the script |
706 |
+ [[ ${ROOT} != "/" ]] && return 0 |
707 |
+ |
708 |
+ if [[ ! -e ${LIBPATH}/libstdc++.so ]] ; then |
709 |
+ # make sure the profile is sane during same-slot upgrade #289403 |
710 |
+ do_gcc_config |
711 |
+ |
712 |
+ einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}'" |
713 |
+ /sbin/fix_libtool_files.sh ${GCC_RELEASE_VER} |
714 |
+ if [[ -n ${BRANCH_UPDATE} ]] ; then |
715 |
+ einfo "Running 'fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE}'" |
716 |
+ /sbin/fix_libtool_files.sh ${GCC_RELEASE_VER}-${BRANCH_UPDATE} |
717 |
+ fi |
718 |
+ fi |
719 |
+ |
720 |
+ return 0 |
721 |
+} |
722 |
+ |
723 |
+#---->> pkg_* <<---- |
724 |
+ |
725 |
+#---->> src_* <<---- |
726 |
+ |
727 |
+guess_patch_type_in_dir() { |
728 |
+ [[ -n $(ls "$1"/*.bz2 2>/dev/null) ]] \ |
729 |
+ && EPATCH_SUFFIX="patch.bz2" \ |
730 |
+ || EPATCH_SUFFIX="patch" |
731 |
+} |
732 |
+do_gcc_rename_java_bins() { |
733 |
+ # bug #139918 - conflict between gcc and java-config-2 for ownership of |
734 |
+ # /usr/bin/rmi{c,registry}. Done with mv & sed rather than a patch |
735 |
+ # because patches would be large (thanks to the rename of man files), |
736 |
+ # and it's clear from the sed invocations that all that changes is the |
737 |
+ # rmi{c,registry} names to grmi{c,registry} names. |
738 |
+ # Kevin F. Quinn 2006-07-12 |
739 |
+ einfo "Renaming jdk executables rmic and rmiregistry to grmic and grmiregistry." |
740 |
+ # 1) Move the man files if present (missing prior to gcc-3.4) |
741 |
+ for manfile in rmic rmiregistry; do |
742 |
+ [[ -f ${S}/gcc/doc/${manfile}.1 ]] || continue |
743 |
+ mv "${S}"/gcc/doc/${manfile}.1 "${S}"/gcc/doc/g${manfile}.1 |
744 |
+ done |
745 |
+ # 2) Fixup references in the docs if present (mission prior to gcc-3.4) |
746 |
+ for jfile in gcc/doc/gcj.info gcc/doc/grmic.1 gcc/doc/grmiregistry.1 gcc/java/gcj.texi; do |
747 |
+ [[ -f ${S}/${jfile} ]] || continue |
748 |
+ sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || |
749 |
+ die "Failed to fixup file ${jfile} for rename to grmiregistry" |
750 |
+ sed -i -e 's:rmic:grmic:g' "${S}"/${jfile} || |
751 |
+ die "Failed to fixup file ${jfile} for rename to grmic" |
752 |
+ done |
753 |
+ # 3) Fixup Makefiles to build the changed executable names |
754 |
+ # These are present in all 3.x versions, and are the important bit |
755 |
+ # to get gcc to build with the new names. |
756 |
+ for jfile in libjava/Makefile.am libjava/Makefile.in gcc/java/Make-lang.in; do |
757 |
+ sed -i -e 's:rmiregistry:grmiregistry:g' "${S}"/${jfile} || |
758 |
+ die "Failed to fixup file ${jfile} for rename to grmiregistry" |
759 |
+ # Careful with rmic on these files; it's also the name of a directory |
760 |
+ # which should be left unchanged. Replace occurrences of 'rmic$', |
761 |
+ # 'rmic_' and 'rmic '. |
762 |
+ sed -i -e 's:rmic\([$_ ]\):grmic\1:g' "${S}"/${jfile} || |
763 |
+ die "Failed to fixup file ${jfile} for rename to grmic" |
764 |
+ done |
765 |
+} |
766 |
+toolchain_src_unpack() { |
767 |
+ [[ -z ${UCLIBC_VER} ]] && [[ ${CTARGET} == *-uclibc* ]] && die "Sorry, this version does not support uClibc" |
768 |
+ |
769 |
+ if [[ ${PV} == *9999* ]]; then |
770 |
+ git-2_src_unpack |
771 |
+ else |
772 |
+ gcc_quick_unpack |
773 |
+ fi |
774 |
+ |
775 |
+ export BRANDING_GCC_PKGVERSION="Gentoo ${GCC_PVR}" |
776 |
+ cd "${S}" |
777 |
+ |
778 |
+ if ! use vanilla ; then |
779 |
+ if [[ -n ${PATCH_VER} ]] ; then |
780 |
+ guess_patch_type_in_dir "${WORKDIR}"/patch |
781 |
+ EPATCH_MULTI_MSG="Applying Gentoo patches ..." \ |
782 |
+ epatch "${WORKDIR}"/patch |
783 |
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION} p${PATCH_VER}" |
784 |
+ fi |
785 |
+ if [[ -n ${UCLIBC_VER} ]] ; then |
786 |
+ guess_patch_type_in_dir "${WORKDIR}"/uclibc |
787 |
+ EPATCH_MULTI_MSG="Applying uClibc patches ..." \ |
788 |
+ epatch "${WORKDIR}"/uclibc |
789 |
+ fi |
790 |
+ fi |
791 |
+ do_gcc_HTB_patches |
792 |
+ do_gcc_PIE_patches |
793 |
+ epatch_user |
794 |
+ |
795 |
+ use hardened && make_gcc_hard |
796 |
+ |
797 |
+ # install the libstdc++ python into the right location |
798 |
+ # http://gcc.gnu.org/PR51368 |
799 |
+ if tc_version_is_at_least 4.5 ; then |
800 |
+ sed -i \ |
801 |
+ '/^pythondir =/s:=.*:= $(datadir)/python:' \ |
802 |
+ "${S}"/libstdc++-v3/python/Makefile.in || die |
803 |
+ fi |
804 |
+ |
805 |
+ # No idea when this first started being fixed, but let's go with 4.3.x for now |
806 |
+ if ! tc_version_is_at_least 4.3 ; then |
807 |
+ fix_files="" |
808 |
+ for x in contrib/test_summary libstdc++-v3/scripts/check_survey.in ; do |
809 |
+ [[ -e ${x} ]] && fix_files="${fix_files} ${x}" |
810 |
+ done |
811 |
+ ht_fix_file ${fix_files} */configure *.sh */Makefile.in |
812 |
+ fi |
813 |
+ |
814 |
+ setup_multilib_osdirnames |
815 |
+ |
816 |
+ gcc_version_patch |
817 |
+ if tc_version_is_at_least 4.1 ; then |
818 |
+ if [[ -n ${SNAPSHOT} || -n ${PRERELEASE} ]] ; then |
819 |
+ # BASE-VER must be a three-digit version number |
820 |
+ # followed by an optional -pre string |
821 |
+ # eg. 4.5.1, 4.6.2-pre20120213, 4.7.0-pre9999 |
822 |
+ # If BASE-VER differs from ${PV/_/-} then libraries get installed in |
823 |
+ # the wrong directory. |
824 |
+ echo ${PV/_/-} > "${S}"/gcc/BASE-VER |
825 |
+ fi |
826 |
+ fi |
827 |
+ |
828 |
+ # >= gcc-4.3 doesn't bundle ecj.jar, so copy it |
829 |
+ if tc_version_is_at_least 4.3 && use gcj ; then |
830 |
+ if tc_version_is_at_least "4.5" ; then |
831 |
+ einfo "Copying ecj-4.5.jar" |
832 |
+ cp -pPR "${DISTDIR}/ecj-4.5.jar" "${S}/ecj.jar" || die |
833 |
+ elif tc_version_is_at_least "4.3" ; then |
834 |
+ einfo "Copying ecj-4.3.jar" |
835 |
+ cp -pPR "${DISTDIR}/ecj-4.3.jar" "${S}/ecj.jar" || die |
836 |
+ fi |
837 |
+ fi |
838 |
+ |
839 |
+ # disable --as-needed from being compiled into gcc specs |
840 |
+ # natively when using a gcc version < 3.4.4 |
841 |
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14992 |
842 |
+ if ! tc_version_is_at_least 3.4.4 ; then |
843 |
+ sed -i -e s/HAVE_LD_AS_NEEDED/USE_LD_AS_NEEDED/g "${S}"/gcc/config.in |
844 |
+ fi |
845 |
+ |
846 |
+ # In gcc 3.3.x and 3.4.x, rename the java bins to gcc-specific names |
847 |
+ # in line with gcc-4. |
848 |
+ if tc_version_is_at_least 3.3 && ! tc_version_is_at_least 4.0 ; then |
849 |
+ do_gcc_rename_java_bins |
850 |
+ fi |
851 |
+ |
852 |
+ # Prevent libffi from being installed |
853 |
+ sed -i -e 's/\(install.*:\) install-.*recursive/\1/' "${S}"/libffi/Makefile.in |
854 |
+ sed -i -e 's/\(install-data-am:\).*/\1/' "${S}"/libffi/include/Makefile.in |
855 |
+ |
856 |
+ # Fixup libtool to correctly generate .la files with portage |
857 |
+ cd "${S}" |
858 |
+ elibtoolize --portage --shallow --no-uclibc |
859 |
+ |
860 |
+ gnuconfig_update |
861 |
+ |
862 |
+ # update configure files |
863 |
+ local f |
864 |
+ einfo "Fixing misc issues in configure files" |
865 |
+ tc_version_is_at_least 4.1 && epatch "${GCC_FILESDIR}"/gcc-configure-texinfo.patch |
866 |
+ for f in $(grep -l 'autoconf version 2.13' $(find "${S}" -name configure)) ; do |
867 |
+ ebegin " Updating ${f/${S}\/} [LANG]" |
868 |
+ patch "${f}" "${GCC_FILESDIR}"/gcc-configure-LANG.patch >& "${T}"/configure-patch.log \ |
869 |
+ || eerror "Please file a bug about this" |
870 |
+ eend $? |
871 |
+ done |
872 |
+ sed -i 's|A-Za-z0-9|[:alnum:]|g' "${S}"/gcc/*.awk #215828 |
873 |
+ |
874 |
+ if [[ -x contrib/gcc_update ]] ; then |
875 |
+ einfo "Touching generated files" |
876 |
+ ./contrib/gcc_update --touch | \ |
877 |
+ while read f ; do |
878 |
+ einfo " ${f%%...}" |
879 |
+ done |
880 |
+ fi |
881 |
+ |
882 |
+ disable_multilib_libjava || die "failed to disable multilib java" |
883 |
+} |
884 |
+ |
885 |
+gcc-abi-map() { |
886 |
+ # Convert the ABI name we use in Gentoo to what gcc uses |
887 |
+ local map=() |
888 |
+ case ${CTARGET} in |
889 |
+ mips*) map=("o32 32" "n32 n32" "n64 64") ;; |
890 |
+ x86_64*) map=("amd64 m64" "x86 m32" "x32 mx32") ;; |
891 |
+ esac |
892 |
+ |
893 |
+ local m |
894 |
+ for m in "${map[@]}" ; do |
895 |
+ l=( ${m} ) |
896 |
+ [[ $1 == ${l[0]} ]] && echo ${l[1]} && break |
897 |
+ done |
898 |
+} |
899 |
+ |
900 |
+gcc-multilib-configure() { |
901 |
+ # if multilib is disabled, get out quick! |
902 |
+ if ! is_multilib ; then |
903 |
+ confgcc+=" --disable-multilib" |
904 |
+ return |
905 |
+ else |
906 |
+ confgcc+=" --enable-multilib" |
907 |
+ fi |
908 |
+ |
909 |
+ # translate our notion of multilibs into gcc's |
910 |
+ local abi list |
911 |
+ for abi in $(get_all_abis) ; do |
912 |
+ local l=$(gcc-abi-map ${abi}) |
913 |
+ [[ -n ${l} ]] && list+=",${l}" |
914 |
+ done |
915 |
+ if [[ -n ${list} ]] ; then |
916 |
+ case ${CTARGET} in |
917 |
+ x86_64*) |
918 |
+ # drop the 4.6.2 stuff once 4.7 goes stable |
919 |
+ if tc_version_is_at_least 4.7 || |
920 |
+ ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) ) |
921 |
+ then |
922 |
+ confgcc+=" --with-multilib-list=${list:1}" |
923 |
+ fi |
924 |
+ ;; |
925 |
+ esac |
926 |
+ fi |
927 |
+} |
928 |
+ |
929 |
+gcc-compiler-configure() { |
930 |
+ gcc-multilib-configure |
931 |
+ |
932 |
+ if tc_version_is_at_least "4.0" ; then |
933 |
+ if in_iuse mudflap ; then |
934 |
+ confgcc+=" $(use_enable mudflap libmudflap)" |
935 |
+ else |
936 |
+ confgcc+=" --disable-libmudflap" |
937 |
+ fi |
938 |
+ |
939 |
+ if use_if_iuse libssp ; then |
940 |
+ confgcc+=" --enable-libssp" |
941 |
+ else |
942 |
+ export gcc_cv_libc_provides_ssp=yes |
943 |
+ confgcc+=" --disable-libssp" |
944 |
+ fi |
945 |
+ |
946 |
+ # If we want hardened support with the newer piepatchset for >=gcc 4.4 |
947 |
+ if tc_version_is_at_least 4.4 && want_minispecs ; then |
948 |
+ confgcc+=" $(use_enable hardened esp)" |
949 |
+ fi |
950 |
+ |
951 |
+ if tc_version_is_at_least "4.2" ; then |
952 |
+ if in_iuse openmp ; then |
953 |
+ # Make sure target has pthreads support. #326757 #335883 |
954 |
+ # There shouldn't be a chicken&egg problem here as openmp won't |
955 |
+ # build without a C library, and you can't build that w/out |
956 |
+ # already having a compiler ... |
957 |
+ if ! is_crosscompile || \ |
958 |
+ $(tc-getCPP ${CTARGET}) -E - <<<"#include <pthread.h>" >& /dev/null |
959 |
+ then |
960 |
+ confgcc+=" $(use_enable openmp libgomp)" |
961 |
+ else |
962 |
+ # Force disable as the configure script can be dumb #359855 |
963 |
+ confgcc+=" --disable-libgomp" |
964 |
+ fi |
965 |
+ else |
966 |
+ # For gcc variants where we don't want openmp (e.g. kgcc) |
967 |
+ confgcc+=" --disable-libgomp" |
968 |
+ fi |
969 |
+ fi |
970 |
+ |
971 |
+ # Stick the python scripts in their own slotted directory |
972 |
+ # bug #279252 |
973 |
+ # |
974 |
+ # --with-python-dir=DIR |
975 |
+ # Specifies where to install the Python modules used for aot-compile. DIR |
976 |
+ # should not include the prefix used in installation. For example, if the |
977 |
+ # Python modules are to be installed in /usr/lib/python2.5/site-packages, |
978 |
+ # then --with-python-dir=/lib/python2.5/site-packages should be passed. |
979 |
+ # |
980 |
+ # This should translate into "/share/gcc-data/${CTARGET}/${GCC_CONFIG_VER}/python" |
981 |
+ if tc_version_is_at_least "4.4" ; then |
982 |
+ confgcc+=" --with-python-dir=${DATAPATH/$PREFIX/}/python" |
983 |
+ fi |
984 |
+ fi |
985 |
+ |
986 |
+ # For newer versions of gcc, use the default ("release"), because no |
987 |
+ # one (even upstream apparently) tests with it disabled. #317217 |
988 |
+ if tc_version_is_at_least 4 || [[ -n ${GCC_CHECKS_LIST} ]] ; then |
989 |
+ confgcc+=" --enable-checking=${GCC_CHECKS_LIST:-release}" |
990 |
+ else |
991 |
+ confgcc+=" --disable-checking" |
992 |
+ fi |
993 |
+ |
994 |
+ # GTK+ is preferred over xlib in 3.4.x (xlib is unmaintained |
995 |
+ # right now). Much thanks to <csm@×××.org> for the heads up. |
996 |
+ # Travis Tilley <lv@g.o> (11 Jul 2004) |
997 |
+ if ! is_gcj ; then |
998 |
+ confgcc+=" --disable-libgcj" |
999 |
+ elif use gtk ; then |
1000 |
+ confgcc+=" --enable-java-awt=gtk" |
1001 |
+ fi |
1002 |
+ |
1003 |
+ # newer gcc versions like to bootstrap themselves with C++, |
1004 |
+ # so we need to manually disable it ourselves |
1005 |
+ if tc_version_is_at_least 4.7 && ! is_cxx ; then |
1006 |
+ confgcc+=" --disable-build-with-cxx --disable-build-poststage1-with-cxx" |
1007 |
+ fi |
1008 |
+ |
1009 |
+ # newer gcc's come with libquadmath, but only fortran uses |
1010 |
+ # it, so auto punt it when we don't care |
1011 |
+ if tc_version_is_at_least 4.6 && ! is_fortran ; then |
1012 |
+ confgcc+=" --disable-libquadmath" |
1013 |
+ fi |
1014 |
+ |
1015 |
+ local with_abi_map=() |
1016 |
+ case $(tc-arch) in |
1017 |
+ arm) #264534 |
1018 |
+ local arm_arch="${CTARGET%%-*}" |
1019 |
+ # Only do this if arm_arch is armv* |
1020 |
+ if [[ ${arm_arch} == armv* ]] ; then |
1021 |
+ # Convert armv7{a,r,m} to armv7-{a,r,m} |
1022 |
+ [[ ${arm_arch} == armv7? ]] && arm_arch=${arm_arch/7/7-} |
1023 |
+ # Remove endian ('l' / 'eb') |
1024 |
+ [[ ${arm_arch} == *l ]] && arm_arch=${arm_arch%l} |
1025 |
+ [[ ${arm_arch} == *eb ]] && arm_arch=${arm_arch%eb} |
1026 |
+ confgcc+=" --with-arch=${arm_arch}" |
1027 |
+ fi |
1028 |
+ |
1029 |
+ # Enable hardvfp |
1030 |
+ if [[ ${CTARGET##*-} == *eabi ]] && [[ $(tc-is-hardfloat) == yes ]] && \ |
1031 |
+ tc_version_is_at_least "4.5" ; then |
1032 |
+ confgcc+=" --with-float=hard" |
1033 |
+ fi |
1034 |
+ ;; |
1035 |
+ # Add --with-abi flags to set default ABI |
1036 |
+ mips) |
1037 |
+ confgcc+=" --with-abi=$(gcc-abi-map ${DEFAULT_ABI})" |
1038 |
+ ;; |
1039 |
+ amd64) |
1040 |
+ # drop the older/ABI checks once this get's merged into some |
1041 |
+ # version of gcc upstream |
1042 |
+ if [[ ${PV} == "4.6.2" ]] && has x32 $(get_all_abis) ; then |
1043 |
+ confgcc+=" --with-abi=$(gcc-abi-map ${DEFAULT_ABI})" |
1044 |
+ fi |
1045 |
+ ;; |
1046 |
+ # Default arch for x86 is normally i386, lets give it a bump |
1047 |
+ # since glibc will do so based on CTARGET anyways |
1048 |
+ x86) |
1049 |
+ confgcc+=" --with-arch=${CTARGET%%-*}" |
1050 |
+ ;; |
1051 |
+ # Enable sjlj exceptions for backward compatibility on hppa |
1052 |
+ hppa) |
1053 |
+ [[ ${GCCMAJOR} == "3" ]] && confgcc+=" --enable-sjlj-exceptions" |
1054 |
+ ;; |
1055 |
+ # Set up defaults based on current CFLAGS |
1056 |
+ ppc) |
1057 |
+ is-flagq -mfloat-gprs=double && confgcc+=" --enable-e500-double" |
1058 |
+ [[ ${CTARGET//_/-} == *-e500v2-* ]] && confgcc+=" --enable-e500-double" |
1059 |
+ ;; |
1060 |
+ esac |
1061 |
+ |
1062 |
+ local GCC_LANG="c" |
1063 |
+ is_cxx && GCC_LANG+=",c++" |
1064 |
+ is_d && GCC_LANG+=",d" |
1065 |
+ is_gcj && GCC_LANG+=",java" |
1066 |
+ is_go && GCC_LANG+=",go" |
1067 |
+ if is_objc || is_objcxx ; then |
1068 |
+ GCC_LANG+=",objc" |
1069 |
+ if tc_version_is_at_least "4.0" ; then |
1070 |
+ use objc-gc && confgcc+=" --enable-objc-gc" |
1071 |
+ fi |
1072 |
+ is_objcxx && GCC_LANG+=",obj-c++" |
1073 |
+ fi |
1074 |
+ is_treelang && GCC_LANG+=",treelang" |
1075 |
+ |
1076 |
+ # fortran support just got sillier! the lang value can be f77 for |
1077 |
+ # fortran77, f95 for fortran95, or just plain old fortran for the |
1078 |
+ # currently supported standard depending on gcc version. |
1079 |
+ is_fortran && GCC_LANG+=",fortran" |
1080 |
+ is_f77 && GCC_LANG+=",f77" |
1081 |
+ is_f95 && GCC_LANG+=",f95" |
1082 |
+ |
1083 |
+ # We do NOT want 'ADA support' in here! |
1084 |
+ # is_ada && GCC_LANG+=",ada" |
1085 |
+ |
1086 |
+ einfo "configuring for GCC_LANG: ${GCC_LANG}" |
1087 |
+ confgcc+=" --enable-languages=${GCC_LANG}" |
1088 |
+} |
1089 |
+ |
1090 |
+gcc_do_configure() { |
1091 |
+ local confgcc |
1092 |
+ |
1093 |
+ # Sanity check for USE=nocxx -> USE=cxx migration |
1094 |
+ if in_iuse cxx && in_iuse nocxx ; then |
1095 |
+ if (use cxx && use nocxx) || (use !cxx && use !nocxx) ; then |
1096 |
+ eerror "We are migrating USE=nocxx to USE=cxx, but your USE settings do not make" |
1097 |
+ eerror "sense. Please make sure these two flags line up logically in your setup." |
1098 |
+ die "USE='cxx nocxx' and USE='-cxx -nocxx' make no sense" |
1099 |
+ fi |
1100 |
+ fi |
1101 |
+ |
1102 |
+ # Set configuration based on path variables |
1103 |
+ confgcc+=" \ |
1104 |
+ --prefix=${PREFIX} \ |
1105 |
+ --bindir=${BINPATH} \ |
1106 |
+ --includedir=${INCLUDEPATH} \ |
1107 |
+ --datadir=${DATAPATH} \ |
1108 |
+ --mandir=${DATAPATH}/man \ |
1109 |
+ --infodir=${DATAPATH}/info \ |
1110 |
+ --with-gxx-include-dir=${STDCXX_INCDIR}" |
1111 |
+ # On Darwin we need libdir to be set in order to get correct install names |
1112 |
+ # for things like libobjc-gnu, libgcj and libfortran. If we enable it on |
1113 |
+ # non-Darwin we screw up the behaviour this eclass relies on. We in |
1114 |
+ # particular need this over --libdir for bug #255315. |
1115 |
+ [[ ${CTARGET} == *-darwin* ]] && \ |
1116 |
+ confgcc+=" --enable-version-specific-runtime-libs" |
1117 |
+ |
1118 |
+ # All our cross-compile logic goes here ! woo ! |
1119 |
+ confgcc+=" --host=${CHOST}" |
1120 |
+ if is_crosscompile || tc-is-cross-compiler ; then |
1121 |
+ # Straight from the GCC install doc: |
1122 |
+ # "GCC has code to correctly determine the correct value for target |
1123 |
+ # for nearly all native systems. Therefore, we highly recommend you |
1124 |
+ # not provide a configure target when configuring a native compiler." |
1125 |
+ confgcc+=" --target=${CTARGET}" |
1126 |
+ fi |
1127 |
+ [[ -n ${CBUILD} ]] && confgcc+=" --build=${CBUILD}" |
1128 |
+ |
1129 |
+ # ppc altivec support |
1130 |
+ confgcc+=" $(use_enable altivec)" |
1131 |
+ |
1132 |
+ # gcc has fixed-point arithmetic support in 4.3 for mips targets that can |
1133 |
+ # significantly increase compile time by several hours. This will allow |
1134 |
+ # users to control this feature in the event they need the support. |
1135 |
+ tc_version_is_at_least "4.3" && confgcc+=" $(use_enable fixed-point)" |
1136 |
+ |
1137 |
+ # Graphite support was added in 4.4, which depends on external libraries |
1138 |
+ # for optimizations. Current versions use cloog-ppl (cloog fork with Parma |
1139 |
+ # PPL backend). Sometime in the future we will use upstream cloog with the |
1140 |
+ # ISL backend (note: PPL will still be a requirement). cloog-ppl's include |
1141 |
+ # path was modified to prevent collisions between the two packages (library |
1142 |
+ # names are different). |
1143 |
+ # |
1144 |
+ # We disable the PPL version check so we can use >=ppl-0.11. |
1145 |
+ if tc_version_is_at_least "4.4"; then |
1146 |
+ confgcc+=" $(use_with graphite ppl)" |
1147 |
+ confgcc+=" $(use_with graphite cloog)" |
1148 |
+ if use graphite; then |
1149 |
+ confgcc+=" --disable-ppl-version-check" |
1150 |
+ confgcc+=" --with-cloog-include=/usr/include/cloog-ppl" |
1151 |
+ fi |
1152 |
+ fi |
1153 |
+ |
1154 |
+ # LTO support was added in 4.5, which depends upon elfutils. This allows |
1155 |
+ # users to enable that option, and pull in the additional library. In 4.6, |
1156 |
+ # the dependency is no longer required. |
1157 |
+ if tc_version_is_at_least "4.6" ; then |
1158 |
+ confgcc+=" --enable-lto" |
1159 |
+ elif tc_version_is_at_least "4.5" ; then |
1160 |
+ confgcc+=" $(use_enable lto)" |
1161 |
+ fi |
1162 |
+ |
1163 |
+ [[ $(tc-is-softfloat) == "yes" ]] && confgcc+=" --with-float=soft" |
1164 |
+ [[ $(tc-is-hardfloat) == "yes" ]] && confgcc+=" --with-float=hard" |
1165 |
+ |
1166 |
+ # Native Language Support |
1167 |
+ if use nls ; then |
1168 |
+ confgcc+=" --enable-nls --without-included-gettext" |
1169 |
+ else |
1170 |
+ confgcc+=" --disable-nls" |
1171 |
+ fi |
1172 |
+ |
1173 |
+ # reasonably sane globals (hopefully) |
1174 |
+ confgcc+=" \ |
1175 |
+ --with-system-zlib \ |
1176 |
+ --disable-werror \ |
1177 |
+ --enable-secureplt" |
1178 |
+ |
1179 |
+ gcc-compiler-configure || die |
1180 |
+ |
1181 |
+ if is_crosscompile ; then |
1182 |
+ # When building a stage1 cross-compiler (just C compiler), we have to |
1183 |
+ # disable a bunch of features or gcc goes boom |
1184 |
+ local needed_libc="" |
1185 |
+ case ${CTARGET} in |
1186 |
+ *-linux) needed_libc=no-fucking-clue;; |
1187 |
+ *-dietlibc) needed_libc=dietlibc;; |
1188 |
+ *-elf|*-eabi) needed_libc=newlib;; |
1189 |
+ *-freebsd*) needed_libc=freebsd-lib;; |
1190 |
+ *-gnu*) needed_libc=glibc;; |
1191 |
+ *-klibc) needed_libc=klibc;; |
1192 |
+ *-uclibc*) needed_libc=uclibc;; |
1193 |
+ *-cygwin) needed_libc=cygwin;; |
1194 |
+ mingw*|*-mingw*) needed_libc=mingw-runtime;; |
1195 |
+ avr) confgcc+=" --enable-shared --disable-threads";; |
1196 |
+ esac |
1197 |
+ if [[ -n ${needed_libc} ]] ; then |
1198 |
+ if ! has_version ${CATEGORY}/${needed_libc} ; then |
1199 |
+ confgcc+=" --disable-shared --disable-threads --without-headers" |
1200 |
+ elif built_with_use --hidden --missing false ${CATEGORY}/${needed_libc} crosscompile_opts_headers-only ; then |
1201 |
+ confgcc+=" --disable-shared --with-sysroot=${PREFIX}/${CTARGET}" |
1202 |
+ else |
1203 |
+ confgcc+=" --with-sysroot=${PREFIX}/${CTARGET}" |
1204 |
+ fi |
1205 |
+ fi |
1206 |
+ |
1207 |
+ tc_version_is_at_least 4.2 && confgcc+=" --disable-bootstrap" |
1208 |
+ else |
1209 |
+ if tc-is-static-only ; then |
1210 |
+ confgcc+=" --disable-shared" |
1211 |
+ else |
1212 |
+ confgcc+=" --enable-shared" |
1213 |
+ fi |
1214 |
+ case ${CHOST} in |
1215 |
+ mingw*|*-mingw*|*-cygwin) |
1216 |
+ confgcc+=" --enable-threads=win32" ;; |
1217 |
+ *) |
1218 |
+ confgcc+=" --enable-threads=posix" ;; |
1219 |
+ esac |
1220 |
+ fi |
1221 |
+ # __cxa_atexit is "essential for fully standards-compliant handling of |
1222 |
+ # destructors", but apparently requires glibc. |
1223 |
+ case ${CTARGET} in |
1224 |
+ *-uclibc*) |
1225 |
+ confgcc+=" --disable-__cxa_atexit --enable-target-optspace $(use_enable nptl tls)" |
1226 |
+ [[ ${GCCMAJOR}.${GCCMINOR} == 3.3 ]] && confgcc+=" --enable-sjlj-exceptions" |
1227 |
+ if tc_version_is_at_least 3.4 && ! tc_version_is_at_least 4.3 ; then |
1228 |
+ confgcc+=" --enable-clocale=uclibc" |
1229 |
+ fi |
1230 |
+ ;; |
1231 |
+ *-elf|*-eabi) |
1232 |
+ confgcc+=" --with-newlib" |
1233 |
+ ;; |
1234 |
+ *-gnu*) |
1235 |
+ confgcc+=" --enable-__cxa_atexit" |
1236 |
+ confgcc+=" --enable-clocale=gnu" |
1237 |
+ ;; |
1238 |
+ *-freebsd*) |
1239 |
+ confgcc+=" --enable-__cxa_atexit" |
1240 |
+ ;; |
1241 |
+ *-solaris*) |
1242 |
+ confgcc+=" --enable-__cxa_atexit" |
1243 |
+ ;; |
1244 |
+ esac |
1245 |
+ tc_version_is_at_least 3.4 || confgcc+=" --disable-libunwind-exceptions" |
1246 |
+ |
1247 |
+ # if the target can do biarch (-m32/-m64), enable it. overhead should |
1248 |
+ # be small, and should simplify building of 64bit kernels in a 32bit |
1249 |
+ # userland by not needing sys-devel/kgcc64. #349405 |
1250 |
+ case $(tc-arch) in |
1251 |
+ ppc|ppc64) tc_version_is_at_least 3.4 && confgcc+=" --enable-targets=all" ;; |
1252 |
+ sparc) tc_version_is_at_least 4.4 && confgcc+=" --enable-targets=all" ;; |
1253 |
+ amd64|x86) tc_version_is_at_least 4.3 && confgcc+=" --enable-targets=all" ;; |
1254 |
+ esac |
1255 |
+ |
1256 |
+ tc_version_is_at_least 4.3 && set -- "$@" \ |
1257 |
+ --with-bugurl=http://bugs.gentoo.org/ \ |
1258 |
+ --with-pkgversion="${BRANDING_GCC_PKGVERSION}" |
1259 |
+ set -- ${confgcc} "$@" ${EXTRA_ECONF} |
1260 |
+ |
1261 |
+ # Nothing wrong with a good dose of verbosity |
1262 |
+ echo |
1263 |
+ einfo "PREFIX: ${PREFIX}" |
1264 |
+ einfo "BINPATH: ${BINPATH}" |
1265 |
+ einfo "LIBPATH: ${LIBPATH}" |
1266 |
+ einfo "DATAPATH: ${DATAPATH}" |
1267 |
+ einfo "STDCXX_INCDIR: ${STDCXX_INCDIR}" |
1268 |
+ echo |
1269 |
+ einfo "Configuring GCC with: ${@//--/\n\t--}" |
1270 |
+ echo |
1271 |
+ |
1272 |
+ # Build in a separate build tree |
1273 |
+ mkdir -p "${WORKDIR}"/build |
1274 |
+ pushd "${WORKDIR}"/build > /dev/null |
1275 |
+ |
1276 |
+ # and now to do the actual configuration |
1277 |
+ addwrite /dev/zero |
1278 |
+ echo "${S}"/configure "$@" |
1279 |
+ "${S}"/configure "$@" || die "failed to run configure" |
1280 |
+ |
1281 |
+ # return to whatever directory we were in before |
1282 |
+ popd > /dev/null |
1283 |
+} |
1284 |
+ |
1285 |
+has toolchain_death_notice ${EBUILD_DEATH_HOOKS} || EBUILD_DEATH_HOOKS+=" toolchain_death_notice" |
1286 |
+toolchain_death_notice() { |
1287 |
+ pushd "${WORKDIR}"/build >/dev/null |
1288 |
+ tar jcf gcc-build-logs.tar.bz2 $(find -name config.log) |
1289 |
+ eerror |
1290 |
+ eerror "Please include ${PWD}/gcc-build-logs.tar.bz2 in your bug report" |
1291 |
+ eerror |
1292 |
+ popd >/dev/null |
1293 |
+} |
1294 |
+ |
1295 |
+# This function accepts one optional argument, the make target to be used. |
1296 |
+# If ommitted, gcc_do_make will try to guess whether it should use all, |
1297 |
+# profiledbootstrap, or bootstrap-lean depending on CTARGET and arch. An |
1298 |
+# example of how to use this function: |
1299 |
+# |
1300 |
+# gcc_do_make all-target-libstdc++-v3 |
1301 |
+# |
1302 |
+# In addition to the target to be used, the following variables alter the |
1303 |
+# behavior of this function: |
1304 |
+# |
1305 |
+# LDFLAGS |
1306 |
+# Flags to pass to ld |
1307 |
+# |
1308 |
+# STAGE1_CFLAGS |
1309 |
+# CFLAGS to use during stage1 of a gcc bootstrap |
1310 |
+# |
1311 |
+# BOOT_CFLAGS |
1312 |
+# CFLAGS to use during stages 2+3 of a gcc bootstrap. |
1313 |
+# |
1314 |
+# Travis Tilley <lv@g.o> (04 Sep 2004) |
1315 |
+# |
1316 |
+gcc_do_make() { |
1317 |
+ # Fix for libtool-portage.patch |
1318 |
+ local OLDS=${S} |
1319 |
+ S=${WORKDIR}/build |
1320 |
+ |
1321 |
+ # Set make target to $1 if passed |
1322 |
+ [[ -n $1 ]] && GCC_MAKE_TARGET=$1 |
1323 |
+ # default target |
1324 |
+ if is_crosscompile || tc-is-cross-compiler ; then |
1325 |
+ # 3 stage bootstrapping doesnt quite work when you cant run the |
1326 |
+ # resulting binaries natively ^^; |
1327 |
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-all} |
1328 |
+ else |
1329 |
+ GCC_MAKE_TARGET=${GCC_MAKE_TARGET-bootstrap-lean} |
1330 |
+ fi |
1331 |
+ |
1332 |
+ # the gcc docs state that parallel make isnt supported for the |
1333 |
+ # profiledbootstrap target, as collisions in profile collecting may occur. |
1334 |
+ # boundschecking also seems to introduce parallel build issues. |
1335 |
+ if [[ ${GCC_MAKE_TARGET} == "profiledbootstrap" ]] || |
1336 |
+ use_if_iuse boundschecking |
1337 |
+ then |
1338 |
+ export MAKEOPTS="${MAKEOPTS} -j1" |
1339 |
+ fi |
1340 |
+ |
1341 |
+ if [[ ${GCC_MAKE_TARGET} == "all" ]] ; then |
1342 |
+ STAGE1_CFLAGS=${STAGE1_CFLAGS-"${CFLAGS}"} |
1343 |
+ elif [[ $(gcc-version) == "3.4" && ${GCC_BRANCH_VER} == "3.4" ]] && gcc-specs-ssp ; then |
1344 |
+ # See bug #79852 |
1345 |
+ STAGE1_CFLAGS=${STAGE1_CFLAGS-"-O2"} |
1346 |
+ fi |
1347 |
+ |
1348 |
+ if is_crosscompile; then |
1349 |
+ # In 3.4, BOOT_CFLAGS is never used on a crosscompile... |
1350 |
+ # but I'll leave this in anyways as someone might have had |
1351 |
+ # some reason for putting it in here... --eradicator |
1352 |
+ BOOT_CFLAGS=${BOOT_CFLAGS-"-O2"} |
1353 |
+ else |
1354 |
+ # we only want to use the system's CFLAGS if not building a |
1355 |
+ # cross-compiler. |
1356 |
+ BOOT_CFLAGS=${BOOT_CFLAGS-"$(get_abi_CFLAGS) ${CFLAGS}"} |
1357 |
+ fi |
1358 |
+ |
1359 |
+ pushd "${WORKDIR}"/build |
1360 |
+ |
1361 |
+ emake \ |
1362 |
+ LDFLAGS="${LDFLAGS}" \ |
1363 |
+ STAGE1_CFLAGS="${STAGE1_CFLAGS}" \ |
1364 |
+ LIBPATH="${LIBPATH}" \ |
1365 |
+ BOOT_CFLAGS="${BOOT_CFLAGS}" \ |
1366 |
+ ${GCC_MAKE_TARGET} \ |
1367 |
+ || die "emake failed with ${GCC_MAKE_TARGET}" |
1368 |
+ |
1369 |
+ if ! is_crosscompile && use cxx && use doc ; then |
1370 |
+ if type -p doxygen > /dev/null ; then |
1371 |
+ if tc_version_is_at_least 4.3 ; then |
1372 |
+ cd "${CTARGET}"/libstdc++-v3/doc |
1373 |
+ emake doc-man-doxygen || ewarn "failed to make docs" |
1374 |
+ elif tc_version_is_at_least 3.0 ; then |
1375 |
+ cd "${CTARGET}"/libstdc++-v3 |
1376 |
+ emake doxygen-man || ewarn "failed to make docs" |
1377 |
+ fi |
1378 |
+ else |
1379 |
+ ewarn "Skipping libstdc++ manpage generation since you don't have doxygen installed" |
1380 |
+ fi |
1381 |
+ fi |
1382 |
+ |
1383 |
+ popd |
1384 |
+} |
1385 |
+ |
1386 |
+# This is mostly a stub function to be overwritten in an ebuild |
1387 |
+gcc_do_filter_flags() { |
1388 |
+ strip-flags |
1389 |
+ |
1390 |
+ # In general gcc does not like optimization, and add -O2 where |
1391 |
+ # it is safe. This is especially true for gcc 3.3 + 3.4 |
1392 |
+ replace-flags -O? -O2 |
1393 |
+ |
1394 |
+ # ... sure, why not? |
1395 |
+ strip-unsupported-flags |
1396 |
+ |
1397 |
+ # dont want to funk ourselves |
1398 |
+ filter-flags '-mabi*' -m31 -m32 -m64 |
1399 |
+ |
1400 |
+ case ${GCC_BRANCH_VER} in |
1401 |
+ 3.2|3.3) |
1402 |
+ replace-cpu-flags k8 athlon64 opteron i686 x86-64 |
1403 |
+ replace-cpu-flags pentium-m pentium3m pentium3 |
1404 |
+ case $(tc-arch) in |
1405 |
+ amd64|x86) filter-flags '-mtune=*' ;; |
1406 |
+ # in gcc 3.3 there is a bug on ppc64 where if -mcpu is used, |
1407 |
+ # the compiler wrongly assumes a 32bit target |
1408 |
+ ppc64) filter-flags "-mcpu=*";; |
1409 |
+ esac |
1410 |
+ case $(tc-arch) in |
1411 |
+ amd64) replace-cpu-flags core2 nocona;; |
1412 |
+ x86) replace-cpu-flags core2 prescott;; |
1413 |
+ esac |
1414 |
+ |
1415 |
+ replace-cpu-flags G3 750 |
1416 |
+ replace-cpu-flags G4 7400 |
1417 |
+ replace-cpu-flags G5 7400 |
1418 |
+ |
1419 |
+ # XXX: should add a sed or something to query all supported flags |
1420 |
+ # from the gcc source and trim everything else ... |
1421 |
+ filter-flags -f{no-,}unit-at-a-time -f{no-,}web -mno-tls-direct-seg-refs |
1422 |
+ filter-flags -f{no-,}stack-protector{,-all} |
1423 |
+ filter-flags -fvisibility-inlines-hidden -fvisibility=hidden |
1424 |
+ ;; |
1425 |
+ 3.4|4.*) |
1426 |
+ case $(tc-arch) in |
1427 |
+ x86|amd64) filter-flags '-mcpu=*';; |
1428 |
+ *-macos) |
1429 |
+ # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25127 |
1430 |
+ [[ ${GCC_BRANCH_VER} == 4.0 || ${GCC_BRANCH_VER} == 4.1 ]] && \ |
1431 |
+ filter-flags '-mcpu=*' '-march=*' '-mtune=*' |
1432 |
+ ;; |
1433 |
+ esac |
1434 |
+ ;; |
1435 |
+ esac |
1436 |
+ |
1437 |
+ # Compile problems with these (bug #6641 among others)... |
1438 |
+ #filter-flags "-fno-exceptions -fomit-frame-pointer -fforce-addr" |
1439 |
+ |
1440 |
+ # CFLAGS logic (verified with 3.4.3): |
1441 |
+ # CFLAGS: |
1442 |
+ # This conflicts when creating a crosscompiler, so set to a sane |
1443 |
+ # default in this case: |
1444 |
+ # used in ./configure and elsewhere for the native compiler |
1445 |
+ # used by gcc when creating libiberty.a |
1446 |
+ # used by xgcc when creating libstdc++ (and probably others)! |
1447 |
+ # this behavior should be removed... |
1448 |
+ # |
1449 |
+ # CXXFLAGS: |
1450 |
+ # used by xgcc when creating libstdc++ |
1451 |
+ # |
1452 |
+ # STAGE1_CFLAGS (not used in creating a crosscompile gcc): |
1453 |
+ # used by ${CHOST}-gcc for building stage1 compiler |
1454 |
+ # |
1455 |
+ # BOOT_CFLAGS (not used in creating a crosscompile gcc): |
1456 |
+ # used by xgcc for building stage2/3 compiler |
1457 |
+ |
1458 |
+ if is_crosscompile ; then |
1459 |
+ # Set this to something sane for both native and target |
1460 |
+ CFLAGS="-O2 -pipe" |
1461 |
+ |
1462 |
+ local VAR="CFLAGS_"${CTARGET//-/_} |
1463 |
+ CXXFLAGS=${!VAR} |
1464 |
+ fi |
1465 |
+ |
1466 |
+ export GCJFLAGS=${GCJFLAGS:-${CFLAGS}} |
1467 |
+} |
1468 |
+ |
1469 |
+toolchain_src_compile() { |
1470 |
+ multilib_env ${CTARGET} |
1471 |
+ gcc_do_filter_flags |
1472 |
+ einfo "CFLAGS=\"${CFLAGS}\"" |
1473 |
+ einfo "CXXFLAGS=\"${CXXFLAGS}\"" |
1474 |
+ |
1475 |
+ # Force internal zip based jar script to avoid random |
1476 |
+ # issues with 3rd party jar implementations. #384291 |
1477 |
+ export JAR=no |
1478 |
+ |
1479 |
+ # For hardened gcc 4.3 piepatchset to build the hardened specs |
1480 |
+ # file (build.specs) to use when building gcc. |
1481 |
+ if ! tc_version_is_at_least 4.4 && want_minispecs ; then |
1482 |
+ setup_minispecs_gcc_build_specs |
1483 |
+ fi |
1484 |
+ # Build in a separate build tree |
1485 |
+ mkdir -p "${WORKDIR}"/build |
1486 |
+ pushd "${WORKDIR}"/build > /dev/null |
1487 |
+ |
1488 |
+ einfo "Configuring ${PN} ..." |
1489 |
+ gcc_do_configure |
1490 |
+ |
1491 |
+ touch "${S}"/gcc/c-gperf.h |
1492 |
+ |
1493 |
+ # Do not make manpages if we do not have perl ... |
1494 |
+ [[ ! -x /usr/bin/perl ]] \ |
1495 |
+ && find "${WORKDIR}"/build -name '*.[17]' | xargs touch |
1496 |
+ |
1497 |
+ einfo "Compiling ${PN} ..." |
1498 |
+ gcc_do_make ${GCC_MAKE_TARGET} |
1499 |
+ |
1500 |
+ popd > /dev/null |
1501 |
+} |
1502 |
+ |
1503 |
+toolchain_src_test() { |
1504 |
+ cd "${WORKDIR}"/build |
1505 |
+ emake -k check || ewarn "check failed and that sucks :(" |
1506 |
+} |
1507 |
+ |
1508 |
+toolchain_src_install() { |
1509 |
+ local x= |
1510 |
+ |
1511 |
+ cd "${WORKDIR}"/build |
1512 |
+ # Do allow symlinks in private gcc include dir as this can break the build |
1513 |
+ find gcc/include*/ -type l -print0 | xargs -0 rm -f |
1514 |
+ # Remove generated headers, as they can cause things to break |
1515 |
+ # (ncurses, openssl, etc). |
1516 |
+ for x in $(find gcc/include*/ -name '*.h') ; do |
1517 |
+ grep -q 'It has been auto-edited by fixincludes from' "${x}" \ |
1518 |
+ && rm -f "${x}" |
1519 |
+ done |
1520 |
+ # Do the 'make install' from the build directory |
1521 |
+ S=${WORKDIR}/build \ |
1522 |
+ emake -j1 DESTDIR="${D}" install || die |
1523 |
+ # Punt some tools which are really only useful while building gcc |
1524 |
+ find "${D}" -name install-tools -prune -type d -exec rm -rf "{}" \; |
1525 |
+ # This one comes with binutils |
1526 |
+ find "${D}" -name libiberty.a -exec rm -f "{}" \; |
1527 |
+ |
1528 |
+ # Move the libraries to the proper location |
1529 |
+ gcc_movelibs |
1530 |
+ |
1531 |
+ # Basic sanity check |
1532 |
+ if ! is_crosscompile ; then |
1533 |
+ local EXEEXT |
1534 |
+ eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log) |
1535 |
+ [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${D}" |
1536 |
+ fi |
1537 |
+ |
1538 |
+ dodir /etc/env.d/gcc |
1539 |
+ create_gcc_env_entry |
1540 |
+ |
1541 |
+ # Setup the gcc_env_entry for hardened gcc 4 with minispecs |
1542 |
+ if want_minispecs ; then |
1543 |
+ copy_minispecs_gcc_specs |
1544 |
+ fi |
1545 |
+ # Make sure we dont have stuff lying around that |
1546 |
+ # can nuke multiple versions of gcc |
1547 |
+ |
1548 |
+ gcc_slot_java |
1549 |
+ |
1550 |
+ # These should be symlinks |
1551 |
+ dodir /usr/bin |
1552 |
+ cd "${D}"${BINPATH} |
1553 |
+ # Ugh: we really need to auto-detect this list. |
1554 |
+ # It's constantly out of date. |
1555 |
+ for x in cpp gcc g++ c++ gcov g77 gcj gcjh gfortran gccgo ; do |
1556 |
+ # For some reason, g77 gets made instead of ${CTARGET}-g77... |
1557 |
+ # this should take care of that |
1558 |
+ [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x} |
1559 |
+ |
1560 |
+ if [[ -f ${CTARGET}-${x} ]] ; then |
1561 |
+ if ! is_crosscompile ; then |
1562 |
+ ln -sf ${CTARGET}-${x} ${x} |
1563 |
+ dosym ${BINPATH}/${CTARGET}-${x} \ |
1564 |
+ /usr/bin/${x}-${GCC_CONFIG_VER} |
1565 |
+ fi |
1566 |
+ |
1567 |
+ # Create version-ed symlinks |
1568 |
+ dosym ${BINPATH}/${CTARGET}-${x} \ |
1569 |
+ /usr/bin/${CTARGET}-${x}-${GCC_CONFIG_VER} |
1570 |
+ fi |
1571 |
+ |
1572 |
+ if [[ -f ${CTARGET}-${x}-${GCC_CONFIG_VER} ]] ; then |
1573 |
+ rm -f ${CTARGET}-${x}-${GCC_CONFIG_VER} |
1574 |
+ ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_CONFIG_VER} |
1575 |
+ fi |
1576 |
+ done |
1577 |
+ |
1578 |
+ # Now do the fun stripping stuff |
1579 |
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}" |
1580 |
+ env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}" |
1581 |
+ # gcc used to install helper binaries in lib/ but then moved to libexec/ |
1582 |
+ [[ -d ${D}${PREFIX}/libexec/gcc ]] && \ |
1583 |
+ env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}" |
1584 |
+ |
1585 |
+ cd "${S}" |
1586 |
+ if is_crosscompile; then |
1587 |
+ rm -rf "${D}"/usr/share/{man,info} |
1588 |
+ rm -rf "${D}"${DATAPATH}/{man,info} |
1589 |
+ else |
1590 |
+ local cxx_mandir=$(find "${WORKDIR}/build/${CTARGET}/libstdc++-v3" -name man) |
1591 |
+ if [[ -d ${cxx_mandir} ]] ; then |
1592 |
+ # clean bogus manpages #113902 |
1593 |
+ find "${cxx_mandir}" -name '*_build_*' -exec rm {} \; |
1594 |
+ cp -r "${cxx_mandir}"/man? "${D}/${DATAPATH}"/man/ |
1595 |
+ fi |
1596 |
+ has noinfo ${FEATURES} \ |
1597 |
+ && rm -r "${D}/${DATAPATH}"/info \ |
1598 |
+ || prepinfo "${DATAPATH}" |
1599 |
+ has noman ${FEATURES} \ |
1600 |
+ && rm -r "${D}/${DATAPATH}"/man \ |
1601 |
+ || prepman "${DATAPATH}" |
1602 |
+ fi |
1603 |
+ # prune empty dirs left behind |
1604 |
+ find "${D}" -depth -type d -delete 2>/dev/null |
1605 |
+ |
1606 |
+ # install testsuite results |
1607 |
+ if use test; then |
1608 |
+ docinto testsuite |
1609 |
+ find "${WORKDIR}"/build -type f -name "*.sum" -print0 | xargs -0 dodoc |
1610 |
+ find "${WORKDIR}"/build -type f -path "*/testsuite/*.log" -print0 \ |
1611 |
+ | xargs -0 dodoc |
1612 |
+ fi |
1613 |
+ |
1614 |
+ # Rather install the script, else portage with changing $FILESDIR |
1615 |
+ # between binary and source package borks things .... |
1616 |
+ if ! is_crosscompile ; then |
1617 |
+ insinto "${DATAPATH}" |
1618 |
+ if tc_version_is_at_least 4.0 ; then |
1619 |
+ newins "${GCC_FILESDIR}"/awk/fixlafiles.awk-no_gcc_la fixlafiles.awk || die |
1620 |
+ find "${D}/${LIBPATH}" -name libstdc++.la -type f -exec rm "{}" \; |
1621 |
+ else |
1622 |
+ doins "${GCC_FILESDIR}"/awk/fixlafiles.awk || die |
1623 |
+ fi |
1624 |
+ exeinto "${DATAPATH}" |
1625 |
+ doexe "${GCC_FILESDIR}"/fix_libtool_files.sh || die |
1626 |
+ doexe "${GCC_FILESDIR}"/c{89,99} || die |
1627 |
+ fi |
1628 |
+ |
1629 |
+ # Use gid of 0 because some stupid ports don't have |
1630 |
+ # the group 'root' set to gid 0. Send to /dev/null |
1631 |
+ # for people who are testing as non-root. |
1632 |
+ chown -R root:0 "${D}"${LIBPATH} 2>/dev/null |
1633 |
+ |
1634 |
+ # Move pretty-printers to gdb datadir to shut ldconfig up |
1635 |
+ local py gdbdir=/usr/share/gdb/auto-load${LIBPATH/\/lib\//\/$(get_libdir)\/} |
1636 |
+ pushd "${D}"${LIBPATH} >/dev/null |
1637 |
+ for py in $(find . -name '*-gdb.py') ; do |
1638 |
+ local multidir=${py%/*} |
1639 |
+ insinto "${gdbdir}/${multidir}" |
1640 |
+ sed -i "/^libdir =/s:=.*:= '${LIBPATH}/${multidir}':" "${py}" || die #348128 |
1641 |
+ doins "${py}" || die |
1642 |
+ rm "${py}" || die |
1643 |
+ done |
1644 |
+ popd >/dev/null |
1645 |
+ |
1646 |
+ # Don't scan .gox files for executable stacks - false positives |
1647 |
+ export QA_EXECSTACK="usr/lib*/go/*/*.gox" |
1648 |
+ export QA_WX_LOAD="usr/lib*/go/*/*.gox" |
1649 |
+ |
1650 |
+ # Disable RANDMMAP so PCH works. #301299 |
1651 |
+ if tc_version_is_at_least 4.3 ; then |
1652 |
+ pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1" |
1653 |
+ pax-mark -r "${D}${PREFIX}/libexec/gcc/${CTARGET}/${GCC_CONFIG_VER}/cc1plus" |
1654 |
+ fi |
1655 |
+} |
1656 |
+ |
1657 |
+gcc_slot_java() { |
1658 |
+ local x |
1659 |
+ |
1660 |
+ # Move Java headers to compiler-specific dir |
1661 |
+ for x in "${D}"${PREFIX}/include/gc*.h "${D}"${PREFIX}/include/j*.h ; do |
1662 |
+ [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/include/ |
1663 |
+ done |
1664 |
+ for x in gcj gnu java javax org ; do |
1665 |
+ if [[ -d ${D}${PREFIX}/include/${x} ]] ; then |
1666 |
+ dodir /${LIBPATH}/include/${x} |
1667 |
+ mv -f "${D}"${PREFIX}/include/${x}/* "${D}"${LIBPATH}/include/${x}/ |
1668 |
+ rm -rf "${D}"${PREFIX}/include/${x} |
1669 |
+ fi |
1670 |
+ done |
1671 |
+ |
1672 |
+ if [[ -d ${D}${PREFIX}/lib/security ]] || [[ -d ${D}${PREFIX}/$(get_libdir)/security ]] ; then |
1673 |
+ dodir /${LIBPATH}/security |
1674 |
+ mv -f "${D}"${PREFIX}/lib*/security/* "${D}"${LIBPATH}/security |
1675 |
+ rm -rf "${D}"${PREFIX}/lib*/security |
1676 |
+ fi |
1677 |
+ |
1678 |
+ # Move random gcj files to compiler-specific directories |
1679 |
+ for x in libgcj.spec logging.properties ; do |
1680 |
+ x="${D}${PREFIX}/lib/${x}" |
1681 |
+ [[ -f ${x} ]] && mv -f "${x}" "${D}"${LIBPATH}/ |
1682 |
+ done |
1683 |
+ |
1684 |
+ # SLOT up libgcj.pc if it's available (and let gcc-config worry about links) |
1685 |
+ for x in "${D}"${PREFIX}/lib*/pkgconfig/libgcj*.pc ; do |
1686 |
+ [[ -f ${x} ]] || continue |
1687 |
+ sed -i "/^libdir=/s:=.*:=${LIBPATH}:" "${x}" |
1688 |
+ mv "${x}" "${D}"/usr/lib/pkgconfig/libgcj-${GCC_PV}.pc || die |
1689 |
+ done |
1690 |
+ |
1691 |
+ # Rename jar because it could clash with Kaffe's jar if this gcc is |
1692 |
+ # primary compiler (aka don't have the -<version> extension) |
1693 |
+ cd "${D}"${BINPATH} |
1694 |
+ [[ -f jar ]] && mv -f jar gcj-jar |
1695 |
+} |
1696 |
+ |
1697 |
+# Move around the libs to the right location. For some reason, |
1698 |
+# when installing gcc, it dumps internal libraries into /usr/lib |
1699 |
+# instead of the private gcc lib path |
1700 |
+gcc_movelibs() { |
1701 |
+ # older versions of gcc did not support --print-multi-os-directory |
1702 |
+ tc_version_is_at_least 3.0 || return 0 |
1703 |
+ |
1704 |
+ local multiarg removedirs="" |
1705 |
+ for multiarg in $($(XGCC) -print-multi-lib) ; do |
1706 |
+ multiarg=${multiarg#*;} |
1707 |
+ multiarg=${multiarg//@/ -} |
1708 |
+ |
1709 |
+ local OS_MULTIDIR=$($(XGCC) ${multiarg} --print-multi-os-directory) |
1710 |
+ local MULTIDIR=$($(XGCC) ${multiarg} --print-multi-directory) |
1711 |
+ local TODIR=${D}${LIBPATH}/${MULTIDIR} |
1712 |
+ local FROMDIR= |
1713 |
+ |
1714 |
+ [[ -d ${TODIR} ]] || mkdir -p ${TODIR} |
1715 |
+ |
1716 |
+ for FROMDIR in \ |
1717 |
+ ${LIBPATH}/${OS_MULTIDIR} \ |
1718 |
+ ${LIBPATH}/../${MULTIDIR} \ |
1719 |
+ ${PREFIX}/lib/${OS_MULTIDIR} \ |
1720 |
+ ${PREFIX}/${CTARGET}/lib/${OS_MULTIDIR} |
1721 |
+ do |
1722 |
+ removedirs="${removedirs} ${FROMDIR}" |
1723 |
+ FROMDIR=${D}${FROMDIR} |
1724 |
+ if [[ ${FROMDIR} != "${TODIR}" && -d ${FROMDIR} ]] ; then |
1725 |
+ local files=$(find "${FROMDIR}" -maxdepth 1 ! -type d 2>/dev/null) |
1726 |
+ if [[ -n ${files} ]] ; then |
1727 |
+ mv ${files} "${TODIR}" |
1728 |
+ fi |
1729 |
+ fi |
1730 |
+ done |
1731 |
+ fix_libtool_libdir_paths "${LIBPATH}/${MULTIDIR}" |
1732 |
+ done |
1733 |
+ |
1734 |
+ # We remove directories separately to avoid this case: |
1735 |
+ # mv SRC/lib/../lib/*.o DEST |
1736 |
+ # rmdir SRC/lib/../lib/ |
1737 |
+ # mv SRC/lib/../lib32/*.o DEST # Bork |
1738 |
+ for FROMDIR in ${removedirs} ; do |
1739 |
+ rmdir "${D}"${FROMDIR} >& /dev/null |
1740 |
+ done |
1741 |
+ find "${D}" -type d | xargs rmdir >& /dev/null |
1742 |
+} |
1743 |
+ |
1744 |
+#----<< src_* >>---- |
1745 |
+ |
1746 |
+#---->> unorganized crap in need of refactoring follows |
1747 |
+ |
1748 |
+# gcc_quick_unpack will unpack the gcc tarball and patches in a way that is |
1749 |
+# consistant with the behavior of get_gcc_src_uri. The only patch it applies |
1750 |
+# itself is the branch update if present. |
1751 |
+# |
1752 |
+# Travis Tilley <lv@g.o> (03 Sep 2004) |
1753 |
+# |
1754 |
+gcc_quick_unpack() { |
1755 |
+ pushd "${WORKDIR}" > /dev/null |
1756 |
+ export PATCH_GCC_VER=${PATCH_GCC_VER:-${GCC_RELEASE_VER}} |
1757 |
+ export UCLIBC_GCC_VER=${UCLIBC_GCC_VER:-${PATCH_GCC_VER}} |
1758 |
+ export PIE_GCC_VER=${PIE_GCC_VER:-${GCC_RELEASE_VER}} |
1759 |
+ export HTB_GCC_VER=${HTB_GCC_VER:-${GCC_RELEASE_VER}} |
1760 |
+ export SPECS_GCC_VER=${SPECS_GCC_VER:-${GCC_RELEASE_VER}} |
1761 |
+ |
1762 |
+ if [[ -n ${GCC_A_FAKEIT} ]] ; then |
1763 |
+ unpack ${GCC_A_FAKEIT} |
1764 |
+ elif [[ -n ${PRERELEASE} ]] ; then |
1765 |
+ unpack gcc-${PRERELEASE}.tar.bz2 |
1766 |
+ elif [[ -n ${SNAPSHOT} ]] ; then |
1767 |
+ unpack gcc-${SNAPSHOT}.tar.bz2 |
1768 |
+ elif [[ ${PV} != *9999* ]] ; then |
1769 |
+ unpack gcc-${GCC_RELEASE_VER}.tar.bz2 |
1770 |
+ # We want branch updates to be against a release tarball |
1771 |
+ if [[ -n ${BRANCH_UPDATE} ]] ; then |
1772 |
+ pushd "${S}" > /dev/null |
1773 |
+ epatch "${DISTDIR}"/gcc-${GCC_RELEASE_VER}-branch-update-${BRANCH_UPDATE}.patch.bz2 |
1774 |
+ popd > /dev/null |
1775 |
+ fi |
1776 |
+ fi |
1777 |
+ |
1778 |
+ if [[ -n ${D_VER} ]] && use d ; then |
1779 |
+ pushd "${S}"/gcc > /dev/null |
1780 |
+ unpack gdc-${D_VER}-src.tar.bz2 |
1781 |
+ cd .. |
1782 |
+ ebegin "Adding support for the D language" |
1783 |
+ ./gcc/d/setup-gcc.sh >& "${T}"/dgcc.log |
1784 |
+ if ! eend $? ; then |
1785 |
+ eerror "The D gcc package failed to apply" |
1786 |
+ eerror "Please include this log file when posting a bug report:" |
1787 |
+ eerror " ${T}/dgcc.log" |
1788 |
+ die "failed to include the D language" |
1789 |
+ fi |
1790 |
+ popd > /dev/null |
1791 |
+ fi |
1792 |
+ |
1793 |
+ [[ -n ${PATCH_VER} ]] && \ |
1794 |
+ unpack gcc-${PATCH_GCC_VER}-patches-${PATCH_VER}.tar.bz2 |
1795 |
+ |
1796 |
+ [[ -n ${UCLIBC_VER} ]] && \ |
1797 |
+ unpack gcc-${UCLIBC_GCC_VER}-uclibc-patches-${UCLIBC_VER}.tar.bz2 |
1798 |
+ |
1799 |
+ if want_pie ; then |
1800 |
+ if [[ -n ${PIE_CORE} ]] ; then |
1801 |
+ unpack ${PIE_CORE} |
1802 |
+ else |
1803 |
+ unpack gcc-${PIE_GCC_VER}-piepatches-v${PIE_VER}.tar.bz2 |
1804 |
+ fi |
1805 |
+ [[ -n ${SPECS_VER} ]] && \ |
1806 |
+ unpack gcc-${SPECS_GCC_VER}-specs-${SPECS_VER}.tar.bz2 |
1807 |
+ fi |
1808 |
+ |
1809 |
+ use_if_iuse boundschecking && unpack "bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch.bz2" |
1810 |
+ |
1811 |
+ popd > /dev/null |
1812 |
+} |
1813 |
+ |
1814 |
+do_gcc_HTB_patches() { |
1815 |
+ use_if_iuse boundschecking || return 0 |
1816 |
+ |
1817 |
+ # modify the bounds checking patch with a regression patch |
1818 |
+ epatch "${WORKDIR}/bounds-checking-gcc-${HTB_GCC_VER}-${HTB_VER}.patch" |
1819 |
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, HTB-${HTB_GCC_VER}-${HTB_VER}" |
1820 |
+} |
1821 |
+ |
1822 |
+# do various updates to PIE logic |
1823 |
+do_gcc_PIE_patches() { |
1824 |
+ want_pie || return 0 |
1825 |
+ |
1826 |
+ use vanilla && return 0 |
1827 |
+ |
1828 |
+ if tc_version_is_at_least 4.3.2; then |
1829 |
+ guess_patch_type_in_dir "${WORKDIR}"/piepatch/ |
1830 |
+ EPATCH_MULTI_MSG="Applying pie patches ..." \ |
1831 |
+ epatch "${WORKDIR}"/piepatch/ |
1832 |
+ else |
1833 |
+ guess_patch_type_in_dir "${WORKDIR}"/piepatch/upstream |
1834 |
+ |
1835 |
+ # corrects startfile/endfile selection and shared/static/pie flag usage |
1836 |
+ EPATCH_MULTI_MSG="Applying upstream pie patches ..." \ |
1837 |
+ epatch "${WORKDIR}"/piepatch/upstream |
1838 |
+ # adds non-default pie support (rs6000) |
1839 |
+ EPATCH_MULTI_MSG="Applying non-default pie patches ..." \ |
1840 |
+ epatch "${WORKDIR}"/piepatch/nondef |
1841 |
+ # adds default pie support (rs6000 too) if DEFAULT_PIE[_SSP] is defined |
1842 |
+ EPATCH_MULTI_MSG="Applying default pie patches ..." \ |
1843 |
+ epatch "${WORKDIR}"/piepatch/def |
1844 |
+ fi |
1845 |
+ |
1846 |
+ # we want to be able to control the pie patch logic via something other |
1847 |
+ # than ALL_CFLAGS... |
1848 |
+ sed -e '/^ALL_CFLAGS/iHARD_CFLAGS = ' \ |
1849 |
+ -e 's|^ALL_CFLAGS = |ALL_CFLAGS = $(HARD_CFLAGS) |' \ |
1850 |
+ -i "${S}"/gcc/Makefile.in |
1851 |
+ # Need to add HARD_CFLAGS to ALL_CXXFLAGS on >= 4.7 |
1852 |
+ if tc_version_is_at_least 4.7.0 ; then |
1853 |
+ sed -e '/^ALL_CXXFLAGS/iHARD_CFLAGS = ' \ |
1854 |
+ -e 's|^ALL_CXXFLAGS = |ALL_CXXFLAGS = $(HARD_CFLAGS) |' \ |
1855 |
+ -i "${S}"/gcc/Makefile.in |
1856 |
+ fi |
1857 |
+ |
1858 |
+ BRANDING_GCC_PKGVERSION="${BRANDING_GCC_PKGVERSION}, pie-${PIE_VER}" |
1859 |
+} |
1860 |
+ |
1861 |
+should_we_gcc_config() { |
1862 |
+ # we always want to run gcc-config if we're bootstrapping, otherwise |
1863 |
+ # we might get stuck with the c-only stage1 compiler |
1864 |
+ use bootstrap && return 0 |
1865 |
+ use build && return 0 |
1866 |
+ |
1867 |
+ # if the current config is invalid, we definitely want a new one |
1868 |
+ # Note: due to bash quirkiness, the following must not be 1 line |
1869 |
+ local curr_config |
1870 |
+ curr_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>&1) || return 0 |
1871 |
+ |
1872 |
+ # if the previously selected config has the same major.minor (branch) as |
1873 |
+ # the version we are installing, then it will probably be uninstalled |
1874 |
+ # for being in the same SLOT, make sure we run gcc-config. |
1875 |
+ local curr_config_ver=$(env -i ROOT="${ROOT}" gcc-config -S ${curr_config} | awk '{print $2}') |
1876 |
+ |
1877 |
+ local curr_branch_ver=$(get_version_component_range 1-2 ${curr_config_ver}) |
1878 |
+ |
1879 |
+ # If we're using multislot, just run gcc-config if we're installing |
1880 |
+ # to the same profile as the current one. |
1881 |
+ use multislot && return $([[ ${curr_config_ver} == ${GCC_CONFIG_VER} ]]) |
1882 |
+ |
1883 |
+ if [[ ${curr_branch_ver} == ${GCC_BRANCH_VER} ]] ; then |
1884 |
+ return 0 |
1885 |
+ else |
1886 |
+ # if we're installing a genuinely different compiler version, |
1887 |
+ # we should probably tell the user -how- to switch to the new |
1888 |
+ # gcc version, since we're not going to do it for him/her. |
1889 |
+ # We don't want to switch from say gcc-3.3 to gcc-3.4 right in |
1890 |
+ # the middle of an emerge operation (like an 'emerge -e world' |
1891 |
+ # which could install multiple gcc versions). |
1892 |
+ einfo "The current gcc config appears valid, so it will not be" |
1893 |
+ einfo "automatically switched for you. If you would like to" |
1894 |
+ einfo "switch to the newly installed gcc version, do the" |
1895 |
+ einfo "following:" |
1896 |
+ echo |
1897 |
+ einfo "gcc-config ${CTARGET}-${GCC_CONFIG_VER}" |
1898 |
+ einfo "source /etc/profile" |
1899 |
+ echo |
1900 |
+ ebeep |
1901 |
+ return 1 |
1902 |
+ fi |
1903 |
+} |
1904 |
+ |
1905 |
+do_gcc_config() { |
1906 |
+ if ! should_we_gcc_config ; then |
1907 |
+ env -i ROOT="${ROOT}" gcc-config --use-old --force |
1908 |
+ return 0 |
1909 |
+ fi |
1910 |
+ |
1911 |
+ local current_gcc_config="" current_specs="" use_specs="" |
1912 |
+ |
1913 |
+ current_gcc_config=$(env -i ROOT="${ROOT}" gcc-config -c ${CTARGET} 2>/dev/null) |
1914 |
+ if [[ -n ${current_gcc_config} ]] ; then |
1915 |
+ # figure out which specs-specific config is active |
1916 |
+ current_specs=$(gcc-config -S ${current_gcc_config} | awk '{print $3}') |
1917 |
+ [[ -n ${current_specs} ]] && use_specs=-${current_specs} |
1918 |
+ fi |
1919 |
+ if [[ -n ${use_specs} ]] && \ |
1920 |
+ [[ ! -e ${ROOT}/etc/env.d/gcc/${CTARGET}-${GCC_CONFIG_VER}${use_specs} ]] |
1921 |
+ then |
1922 |
+ ewarn "The currently selected specs-specific gcc config," |
1923 |
+ ewarn "${current_specs}, doesn't exist anymore. This is usually" |
1924 |
+ ewarn "due to enabling/disabling hardened or switching to a version" |
1925 |
+ ewarn "of gcc that doesnt create multiple specs files. The default" |
1926 |
+ ewarn "config will be used, and the previous preference forgotten." |
1927 |
+ ebeep |
1928 |
+ epause |
1929 |
+ use_specs="" |
1930 |
+ fi |
1931 |
+ |
1932 |
+ gcc-config ${CTARGET}-${GCC_CONFIG_VER}${use_specs} |
1933 |
+} |
1934 |
+ |
1935 |
+# This function allows us to gentoo-ize gcc's version number and bugzilla |
1936 |
+# URL without needing to use patches. |
1937 |
+gcc_version_patch() { |
1938 |
+ # gcc-4.3+ has configure flags (whoo!) |
1939 |
+ tc_version_is_at_least 4.3 && return 0 |
1940 |
+ |
1941 |
+ local version_string=${GCC_CONFIG_VER} |
1942 |
+ [[ -n ${BRANCH_UPDATE} ]] && version_string+=" ${BRANCH_UPDATE}" |
1943 |
+ |
1944 |
+ einfo "patching gcc version: ${version_string} (${BRANDING_GCC_PKGVERSION})" |
1945 |
+ |
1946 |
+ local gcc_sed=( -e 's:gcc\.gnu\.org/bugs\.html:bugs\.gentoo\.org/:' ) |
1947 |
+ if grep -qs VERSUFFIX "${S}"/gcc/version.c ; then |
1948 |
+ gcc_sed+=( -e "/VERSUFFIX \"\"/s:\"\":\" (${BRANDING_GCC_PKGVERSION})\":" ) |
1949 |
+ else |
1950 |
+ version_string="${version_string} (${BRANDING_GCC_PKGVERSION})" |
1951 |
+ gcc_sed+=( -e "/const char version_string\[\] = /s:= \".*\":= \"${version_string}\":" ) |
1952 |
+ fi |
1953 |
+ sed -i "${gcc_sed[@]}" "${S}"/gcc/version.c || die |
1954 |
+} |
1955 |
+ |
1956 |
+# This is a historical wart. The original Gentoo/amd64 port used: |
1957 |
+# lib32 - 32bit binaries (x86) |
1958 |
+# lib64 - 64bit binaries (x86_64) |
1959 |
+# lib - "native" binaries (a symlink to lib64) |
1960 |
+# Most other distros use the logic (including mainline gcc): |
1961 |
+# lib - 32bit binaries (x86) |
1962 |
+# lib64 - 64bit binaries (x86_64) |
1963 |
+# Over time, Gentoo is migrating to the latter form. |
1964 |
+# |
1965 |
+# Unfortunately, due to distros picking the lib32 behavior, newer gcc |
1966 |
+# versions will dynamically detect whether to use lib or lib32 for its |
1967 |
+# 32bit multilib. So, to keep the automagic from getting things wrong |
1968 |
+# while people are transitioning from the old style to the new style, |
1969 |
+# we always set the MULTILIB_OSDIRNAMES var for relevant targets. |
1970 |
+setup_multilib_osdirnames() { |
1971 |
+ is_multilib || return 0 |
1972 |
+ |
1973 |
+ local config |
1974 |
+ local libdirs="../lib64 ../lib32" |
1975 |
+ |
1976 |
+ # this only makes sense for some Linux targets |
1977 |
+ case ${CTARGET} in |
1978 |
+ x86_64*-linux*) config="i386" ;; |
1979 |
+ powerpc64*-linux*) config="rs6000" ;; |
1980 |
+ sparc64*-linux*) config="sparc" ;; |
1981 |
+ s390x*-linux*) config="s390" ;; |
1982 |
+ *) return 0 ;; |
1983 |
+ esac |
1984 |
+ config+="/t-linux64" |
1985 |
+ |
1986 |
+ if [[ ${SYMLINK_LIB} == "yes" ]] ; then |
1987 |
+ einfo "updating multilib directories to be: ${libdirs}" |
1988 |
+ # drop the 4.6.2 stuff once 4.7 goes stable |
1989 |
+ if tc_version_is_at_least 4.7 || |
1990 |
+ ( tc_version_is_at_least 4.6.2 && has x32 $(get_all_abis) ) |
1991 |
+ then |
1992 |
+ set -- -e '/^MULTILIB_OSDIRNAMES.*lib32/s:[$][(]if.*):../lib32:' |
1993 |
+ else |
1994 |
+ set -- -e "/^MULTILIB_OSDIRNAMES/s:=.*:= ${libdirs}:" |
1995 |
+ fi |
1996 |
+ else |
1997 |
+ einfo "using upstream multilib; disabling lib32 autodetection" |
1998 |
+ set -- -r -e 's:[$][(]if.*,(.*)[)]:\1:' |
1999 |
+ fi |
2000 |
+ sed -i "$@" "${S}"/gcc/config/${config} || die |
2001 |
+} |
2002 |
+ |
2003 |
+disable_multilib_libjava() { |
2004 |
+ # We dont want a multilib libjava, so lets use this hack taken from fedora |
2005 |
+ sed -i -r \ |
2006 |
+ -e 's/^((all:) all-redirect)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2007 |
+ -e 's/^((install:) install-redirect)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2008 |
+ -e 's/^((check:) check-redirect)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2009 |
+ -e 's/^((all:) all-recursive)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2010 |
+ -e 's/^((install:) install-recursive)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2011 |
+ -e 's/^((check:) check-recursive)/ifeq (\$(MULTISUBDIR),)\n\1\nelse\n\2\n\techo Multilib libjava disabled\nendif/' \ |
2012 |
+ "${S}"/libjava/Makefile.in || die |
2013 |
+} |
2014 |
+ |
2015 |
+# make sure the libtool archives have libdir set to where they actually |
2016 |
+# -are-, and not where they -used- to be. also, any dependencies we have |
2017 |
+# on our own .la files need to be updated. |
2018 |
+fix_libtool_libdir_paths() { |
2019 |
+ pushd "${D}" >/dev/null |
2020 |
+ |
2021 |
+ pushd "./${1}" >/dev/null |
2022 |
+ local dir="${PWD#${D%/}}" |
2023 |
+ local allarchives=$(echo *.la) |
2024 |
+ allarchives="\(${allarchives// /\\|}\)" |
2025 |
+ popd >/dev/null |
2026 |
+ |
2027 |
+ sed -i \ |
2028 |
+ -e "/^libdir=/s:=.*:='${dir}':" \ |
2029 |
+ ./${dir}/*.la |
2030 |
+ sed -i \ |
2031 |
+ -e "/^dependency_libs=/s:/[^ ]*/${allarchives}:${LIBPATH}/\1:g" \ |
2032 |
+ $(find ./${PREFIX}/lib* -maxdepth 3 -name '*.la') \ |
2033 |
+ ./${dir}/*.la |
2034 |
+ |
2035 |
+ popd >/dev/null |
2036 |
+} |
2037 |
+ |
2038 |
+is_multilib() { |
2039 |
+ tc_version_is_at_least 3 || return 1 |
2040 |
+ use multilib |
2041 |
+} |
2042 |
+ |
2043 |
+is_cxx() { |
2044 |
+ gcc-lang-supported 'c++' || return 1 |
2045 |
+ use cxx |
2046 |
+} |
2047 |
+ |
2048 |
+is_d() { |
2049 |
+ gcc-lang-supported d || return 1 |
2050 |
+ use_if_iuse d |
2051 |
+} |
2052 |
+ |
2053 |
+is_f77() { |
2054 |
+ gcc-lang-supported f77 || return 1 |
2055 |
+ use fortran |
2056 |
+} |
2057 |
+ |
2058 |
+is_f95() { |
2059 |
+ gcc-lang-supported f95 || return 1 |
2060 |
+ use fortran |
2061 |
+} |
2062 |
+ |
2063 |
+is_fortran() { |
2064 |
+ gcc-lang-supported fortran || return 1 |
2065 |
+ use fortran |
2066 |
+} |
2067 |
+ |
2068 |
+is_gcj() { |
2069 |
+ gcc-lang-supported java || return 1 |
2070 |
+ use cxx && use_if_iuse gcj |
2071 |
+} |
2072 |
+ |
2073 |
+is_go() { |
2074 |
+ gcc-lang-supported go || return 1 |
2075 |
+ use cxx && use_if_iuse go |
2076 |
+} |
2077 |
+ |
2078 |
+is_objc() { |
2079 |
+ gcc-lang-supported objc || return 1 |
2080 |
+ use_if_iuse objc |
2081 |
+} |
2082 |
+ |
2083 |
+is_objcxx() { |
2084 |
+ gcc-lang-supported 'obj-c++' || return 1 |
2085 |
+ use cxx && use_if_iuse objc++ |
2086 |
+} |
2087 |
+ |
2088 |
+is_ada() { |
2089 |
+ gcc-lang-supported ada || return 1 |
2090 |
+ use ada |
2091 |
+} |
2092 |
+ |
2093 |
+is_treelang() { |
2094 |
+ use_if_iuse boundschecking && return 1 #260532 |
2095 |
+ is_crosscompile && return 1 #199924 |
2096 |
+ gcc-lang-supported treelang || return 1 |
2097 |
+ #use treelang |
2098 |
+ return 0 |
2099 |
+} |
2100 |
+ |
2101 |
+# should kill these off once all the ebuilds are migrated |
2102 |
+gcc_pkg_setup() { toolchain_pkg_setup ; } |
2103 |
+gcc_src_unpack() { toolchain_src_unpack ; } |
2104 |
+gcc_src_compile() { toolchain_src_compile ; } |
2105 |
+gcc_src_test() { toolchain_src_test ; } |
2106 |
|
2107 |
diff --git a/sys-devel/gcc/files/CVS/Entries b/sys-devel/gcc/files/CVS/Entries |
2108 |
new file mode 100644 |
2109 |
index 0000000..3eb5dca |
2110 |
--- /dev/null |
2111 |
+++ b/sys-devel/gcc/files/CVS/Entries |
2112 |
@@ -0,0 +1,23 @@ |
2113 |
+/c89/1.2/Wed Feb 4 18:20:53 2009// |
2114 |
+/c99/1.2/Wed Feb 4 18:20:53 2009// |
2115 |
+/fix_libtool_files.sh/1.14/Thu Sep 6 11:00:44 2007// |
2116 |
+/gcc-configure-LANG.patch/1.3/Sun Jun 11 18:02:13 2006// |
2117 |
+/gcc-configure-texinfo.patch/1.1/Sun Nov 11 20:29:53 2007// |
2118 |
+/gcc-spec-env.patch/1.6/Sat Jan 1 00:59:21 2011// |
2119 |
+/mkinfodir/1.1/Sat Sep 1 07:56:19 2001// |
2120 |
+/pro-police-docs.patch/1.1/Fri Aug 6 19:16:25 2004// |
2121 |
+D/3.2.1//// |
2122 |
+D/3.2.2//// |
2123 |
+D/3.2.3//// |
2124 |
+D/3.3.4//// |
2125 |
+D/3.3.6//// |
2126 |
+D/3.4.0//// |
2127 |
+D/3.4.1//// |
2128 |
+D/3.4.2//// |
2129 |
+D/3.4.3//// |
2130 |
+D/3.4.4//// |
2131 |
+D/4.0.2//// |
2132 |
+D/4.1.0//// |
2133 |
+D/4.3.2//// |
2134 |
+D/4.4.0//// |
2135 |
+D/awk//// |
2136 |
|
2137 |
diff --git a/sys-devel/gcc/files/CVS/Repository b/sys-devel/gcc/files/CVS/Repository |
2138 |
new file mode 100644 |
2139 |
index 0000000..d5dc9ae |
2140 |
--- /dev/null |
2141 |
+++ b/sys-devel/gcc/files/CVS/Repository |
2142 |
@@ -0,0 +1 @@ |
2143 |
+gentoo-x86/sys-devel/gcc/files |
2144 |
|
2145 |
diff --git a/sys-devel/gcc/files/CVS/Root b/sys-devel/gcc/files/CVS/Root |
2146 |
new file mode 100644 |
2147 |
index 0000000..ef93b44 |
2148 |
--- /dev/null |
2149 |
+++ b/sys-devel/gcc/files/CVS/Root |
2150 |
@@ -0,0 +1 @@ |
2151 |
+zorry@××××××××××.org:/var/cvsroot |
2152 |
|
2153 |
diff --git a/sys-devel/gcc/files/awk/CVS/Entries b/sys-devel/gcc/files/awk/CVS/Entries |
2154 |
new file mode 100644 |
2155 |
index 0000000..9994521 |
2156 |
--- /dev/null |
2157 |
+++ b/sys-devel/gcc/files/awk/CVS/Entries |
2158 |
@@ -0,0 +1,3 @@ |
2159 |
+/fixlafiles.awk/1.15/Tue Feb 19 05:47:29 2008// |
2160 |
+/fixlafiles.awk-no_gcc_la/1.4/Fri Mar 19 23:53:07 2010// |
2161 |
+D |
2162 |
|
2163 |
diff --git a/sys-devel/gcc/files/awk/CVS/Repository b/sys-devel/gcc/files/awk/CVS/Repository |
2164 |
new file mode 100644 |
2165 |
index 0000000..3afa06e |
2166 |
--- /dev/null |
2167 |
+++ b/sys-devel/gcc/files/awk/CVS/Repository |
2168 |
@@ -0,0 +1 @@ |
2169 |
+gentoo-x86/sys-devel/gcc/files/awk |
2170 |
|
2171 |
diff --git a/sys-devel/gcc/files/awk/CVS/Root b/sys-devel/gcc/files/awk/CVS/Root |
2172 |
new file mode 100644 |
2173 |
index 0000000..ef93b44 |
2174 |
--- /dev/null |
2175 |
+++ b/sys-devel/gcc/files/awk/CVS/Root |
2176 |
@@ -0,0 +1 @@ |
2177 |
+zorry@××××××××××.org:/var/cvsroot |
2178 |
|
2179 |
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk b/sys-devel/gcc/files/awk/fixlafiles.awk |
2180 |
new file mode 100644 |
2181 |
index 0000000..ffade96 |
2182 |
--- /dev/null |
2183 |
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk |
2184 |
@@ -0,0 +1,314 @@ |
2185 |
+# Copyright 1999-2005 Gentoo Foundation |
2186 |
+# Distributed under the terms of the GNU General Public License v2 |
2187 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk,v 1.15 2008/02/19 05:47:29 vapier Exp $ |
2188 |
+ |
2189 |
+# |
2190 |
+# Helper functions |
2191 |
+# |
2192 |
+function printn(string) { |
2193 |
+ printf("%s", string) |
2194 |
+} |
2195 |
+function einfo(string) { |
2196 |
+ printf(" \033[32;01m*\033[0m %s\n", string) |
2197 |
+} |
2198 |
+function einfon(string) { |
2199 |
+ printf(" \033[32;01m*\033[0m %s", string) |
2200 |
+} |
2201 |
+function ewarn(string) { |
2202 |
+ printf(" \033[33;01m*\033[0m %s\n", string) |
2203 |
+} |
2204 |
+function ewarnn(string) { |
2205 |
+ printf(" \033[33;01m*\033[0m %s", string) |
2206 |
+} |
2207 |
+function eerror(string) { |
2208 |
+ printf(" \033[31;01m*\033[0m %s\n", string) |
2209 |
+} |
2210 |
+ |
2211 |
+# |
2212 |
+# assert(condition, errmsg) |
2213 |
+# assert that a condition is true. Otherwise exit. |
2214 |
+# |
2215 |
+function assert(condition, string) { |
2216 |
+ if (! condition) { |
2217 |
+ printf("%s:%d: assertion failed: %s\n", |
2218 |
+ FILENAME, FNR, string) > "/dev/stderr" |
2219 |
+ _assert_exit = 1 |
2220 |
+ exit 1 |
2221 |
+ } |
2222 |
+} |
2223 |
+ |
2224 |
+# |
2225 |
+# system(command, return) |
2226 |
+# wrapper that normalizes return codes ... |
2227 |
+# |
2228 |
+function dosystem(command, ret) { |
2229 |
+ ret = 0 |
2230 |
+ ret = system(command) |
2231 |
+ if (ret == 0) |
2232 |
+ return 1 |
2233 |
+ else |
2234 |
+ return 0 |
2235 |
+} |
2236 |
+ |
2237 |
+BEGIN { |
2238 |
+ # |
2239 |
+ # Get our variables from environment |
2240 |
+ # |
2241 |
+ OLDVER = ENVIRON["OLDVER"] |
2242 |
+ OLDCHOST = ENVIRON["OLDCHOST"] |
2243 |
+ |
2244 |
+ if (OLDVER == "") { |
2245 |
+ eerror("Could not get OLDVER!"); |
2246 |
+ exit 1 |
2247 |
+ } |
2248 |
+ |
2249 |
+ # Setup some sane defaults |
2250 |
+ LIBCOUNT = 2 |
2251 |
+ HAVE_GCC34 = 0 |
2252 |
+ DIRLIST[1] = "/lib" |
2253 |
+ DIRLIST[2] = "/usr/lib" |
2254 |
+ |
2255 |
+ # |
2256 |
+ # Walk /etc/ld.so.conf to discover all our library paths |
2257 |
+ # |
2258 |
+ pipe = "cat /etc/ld.so.conf | sort 2>/dev/null" |
2259 |
+ while(((pipe) | getline ldsoconf_data) > 0) { |
2260 |
+ if (ldsoconf_data !~ /^[[:space:]]*#/) { |
2261 |
+ if (ldsoconf_data == "") continue |
2262 |
+ |
2263 |
+ # Remove any trailing comments |
2264 |
+ sub(/#.*$/, "", ldsoconf_data) |
2265 |
+ # Remove any trailing spaces |
2266 |
+ sub(/[[:space:]]+$/, "", ldsoconf_data) |
2267 |
+ |
2268 |
+ # If there's more than one path per line, split |
2269 |
+ # it up as if they were sep lines |
2270 |
+ split(ldsoconf_data, nodes, /[:,[:space:]]/) |
2271 |
+ |
2272 |
+ # Now add the rest from ld.so.conf |
2273 |
+ for (x in nodes) { |
2274 |
+ # wtf does this line do ? |
2275 |
+ sub(/=.*/, "", nodes[x]) |
2276 |
+ # Prune trailing / |
2277 |
+ sub(/\/$/, "", nodes[x]) |
2278 |
+ |
2279 |
+ if (nodes[x] == "") continue |
2280 |
+ |
2281 |
+ # |
2282 |
+ # Drop the directory if its a child directory of |
2283 |
+ # one that was already added ... |
2284 |
+ # For example, if we have: |
2285 |
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss |
2286 |
+ # We really just want to save /usr/lib /usr/libexec |
2287 |
+ # |
2288 |
+ CHILD = 0 |
2289 |
+ for (y in DIRLIST) { |
2290 |
+ if (nodes[x] ~ "^" DIRLIST[y] "(/|$)") { |
2291 |
+ CHILD = 1 |
2292 |
+ break |
2293 |
+ } |
2294 |
+ } |
2295 |
+ if (CHILD) continue |
2296 |
+ |
2297 |
+ DIRLIST[++LIBCOUNT] = nodes[x] |
2298 |
+ } |
2299 |
+ } |
2300 |
+ } |
2301 |
+ close(pipe) |
2302 |
+ |
2303 |
+ # |
2304 |
+ # Get line from gcc's output containing CHOST |
2305 |
+ # |
2306 |
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" |
2307 |
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { |
2308 |
+ close(pipe) |
2309 |
+ |
2310 |
+ # If we fail to get the CHOST, see if we can get the CHOST |
2311 |
+ # portage thinks we are using ... |
2312 |
+ pipe = "/usr/bin/portageq envvar 'CHOST'" |
2313 |
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") |
2314 |
+ } else { |
2315 |
+ # Check pre gcc-3.4.x versions |
2316 |
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) |
2317 |
+ |
2318 |
+ if (CHOST == TMP_CHOST || CHOST == "") { |
2319 |
+ # Check gcc-3.4.x or later |
2320 |
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); |
2321 |
+ |
2322 |
+ if (CHOST == TMP_CHOST || CHOST == "") |
2323 |
+ CHOST = "" |
2324 |
+ else |
2325 |
+ HAVE_GCC34 = 1 |
2326 |
+ } |
2327 |
+ } |
2328 |
+ close(pipe) |
2329 |
+ |
2330 |
+ if (CHOST == "") { |
2331 |
+ eerror("Could not get gcc's CHOST!") |
2332 |
+ exit 1 |
2333 |
+ } |
2334 |
+ |
2335 |
+ if (OLDCHOST != "") |
2336 |
+ if (OLDCHOST == CHOST) |
2337 |
+ OLDCHOST = "" |
2338 |
+ |
2339 |
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" |
2340 |
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/" |
2341 |
+ |
2342 |
+ if (HAVE_GCC34) |
2343 |
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW |
2344 |
+ else |
2345 |
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD |
2346 |
+ |
2347 |
+ GCCLIB = GCCLIBPREFIX CHOST |
2348 |
+ |
2349 |
+ if (OLDCHOST != "") { |
2350 |
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST |
2351 |
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST |
2352 |
+ } |
2353 |
+ |
2354 |
+ # Get current gcc's version |
2355 |
+ pipe = "gcc -dumpversion" |
2356 |
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") |
2357 |
+ close(pipe) |
2358 |
+ |
2359 |
+ if (NEWVER == "") { |
2360 |
+ eerror("Could not get gcc's version!") |
2361 |
+ exit 1 |
2362 |
+ } |
2363 |
+ |
2364 |
+ # Nothing to do ? |
2365 |
+ if ((OLDVER == NEWVER) && (OLDCHOST == "")) |
2366 |
+ exit 0 |
2367 |
+ |
2368 |
+ # |
2369 |
+ # Ok, now let's scan for the .la files and actually fix them up |
2370 |
+ # |
2371 |
+ for (x = 1; x <= LIBCOUNT; x++) { |
2372 |
+ # Do nothing if the target dir is gcc's internal library path |
2373 |
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || |
2374 |
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW) |
2375 |
+ continue |
2376 |
+ |
2377 |
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") |
2378 |
+ |
2379 |
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" |
2380 |
+ while (((pipe) | getline la_files) > 0) { |
2381 |
+ |
2382 |
+ # Do nothing if the .la file is located in gcc's internal lib path |
2383 |
+ if (la_files ~ GCCLIBPREFIX_OLD || |
2384 |
+ la_files ~ GCCLIBPREFIX_NEW) |
2385 |
+ continue |
2386 |
+ |
2387 |
+ CHANGED = 0 |
2388 |
+ CHOST_CHANGED = 0 |
2389 |
+ |
2390 |
+ # See if we need to fix the .la file |
2391 |
+ while ((getline la_data < (la_files)) > 0) { |
2392 |
+ if (OLDCHOST != "") { |
2393 |
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+", |
2394 |
+ GCCLIB, la_data) > 0) || |
2395 |
+ (gsub(OLDGCCLIB2 "[/[:space:]]+", |
2396 |
+ GCCLIB, la_data) > 0)) { |
2397 |
+ CHANGED = 1 |
2398 |
+ CHOST_CHANGED = 1 |
2399 |
+ } |
2400 |
+ } |
2401 |
+ if (OLDVER != NEWVER) { |
2402 |
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", |
2403 |
+ GCCLIB "/" NEWVER, la_data) > 0) || |
2404 |
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", |
2405 |
+ GCCLIB "/" NEWVER, la_data) > 0)) |
2406 |
+ CHANGED = 1 |
2407 |
+ } |
2408 |
+ } |
2409 |
+ close(la_files) |
2410 |
+ |
2411 |
+ # Do the actual changes in a second loop, as we can then |
2412 |
+ # verify that CHOST_CHANGED among things is correct ... |
2413 |
+ if (CHANGED) { |
2414 |
+ ewarnn(" FIXING: " la_files " ...") |
2415 |
+ |
2416 |
+ if (CHANGED) |
2417 |
+ printn("[") |
2418 |
+ |
2419 |
+ # Clear the temp file (removing rather than '>foo' is better |
2420 |
+ # out of a security point of view?) |
2421 |
+ dosystem("rm -f " la_files ".new") |
2422 |
+ |
2423 |
+ while ((getline la_data < (la_files)) > 0) { |
2424 |
+ if (OLDCHOST != "") { |
2425 |
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", |
2426 |
+ GCCLIB "\\1", "g", la_data) |
2427 |
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", |
2428 |
+ GCCLIB "\\1", "g", tmpstr) |
2429 |
+ |
2430 |
+ if (la_data != tmpstr) { |
2431 |
+ printn("c") |
2432 |
+ la_data = tmpstr |
2433 |
+ } |
2434 |
+ |
2435 |
+ if (CHOST_CHANGED > 0) { |
2436 |
+ # We try to be careful about CHOST changes outside |
2437 |
+ # the gcc library path (meaning we cannot match it |
2438 |
+ # via /GCCLIBPREFIX CHOST/) ... |
2439 |
+ |
2440 |
+ # Catch: |
2441 |
+ # |
2442 |
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}' |
2443 |
+ # |
2444 |
+ gsub("-L/usr/" OLDCHOST "/", |
2445 |
+ "-L/usr/" CHOST "/", la_data) |
2446 |
+ # Catch: |
2447 |
+ # |
2448 |
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' |
2449 |
+ # |
2450 |
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", |
2451 |
+ "\\1/" CHOST "/", "g", la_data) |
2452 |
+ } |
2453 |
+ } |
2454 |
+ |
2455 |
+ if (OLDVER != NEWVER) { |
2456 |
+ # Catch: |
2457 |
+ # |
2458 |
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' |
2459 |
+ # |
2460 |
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", |
2461 |
+ GCCLIB "/" NEWVER "\\1", "g", la_data) |
2462 |
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", |
2463 |
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr) |
2464 |
+ |
2465 |
+ if (la_data != tmpstr) { |
2466 |
+ # Catch: |
2467 |
+ # |
2468 |
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' |
2469 |
+ # |
2470 |
+ # in cases where we have gcc34 |
2471 |
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", |
2472 |
+ GCCLIBPREFIX "\\1", "g", tmpstr) |
2473 |
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", |
2474 |
+ GCCLIBPREFIX "\\1", "g", tmpstr) |
2475 |
+ printn("v") |
2476 |
+ la_data = tmpstr |
2477 |
+ } |
2478 |
+ } |
2479 |
+ |
2480 |
+ print la_data >> (la_files ".new") |
2481 |
+ } |
2482 |
+ |
2483 |
+ if (CHANGED) |
2484 |
+ print "]" |
2485 |
+ |
2486 |
+ close(la_files) |
2487 |
+ close(la_files ".new") |
2488 |
+ |
2489 |
+ assert(dosystem("mv -f " la_files ".new " la_files), |
2490 |
+ "dosystem(\"mv -f " la_files ".new " la_files "\")") |
2491 |
+ } |
2492 |
+ } |
2493 |
+ |
2494 |
+ close(pipe) |
2495 |
+ } |
2496 |
+} |
2497 |
+ |
2498 |
+# vim:ts=4 |
2499 |
|
2500 |
diff --git a/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la |
2501 |
new file mode 100644 |
2502 |
index 0000000..346bd16 |
2503 |
--- /dev/null |
2504 |
+++ b/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la |
2505 |
@@ -0,0 +1,335 @@ |
2506 |
+# Copyright 1999-2005 Gentoo Foundation |
2507 |
+# Distributed under the terms of the GNU General Public License v2 |
2508 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/awk/fixlafiles.awk-no_gcc_la,v 1.4 2010/03/19 23:53:07 vapier Exp $ |
2509 |
+ |
2510 |
+# |
2511 |
+# Helper functions |
2512 |
+# |
2513 |
+function printn(string) { |
2514 |
+ printf("%s", string) |
2515 |
+} |
2516 |
+function einfo(string) { |
2517 |
+ printf(" \033[32;01m*\033[0m %s\n", string) |
2518 |
+} |
2519 |
+function einfon(string) { |
2520 |
+ printf(" \033[32;01m*\033[0m %s", string) |
2521 |
+} |
2522 |
+function ewarn(string) { |
2523 |
+ printf(" \033[33;01m*\033[0m %s\n", string) |
2524 |
+} |
2525 |
+function ewarnn(string) { |
2526 |
+ printf(" \033[33;01m*\033[0m %s", string) |
2527 |
+} |
2528 |
+function eerror(string) { |
2529 |
+ printf(" \033[31;01m*\033[0m %s\n", string) |
2530 |
+} |
2531 |
+ |
2532 |
+# |
2533 |
+# assert(condition, errmsg) |
2534 |
+# assert that a condition is true. Otherwise exit. |
2535 |
+# |
2536 |
+function assert(condition, string) { |
2537 |
+ if (! condition) { |
2538 |
+ printf("%s:%d: assertion failed: %s\n", |
2539 |
+ FILENAME, FNR, string) > "/dev/stderr" |
2540 |
+ _assert_exit = 1 |
2541 |
+ exit 1 |
2542 |
+ } |
2543 |
+} |
2544 |
+ |
2545 |
+# |
2546 |
+# system(command, return) |
2547 |
+# wrapper that normalizes return codes ... |
2548 |
+# |
2549 |
+function dosystem(command, ret) { |
2550 |
+ ret = 0 |
2551 |
+ ret = system(command) |
2552 |
+ if (ret == 0) |
2553 |
+ return 1 |
2554 |
+ else |
2555 |
+ return 0 |
2556 |
+} |
2557 |
+ |
2558 |
+# |
2559 |
+# parse_ld_conf(config_file) |
2560 |
+# |
2561 |
+function parse_ld_conf(conf, pipe, ldsoconf_data, CHILD, y) { |
2562 |
+ pipe = "cd /etc; cat " conf " | sort 2>/dev/null" |
2563 |
+ while(((pipe) | getline ldsoconf_data) > 0) { |
2564 |
+ if (ldsoconf_data ~ /^[[:space:]]*#/) |
2565 |
+ continue |
2566 |
+ if (ldsoconf_data == "") |
2567 |
+ continue |
2568 |
+ |
2569 |
+ # Handle the "include" keyword |
2570 |
+ if (ldsoconf_data ~ /^include /) { |
2571 |
+ sub(/^include /, "", ldsoconf_data) |
2572 |
+ parse_ld_conf(ldsoconf_data) |
2573 |
+ continue |
2574 |
+ } |
2575 |
+ |
2576 |
+ # Remove any trailing comments |
2577 |
+ sub(/#.*$/, "", ldsoconf_data) |
2578 |
+ # Remove any trailing spaces |
2579 |
+ sub(/[[:space:]]+$/, "", ldsoconf_data) |
2580 |
+ # Eat duplicate slashes |
2581 |
+ sub(/\/\//, "/", ldsoconf_data) |
2582 |
+ # Prune trailing / |
2583 |
+ sub(/\/$/, "", ldsoconf_data) |
2584 |
+ |
2585 |
+ # |
2586 |
+ # Drop the directory if its a child directory of |
2587 |
+ # one that was already added ... |
2588 |
+ # For example, if we have: |
2589 |
+ # /usr/lib /usr/libexec /usr/lib/mozilla /usr/lib/nss |
2590 |
+ # We really just want to save /usr/lib /usr/libexec |
2591 |
+ # |
2592 |
+ CHILD = 0 |
2593 |
+ for (y in DIRLIST) { |
2594 |
+ if (ldsoconf_data ~ "^" DIRLIST[y] "(/|$)") { |
2595 |
+ CHILD = 1 |
2596 |
+ break |
2597 |
+ } |
2598 |
+ } |
2599 |
+ if (CHILD) continue |
2600 |
+ |
2601 |
+ DIRLIST[++LIBCOUNT] = ldsoconf_data |
2602 |
+ } |
2603 |
+ close(pipe) |
2604 |
+} |
2605 |
+ |
2606 |
+BEGIN { |
2607 |
+ # |
2608 |
+ # Get our variables from environment |
2609 |
+ # |
2610 |
+ OLDVER = ENVIRON["OLDVER"] |
2611 |
+ OLDCHOST = ENVIRON["OLDCHOST"] |
2612 |
+ |
2613 |
+ if (OLDVER == "") { |
2614 |
+ eerror("Could not get OLDVER!"); |
2615 |
+ exit 1 |
2616 |
+ } |
2617 |
+ |
2618 |
+ # Setup some sane defaults |
2619 |
+ LIBCOUNT = 2 |
2620 |
+ HAVE_GCC34 = 0 |
2621 |
+ DIRLIST[1] = "/lib" |
2622 |
+ DIRLIST[2] = "/usr/lib" |
2623 |
+ |
2624 |
+ # |
2625 |
+ # Walk /etc/ld.so.conf to discover all our library paths |
2626 |
+ # |
2627 |
+ parse_ld_conf("/etc/ld.so.conf") |
2628 |
+ |
2629 |
+ # |
2630 |
+ # Get line from gcc's output containing CHOST |
2631 |
+ # |
2632 |
+ pipe = "gcc -print-file-name=libgcc.a 2>/dev/null" |
2633 |
+ if ((!((pipe) | getline TMP_CHOST)) || (TMP_CHOST == "")) { |
2634 |
+ close(pipe) |
2635 |
+ |
2636 |
+ # If we fail to get the CHOST, see if we can get the CHOST |
2637 |
+ # portage thinks we are using ... |
2638 |
+ pipe = "/usr/bin/portageq envvar 'CHOST'" |
2639 |
+ assert(((pipe) | getline CHOST), "(" pipe ") | getline CHOST") |
2640 |
+ } else { |
2641 |
+ # Check pre gcc-3.4.x versions |
2642 |
+ CHOST = gensub("^.+lib/gcc-lib/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST) |
2643 |
+ |
2644 |
+ if (CHOST == TMP_CHOST || CHOST == "") { |
2645 |
+ # Check gcc-3.4.x or later |
2646 |
+ CHOST = gensub("^.+lib/gcc/([^/]+)/[0-9]+.+$", "\\1", 1, TMP_CHOST); |
2647 |
+ |
2648 |
+ if (CHOST == TMP_CHOST || CHOST == "") |
2649 |
+ CHOST = "" |
2650 |
+ else |
2651 |
+ HAVE_GCC34 = 1 |
2652 |
+ } |
2653 |
+ } |
2654 |
+ close(pipe) |
2655 |
+ |
2656 |
+ if (CHOST == "") { |
2657 |
+ eerror("Could not get gcc's CHOST!") |
2658 |
+ exit 1 |
2659 |
+ } |
2660 |
+ |
2661 |
+ if (OLDCHOST != "") |
2662 |
+ if (OLDCHOST == CHOST) |
2663 |
+ OLDCHOST = "" |
2664 |
+ |
2665 |
+ GCCLIBPREFIX_OLD = "/usr/lib/gcc-lib/" |
2666 |
+ GCCLIBPREFIX_NEW = "/usr/lib/gcc/" |
2667 |
+ |
2668 |
+ if (HAVE_GCC34) |
2669 |
+ GCCLIBPREFIX = GCCLIBPREFIX_NEW |
2670 |
+ else |
2671 |
+ GCCLIBPREFIX = GCCLIBPREFIX_OLD |
2672 |
+ |
2673 |
+ GCCLIB = GCCLIBPREFIX CHOST |
2674 |
+ |
2675 |
+ if (OLDCHOST != "") { |
2676 |
+ OLDGCCLIB1 = GCCLIBPREFIX_OLD OLDCHOST |
2677 |
+ OLDGCCLIB2 = GCCLIBPREFIX_NEW OLDCHOST |
2678 |
+ } |
2679 |
+ |
2680 |
+ # Get current gcc's version |
2681 |
+ pipe = "gcc -dumpversion" |
2682 |
+ assert(((pipe) | getline NEWVER), "(" pipe ") | getline NEWVER)") |
2683 |
+ close(pipe) |
2684 |
+ |
2685 |
+ if (NEWVER == "") { |
2686 |
+ eerror("Could not get gcc's version!") |
2687 |
+ exit 1 |
2688 |
+ } |
2689 |
+ |
2690 |
+ # Nothing to do ? |
2691 |
+ # NB: Do not check for (OLDVER == NEWVER) anymore, as we might need to |
2692 |
+ # replace libstdc++.la .... |
2693 |
+ if ((OLDVER == "") && (OLDCHOST == "")) |
2694 |
+ exit 0 |
2695 |
+ |
2696 |
+ # |
2697 |
+ # Ok, now let's scan for the .la files and actually fix them up |
2698 |
+ # |
2699 |
+ for (x = 1; x <= LIBCOUNT; x++) { |
2700 |
+ # Do nothing if the target dir is gcc's internal library path |
2701 |
+ if (DIRLIST[x] ~ GCCLIBPREFIX_OLD || |
2702 |
+ DIRLIST[x] ~ GCCLIBPREFIX_NEW) |
2703 |
+ continue |
2704 |
+ |
2705 |
+ einfo(" [" x "/" LIBCOUNT "] Scanning " DIRLIST[x] " ...") |
2706 |
+ |
2707 |
+ pipe = "find " DIRLIST[x] "/ -name '*.la' 2>/dev/null" |
2708 |
+ while (((pipe) | getline la_files) > 0) { |
2709 |
+ |
2710 |
+ # Do nothing if the .la file is located in gcc's internal lib path |
2711 |
+ if (la_files ~ GCCLIBPREFIX_OLD || |
2712 |
+ la_files ~ GCCLIBPREFIX_NEW) |
2713 |
+ continue |
2714 |
+ |
2715 |
+ CHANGED = 0 |
2716 |
+ CHOST_CHANGED = 0 |
2717 |
+ |
2718 |
+ # See if we need to fix the .la file |
2719 |
+ while ((getline la_data < (la_files)) > 0) { |
2720 |
+ if (OLDCHOST != "") { |
2721 |
+ if ((gsub(OLDGCCLIB1 "[/[:space:]]+", |
2722 |
+ GCCLIB, la_data) > 0) || |
2723 |
+ (gsub(OLDGCCLIB2 "[/[:space:]]+", |
2724 |
+ GCCLIB, la_data) > 0)) { |
2725 |
+ CHANGED = 1 |
2726 |
+ CHOST_CHANGED = 1 |
2727 |
+ } |
2728 |
+ } |
2729 |
+ if (OLDVER != NEWVER) { |
2730 |
+ if ((gsub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "[/[:space:]]*", |
2731 |
+ GCCLIB "/" NEWVER, la_data) > 0) || |
2732 |
+ (gsub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "[/[:space:]]*", |
2733 |
+ GCCLIB "/" NEWVER, la_data) > 0)) |
2734 |
+ CHANGED = 1 |
2735 |
+ } |
2736 |
+ # We now check if we have libstdc++.la, as we remove the |
2737 |
+ # libtool linker scripts for gcc ... |
2738 |
+ # We do this last, as we only match the new paths |
2739 |
+ if (gsub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", |
2740 |
+ "-lstdc++", la_data) > 0) |
2741 |
+ CHANGED = 1 |
2742 |
+ } |
2743 |
+ close(la_files) |
2744 |
+ |
2745 |
+ # Do the actual changes in a second loop, as we can then |
2746 |
+ # verify that CHOST_CHANGED among things is correct ... |
2747 |
+ if (CHANGED) { |
2748 |
+ ewarnn(" FIXING: " la_files " ...[") |
2749 |
+ |
2750 |
+ # Clear the temp file (removing rather than '>foo' is better |
2751 |
+ # out of a security point of view?) |
2752 |
+ dosystem("rm -f " la_files ".new") |
2753 |
+ |
2754 |
+ while ((getline la_data < (la_files)) > 0) { |
2755 |
+ if (OLDCHOST != "") { |
2756 |
+ tmpstr = gensub(OLDGCCLIB1 "([/[:space:]]+)", |
2757 |
+ GCCLIB "\\1", "g", la_data) |
2758 |
+ tmpstr = gensub(OLDGCCLIB2 "([/[:space:]]+)", |
2759 |
+ GCCLIB "\\1", "g", tmpstr) |
2760 |
+ |
2761 |
+ if (la_data != tmpstr) { |
2762 |
+ printn("c") |
2763 |
+ la_data = tmpstr |
2764 |
+ } |
2765 |
+ |
2766 |
+ if (CHOST_CHANGED > 0) { |
2767 |
+ # We try to be careful about CHOST changes outside |
2768 |
+ # the gcc library path (meaning we cannot match it |
2769 |
+ # via /GCCLIBPREFIX CHOST/) ... |
2770 |
+ |
2771 |
+ # Catch: |
2772 |
+ # |
2773 |
+ # dependency_libs=' -L/usr/CHOST/{bin,lib}' |
2774 |
+ # |
2775 |
+ gsub("-L/usr/" OLDCHOST "/", |
2776 |
+ "-L/usr/" CHOST "/", la_data) |
2777 |
+ # Catch: |
2778 |
+ # |
2779 |
+ # dependency_libs=' -L/usr/lib/gcc-lib/CHOST/VER/../../../../CHOST/lib' |
2780 |
+ # |
2781 |
+ la_data = gensub("(" GCCLIB "/[^[:space:]]+)/" OLDCHOST "/", |
2782 |
+ "\\1/" CHOST "/", "g", la_data) |
2783 |
+ } |
2784 |
+ } |
2785 |
+ |
2786 |
+ if (OLDVER != NEWVER) { |
2787 |
+ # Catch: |
2788 |
+ # |
2789 |
+ # dependency_libs=' -L/usr/lib/gcc/CHOST/VER' |
2790 |
+ # |
2791 |
+ tmpstr = gensub(GCCLIBPREFIX_OLD CHOST "/" OLDVER "([/[:space:]]+)", |
2792 |
+ GCCLIB "/" NEWVER "\\1", "g", la_data) |
2793 |
+ tmpstr = gensub(GCCLIBPREFIX_NEW CHOST "/" OLDVER "([/[:space:]]+)", |
2794 |
+ GCCLIB "/" NEWVER "\\1", "g", tmpstr) |
2795 |
+ |
2796 |
+ if (la_data != tmpstr) { |
2797 |
+ # Catch: |
2798 |
+ # |
2799 |
+ # dependency_libs=' -L/usr/lib/gcc-lib/../../CHOST/lib' |
2800 |
+ # |
2801 |
+ # in cases where we have gcc34 |
2802 |
+ tmpstr = gensub(GCCLIBPREFIX_OLD "(../../" CHOST "/lib)", |
2803 |
+ GCCLIBPREFIX "\\1", "g", tmpstr) |
2804 |
+ tmpstr = gensub(GCCLIBPREFIX_NEW "(../../" CHOST "/lib)", |
2805 |
+ GCCLIBPREFIX "\\1", "g", tmpstr) |
2806 |
+ printn("v") |
2807 |
+ la_data = tmpstr |
2808 |
+ } |
2809 |
+ } |
2810 |
+ |
2811 |
+ # We now check if we have libstdc++.la, as we remove the |
2812 |
+ # libtool linker scripts for gcc and any referencese in any |
2813 |
+ # libtool linker scripts. |
2814 |
+ # We do this last, as we only match the new paths |
2815 |
+ tmpstr = gensub(GCCLIB "/" NEWVER "/libstdc\\+\\+\\.la", |
2816 |
+ "-lstdc++", "g", la_data); |
2817 |
+ if (la_data != tmpstr) { |
2818 |
+ printn("l") |
2819 |
+ la_data = tmpstr |
2820 |
+ } |
2821 |
+ |
2822 |
+ print la_data >> (la_files ".new") |
2823 |
+ } |
2824 |
+ |
2825 |
+ if (CHANGED) |
2826 |
+ print "]" |
2827 |
+ |
2828 |
+ close(la_files) |
2829 |
+ close(la_files ".new") |
2830 |
+ |
2831 |
+ assert(dosystem("mv -f " la_files ".new " la_files), |
2832 |
+ "dosystem(\"mv -f " la_files ".new " la_files "\")") |
2833 |
+ } |
2834 |
+ } |
2835 |
+ |
2836 |
+ close(pipe) |
2837 |
+ } |
2838 |
+} |
2839 |
+ |
2840 |
+# vim:ts=4 |
2841 |
|
2842 |
diff --git a/sys-devel/gcc/files/c89 b/sys-devel/gcc/files/c89 |
2843 |
new file mode 100755 |
2844 |
index 0000000..cee0325 |
2845 |
--- /dev/null |
2846 |
+++ b/sys-devel/gcc/files/c89 |
2847 |
@@ -0,0 +1,20 @@ |
2848 |
+#! /bin/sh |
2849 |
+ |
2850 |
+# Call the appropriate C compiler with options to accept ANSI/ISO C |
2851 |
+# The following options are the same (as of gcc-2.95): |
2852 |
+# -ansi |
2853 |
+# -std=c89 |
2854 |
+# -std=iso9899:1990 |
2855 |
+ |
2856 |
+for i; do |
2857 |
+ case "$i" in |
2858 |
+ -ansi|-std=c89|-std=iso9899:1990) |
2859 |
+ ;; |
2860 |
+ -std=*) |
2861 |
+ echo >&2 "`basename $0` called with non ANSI/ISO C90 option $i" |
2862 |
+ exit 1 |
2863 |
+ ;; |
2864 |
+ esac |
2865 |
+done |
2866 |
+ |
2867 |
+exec gcc -std=c89 -pedantic -U_FORTIFY_SOURCE "$@" |
2868 |
|
2869 |
diff --git a/sys-devel/gcc/files/c99 b/sys-devel/gcc/files/c99 |
2870 |
new file mode 100755 |
2871 |
index 0000000..c954209 |
2872 |
--- /dev/null |
2873 |
+++ b/sys-devel/gcc/files/c99 |
2874 |
@@ -0,0 +1,21 @@ |
2875 |
+#! /bin/sh |
2876 |
+ |
2877 |
+# Call the appropriate C compiler with options to accept ANSI/ISO C |
2878 |
+# The following options are the same (as of gcc-3.3): |
2879 |
+# -std=c99 |
2880 |
+# -std=c9x |
2881 |
+# -std=iso9899:1999 |
2882 |
+# -std=iso9899:199x |
2883 |
+ |
2884 |
+for i; do |
2885 |
+ case "$i" in |
2886 |
+ -std=c9[9x]|-std=iso9899:199[9x]) |
2887 |
+ ;; |
2888 |
+ -ansi|-std=*) |
2889 |
+ echo >&2 "`basename $0` called with non ANSI/ISO C99 option $i" |
2890 |
+ exit 1 |
2891 |
+ ;; |
2892 |
+ esac |
2893 |
+done |
2894 |
+ |
2895 |
+exec gcc -std=c99 -pedantic -U_FORTIFY_SOURCE ${1+"$@"} |
2896 |
|
2897 |
diff --git a/sys-devel/gcc/files/fix_libtool_files.sh b/sys-devel/gcc/files/fix_libtool_files.sh |
2898 |
new file mode 100644 |
2899 |
index 0000000..c3a3c61 |
2900 |
--- /dev/null |
2901 |
+++ b/sys-devel/gcc/files/fix_libtool_files.sh |
2902 |
@@ -0,0 +1,72 @@ |
2903 |
+#!/bin/bash |
2904 |
+# Copyright 1999-2007 Gentoo Foundation |
2905 |
+# Distributed under the terms of the GNU General Public License v2 |
2906 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/files/fix_libtool_files.sh,v 1.14 2007/09/06 11:00:44 uberlord Exp $ |
2907 |
+ |
2908 |
+usage() { |
2909 |
+cat << "USAGE_END" |
2910 |
+Usage: fix_libtool_files.sh <old-gcc-version> [--oldarch <old-CHOST>] |
2911 |
+ |
2912 |
+ Where <old-gcc-version> is the version number of the |
2913 |
+ previous gcc version. For example, if you updated to |
2914 |
+ gcc-3.2.1, and you had gcc-3.2 installed, run: |
2915 |
+ |
2916 |
+ # fix_libtool_files.sh 3.2 |
2917 |
+ |
2918 |
+ If you updated to gcc-3.2.3, and the old CHOST was i586-pc-linux-gnu |
2919 |
+ but you now have CHOST as i686-pc-linux-gnu, run: |
2920 |
+ |
2921 |
+ # fix_libtool_files.sh 3.2 --oldarch i586-pc-linux-gnu |
2922 |
+ |
2923 |
+ Note that if only the CHOST and not the version changed, you can run |
2924 |
+ it with the current version and the '--oldarch <old-CHOST>' arguments, |
2925 |
+ and it will do the expected: |
2926 |
+ |
2927 |
+ # fix_libtool_files.sh `gcc -dumpversion` --oldarch i586-pc-linux-gnu |
2928 |
+ |
2929 |
+USAGE_END |
2930 |
+ exit 1 |
2931 |
+} |
2932 |
+ |
2933 |
+if [[ $2 != "--oldarch" && $# -ne 1 ]] || \ |
2934 |
+ [[ $2 == "--oldarch" && $# -ne 3 ]] |
2935 |
+then |
2936 |
+ usage |
2937 |
+fi |
2938 |
+ |
2939 |
+ARGV1=$1 |
2940 |
+ARGV2=$2 |
2941 |
+ARGV3=$3 |
2942 |
+ |
2943 |
+source /etc/profile || exit 1 |
2944 |
+source /etc/init.d/functions.sh || exit 1 |
2945 |
+ |
2946 |
+if [[ ${EUID} -ne 0 ]] ; then |
2947 |
+ eerror "${0##*/}: Must be root." |
2948 |
+ exit 1 |
2949 |
+fi |
2950 |
+ |
2951 |
+# make sure the files come out sane |
2952 |
+umask 0022 |
2953 |
+ |
2954 |
+if [[ ${ARGV2} == "--oldarch" ]] && [[ -n ${ARGV3} ]] ; then |
2955 |
+ OLDCHOST=${ARGV3} |
2956 |
+else |
2957 |
+ OLDCHOST= |
2958 |
+fi |
2959 |
+ |
2960 |
+AWKDIR="/lib/rcscripts/awk" |
2961 |
+ |
2962 |
+if [[ ! -r ${AWKDIR}/fixlafiles.awk ]] ; then |
2963 |
+ eerror "${0##*/}: ${AWKDIR}/fixlafiles.awk does not exist!" |
2964 |
+ exit 1 |
2965 |
+fi |
2966 |
+ |
2967 |
+OLDVER=${ARGV1} |
2968 |
+ |
2969 |
+export OLDVER OLDCHOST |
2970 |
+ |
2971 |
+einfo "Scanning libtool files for hardcoded gcc library paths..." |
2972 |
+gawk -f "${AWKDIR}/fixlafiles.awk" |
2973 |
+ |
2974 |
+# vim:ts=4 |
2975 |
|
2976 |
diff --git a/sys-devel/gcc/files/gcc-configure-LANG.patch b/sys-devel/gcc/files/gcc-configure-LANG.patch |
2977 |
new file mode 100644 |
2978 |
index 0000000..d1b1b03 |
2979 |
--- /dev/null |
2980 |
+++ b/sys-devel/gcc/files/gcc-configure-LANG.patch |
2981 |
@@ -0,0 +1,64 @@ |
2982 |
+The LANG vars aren't reset early enough so when sed tries to use [a-zA-Z] in |
2983 |
+option parsing, it may break. |
2984 |
+ |
2985 |
+http://bugs.gentoo.org/103483 |
2986 |
+ |
2987 |
+--- configure |
2988 |
++++ configure |
2989 |
+@@ -54,6 +54,19 @@ |
2990 |
+ infodir='${prefix}/info' |
2991 |
+ mandir='${prefix}/man' |
2992 |
+ |
2993 |
++# NLS nuisances. |
2994 |
++for as_var in \ |
2995 |
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ |
2996 |
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ |
2997 |
++ LC_TELEPHONE LC_TIME |
2998 |
++do |
2999 |
++ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then |
3000 |
++ eval $as_var=C; export $as_var |
3001 |
++ else |
3002 |
++ unset $as_var |
3003 |
++ fi |
3004 |
++done |
3005 |
++ |
3006 |
+ # Initialize some other variables. |
3007 |
+ subdirs= |
3008 |
+ MFLAGS= MAKEFLAGS= |
3009 |
+@@ -452,16 +463,6 @@ |
3010 |
+ esac |
3011 |
+ done |
3012 |
+ |
3013 |
+-# NLS nuisances. |
3014 |
+-# Only set these to C if already set. These must not be set unconditionally |
3015 |
+-# because not all systems understand e.g. LANG=C (notably SCO). |
3016 |
+-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! |
3017 |
+-# Non-C LC_CTYPE values break the ctype check. |
3018 |
+-if test "${LANG+set}" = set; then LANG=C; export LANG; fi |
3019 |
+-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi |
3020 |
+-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi |
3021 |
+-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi |
3022 |
+- |
3023 |
+ # confdefs.h avoids OS command line length limits that DEFS can exceed. |
3024 |
+ rm -rf conftest* confdefs.h |
3025 |
+ # AIX cpp loses on an empty file, so make sure it contains at least a newline. |
3026 |
+@@ -1850,6 +1850,19 @@ |
3027 |
+ # Compiler output produced by configure, useful for debugging |
3028 |
+ # configure, is in ./config.log if it exists. |
3029 |
+ |
3030 |
++# NLS nuisances. |
3031 |
++for as_var in \ |
3032 |
++ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ |
3033 |
++ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ |
3034 |
++ LC_TELEPHONE LC_TIME |
3035 |
++do |
3036 |
++ if (set +x; test -z "`(eval \$as_var=C; export \$as_var) 2>&1`"); then |
3037 |
++ eval \$as_var=C; export \$as_var |
3038 |
++ else |
3039 |
++ unset \$as_var |
3040 |
++ fi |
3041 |
++done |
3042 |
++ |
3043 |
+ ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" |
3044 |
+ for ac_option |
3045 |
+ do |
3046 |
|
3047 |
diff --git a/sys-devel/gcc/files/gcc-configure-texinfo.patch b/sys-devel/gcc/files/gcc-configure-texinfo.patch |
3048 |
new file mode 100644 |
3049 |
index 0000000..ddc098d |
3050 |
--- /dev/null |
3051 |
+++ b/sys-devel/gcc/files/gcc-configure-texinfo.patch |
3052 |
@@ -0,0 +1,16 @@ |
3053 |
+Chances are quite good that the installed makeinfo is sufficient. |
3054 |
+So ignore false positives where the makeinfo installed is so new |
3055 |
+that it violates the cheesy version grep. |
3056 |
+ |
3057 |
+http://bugs.gentoo.org/198182 |
3058 |
+ |
3059 |
+--- configure |
3060 |
++++ configure |
3061 |
+@@ -3573,6 +3573,6 @@ |
3062 |
+ : |
3063 |
+ else |
3064 |
+- MAKEINFO="$MISSING makeinfo" |
3065 |
++ : |
3066 |
+ fi |
3067 |
+ ;; |
3068 |
+ |
3069 |
|
3070 |
diff --git a/sys-devel/gcc/files/gcc-spec-env.patch b/sys-devel/gcc/files/gcc-spec-env.patch |
3071 |
new file mode 100644 |
3072 |
index 0000000..57e7567 |
3073 |
--- /dev/null |
3074 |
+++ b/sys-devel/gcc/files/gcc-spec-env.patch |
3075 |
@@ -0,0 +1,42 @@ |
3076 |
+ Add support for external spec file via the GCC_SPECS env var. This |
3077 |
+ allows us to easily control pie/ssp defaults with gcc-config profiles. |
3078 |
+ |
3079 |
+ Original patch by Rob Holland |
3080 |
+ Extended to support multiple entries separated by ':' by Kevin F. Quinn |
3081 |
+ Modified to use getenv instead of poisoned GET_ENVIRONMENT by Ryan Hill |
3082 |
+ |
3083 |
+--- gcc-4/gcc/gcc.c |
3084 |
++++ gcc-4/gcc/gcc.c |
3085 |
+@@ -6482,6 +6482,32 @@ |
3086 |
+ |
3087 |
+ /* Process any user specified specs in the order given on the command |
3088 |
+ line. */ |
3089 |
++#if !(defined (__MSDOS__) || defined (OS2) || defined (VMS) || defined (WIN32)) |
3090 |
++ /* Add specs listed in GCC_SPECS. Note; in the process of separating |
3091 |
++ * each spec listed, the string is overwritten at token boundaries |
3092 |
++ * (':') with '\0', an effect of strtok_r(). |
3093 |
++ */ |
3094 |
++ specs_file = getenv ("GCC_SPECS"); |
3095 |
++ if (specs_file && (strlen(specs_file) > 0)) |
3096 |
++ { |
3097 |
++ char *spec, *saveptr; |
3098 |
++ for (spec=strtok_r(specs_file,":",&saveptr); |
3099 |
++ spec!=NULL; |
3100 |
++ spec=strtok_r(NULL,":",&saveptr)) |
3101 |
++ { |
3102 |
++ struct user_specs *user = (struct user_specs *) |
3103 |
++ xmalloc (sizeof (struct user_specs)); |
3104 |
++ |
3105 |
++ user->next = (struct user_specs *) 0; |
3106 |
++ user->filename = spec; |
3107 |
++ if (user_specs_tail) |
3108 |
++ user_specs_tail->next = user; |
3109 |
++ else |
3110 |
++ user_specs_head = user; |
3111 |
++ user_specs_tail = user; |
3112 |
++ } |
3113 |
++ } |
3114 |
++#endif |
3115 |
+ for (uptr = user_specs_head; uptr; uptr = uptr->next) |
3116 |
+ { |
3117 |
+ char *filename = find_a_file (&startfile_prefixes, uptr->filename, |
3118 |
|
3119 |
diff --git a/sys-devel/gcc/files/mkinfodir b/sys-devel/gcc/files/mkinfodir |
3120 |
new file mode 100644 |
3121 |
index 0000000..a62840e |
3122 |
--- /dev/null |
3123 |
+++ b/sys-devel/gcc/files/mkinfodir |
3124 |
@@ -0,0 +1,233 @@ |
3125 |
+#!/bin/bash |
3126 |
+# $Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $ |
3127 |
+# Generate the top-level Info node, given a directory of Info files |
3128 |
+# and (optionally) a skeleton file. The output will be suitable for a |
3129 |
+# top-level dir file. The skeleton file contains info topic names in the |
3130 |
+# order they should appear in the output. There are three special |
3131 |
+# lines that alter the behavior: a line consisting of just "--" causes |
3132 |
+# the next line to be echoed verbatim to the output. A line |
3133 |
+# containing just "%%" causes all the remaining filenames (wildcards |
3134 |
+# allowed) in the rest of the file to be ignored. A line containing |
3135 |
+# just "!!" exits the script when reached (unless preceded by a line |
3136 |
+# containing just "--"). Once the script reaches the end of the |
3137 |
+# skeleton file, it goes through the remaining files in the directory |
3138 |
+# in order, putting their entries at the end. The script will use the |
3139 |
+# ENTRY information in each info file if it exists. Otherwise it will |
3140 |
+# make a minimal entry. |
3141 |
+ |
3142 |
+# sent by Jeffrey Osier <jeffrey@××××××.com>, who thinks it came from |
3143 |
+# zoo@×××××××××.com (david d `zoo' zuhn) |
3144 |
+ |
3145 |
+# modified 7 April 1995 by Joe Harrington <jh@××××××××××××××××.gov> to |
3146 |
+# take special flags |
3147 |
+ |
3148 |
+INFODIR=$1 |
3149 |
+if [ $# = 2 ] ; then |
3150 |
+ SKELETON=$2 |
3151 |
+else |
3152 |
+ SKELETON=/dev/null |
3153 |
+fi |
3154 |
+ |
3155 |
+skip= |
3156 |
+ |
3157 |
+if [ $# -gt 2 ] ; then |
3158 |
+ echo usage: $0 info-directory [ skeleton-file ] 1>&2 |
3159 |
+ exit 1 |
3160 |
+elif [ -z "${INFODIR}" ] ; then |
3161 |
+ INFODIR="%%DEFAULT_INFO_DIR%%" |
3162 |
+else |
3163 |
+ true |
3164 |
+fi |
3165 |
+ |
3166 |
+if [ ! -d ${INFODIR} ] ; then |
3167 |
+ echo "$0: first argument must specify a directory" |
3168 |
+ exit 1 |
3169 |
+fi |
3170 |
+ |
3171 |
+### output the dir header |
3172 |
+echo "-*- Text -*-" |
3173 |
+echo "This file was generated automatically by $0." |
3174 |
+echo "This version was generated on `date`" |
3175 |
+echo "by `whoami`@`hostname` for `(cd ${INFODIR}; pwd)`" |
3176 |
+ |
3177 |
+cat << moobler |
3178 |
+\$Id: mkinfodir,v 1.1 2001/09/01 07:56:19 drobbins Exp $ |
3179 |
+This is the file .../info/dir, which contains the topmost node of the |
3180 |
+Info hierarchy. The first time you invoke Info you start off |
3181 |
+looking at that node, which is (dir)Top. |
3182 |
+ |
3183 |
+File: dir Node: Top This is the top of the INFO tree |
3184 |
+ |
3185 |
+ This (the Directory node) gives a menu of major topics. |
3186 |
+ Typing "q" exits, "?" lists all Info commands, "d" returns here, |
3187 |
+ "h" gives a primer for first-timers, |
3188 |
+ "mEmacs<Return>" visits the Emacs topic, etc. |
3189 |
+ |
3190 |
+ In Emacs, you can click mouse button 2 on a menu item or cross reference |
3191 |
+ to select it. |
3192 |
+ |
3193 |
+* Menu: The list of major topics begins on the next line. |
3194 |
+ |
3195 |
+moobler |
3196 |
+ |
3197 |
+### go through the list of files in the skeleton. If an info file |
3198 |
+### exists, grab the ENTRY information from it. If an entry exists |
3199 |
+### use it, otherwise create a minimal dir entry. |
3200 |
+### |
3201 |
+### Then remove that file from the list of existing files. If any |
3202 |
+### additional files remain (ones that don't have a skeleton entry), |
3203 |
+### then generate entries for those in the same way, putting the info for |
3204 |
+### those at the end.... |
3205 |
+ |
3206 |
+infofiles=`(cd ${INFODIR}; /bin/ls | grep -v '\-[0-9]*\.gz$' | grep -v '\-[0-9]*$' | egrep -v '^dir$|^dir\.info$|^dir\.orig$')` |
3207 |
+ |
3208 |
+# echoing gets clobbered by backquotes; we do it the hard way... |
3209 |
+lines=`wc $SKELETON | awk '{print $1}'` |
3210 |
+line=1 |
3211 |
+while [ $lines -ge $line ] ; do |
3212 |
+ # Read one line from the file. This is so that we can echo lines with |
3213 |
+ # whitespace and quoted characters in them. |
3214 |
+ fileline=`awk NR==$line $SKELETON` |
3215 |
+ |
3216 |
+ # flag fancy features |
3217 |
+ if [ ! -z "$echoline" ] ; then # echo line |
3218 |
+ echo "$fileline" |
3219 |
+ fileline= |
3220 |
+ echoline= |
3221 |
+ elif [ "${fileline}" = "--" ] ; then # should we echo the next line? |
3222 |
+ echoline=1 |
3223 |
+ elif [ "${fileline}" = "%%" ] ; then # eliminate remaining files from dir? |
3224 |
+ skip=1 |
3225 |
+ elif [ "${fileline}" = "!!" ] ; then # quit now |
3226 |
+ exit 0 |
3227 |
+ fi |
3228 |
+ |
3229 |
+ # handle files if they exist |
3230 |
+ for file in $fileline"" ; do # expand wildcards ("" handles blank lines) |
3231 |
+ |
3232 |
+ fname= |
3233 |
+ |
3234 |
+ if [ -z "$echoline" -a ! -z "$file" ] ; then |
3235 |
+ |
3236 |
+ # Find the file to operate upon. Check both possible names. |
3237 |
+ infoname=`echo $file | sed 's/\.gz$//'` |
3238 |
+ infoname=`echo $infoname | sed 's/\.info$//'` |
3239 |
+ noext= |
3240 |
+ ext= |
3241 |
+ if [ -f ${INFODIR}/$infoname ] ; then |
3242 |
+ noext=$infoname |
3243 |
+ fi |
3244 |
+ if [ -f ${INFODIR}/${infoname}.info ] ; then |
3245 |
+ ext=${infoname}.info |
3246 |
+ fi |
3247 |
+ if [ -f ${INFODIR}/${infoname}.info.gz ] ; then |
3248 |
+ ext=${infoname}.info.gz |
3249 |
+ fi |
3250 |
+ # If it exists with both names take what was said in the file. |
3251 |
+ if [ ! -z "$ext" -a ! -z "$noext" ]; then |
3252 |
+ fname=$file |
3253 |
+ warn="### Warning: $ext and $noext both exist! Using ${file}. ###" |
3254 |
+ elif [ ! \( -z "$ext" -a -z "$noext" \) ]; then |
3255 |
+ # just take the name if it exists only once |
3256 |
+ fname=${noext}${ext} |
3257 |
+ fi |
3258 |
+ |
3259 |
+ # if we found something and aren't skipping, do the entry |
3260 |
+ if [ ! -z "$fname" ] ; then |
3261 |
+ if [ -z "$skip" ] ; then |
3262 |
+ |
3263 |
+ if [ ! -z "$warn" ] ; then # issue any warning |
3264 |
+ echo $warn |
3265 |
+ warn= |
3266 |
+ fi |
3267 |
+ if [ "${fname##*.}" = "gz" ] ; then |
3268 |
+ entry=`zcat ${INFODIR}/${fname} | sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3269 |
+ -e '/END-INFO-DIR-ENTRY/,$d' ` |
3270 |
+ else |
3271 |
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3272 |
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$fname` |
3273 |
+ fi |
3274 |
+ if [ ! -z "${entry}" ] ; then |
3275 |
+ echo "${entry}" |
3276 |
+ else |
3277 |
+ echo "* ${infoname}: (${infoname})." |
3278 |
+ fi |
3279 |
+ fi |
3280 |
+ |
3281 |
+ # remove the name from the directory listing |
3282 |
+ infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${fname} / /" -e "s/ / /g"` |
3283 |
+ |
3284 |
+ fi |
3285 |
+ |
3286 |
+ fi |
3287 |
+ |
3288 |
+ done |
3289 |
+ |
3290 |
+ line=`expr $line + 1` |
3291 |
+done |
3292 |
+ |
3293 |
+if [ -z "${infofiles}" ] ; then |
3294 |
+ exit 0 |
3295 |
+elif [ $lines -gt 0 ]; then |
3296 |
+ echo |
3297 |
+fi |
3298 |
+ |
3299 |
+# Sort remaining files by INFO-DIR-SECTION. |
3300 |
+prevsect= |
3301 |
+filesectdata=`(cd ${INFODIR}; fgrep INFO-DIR-SECTION /dev/null ${infofiles} | \ |
3302 |
+ fgrep -v 'INFO-DIR-SECTION Miscellaneous' | \ |
3303 |
+ sort -t: -k2 -k1 | tr ' ' '_')` |
3304 |
+for sectdata in ${filesectdata}; do |
3305 |
+ file=`echo ${sectdata} | cut -d: -f1` |
3306 |
+ section=`sed -n -e 's/^INFO-DIR-SECTION //p' ${INFODIR}/${file}` |
3307 |
+ infofiles=`echo "" ${infofiles} "" | sed -e "s/ ${file} / /" -e "s/ / /g"` |
3308 |
+ |
3309 |
+ if [ "${prevsect}" != "${section}" ] ; then |
3310 |
+ if [ ! -z "${prevsect}" ] ; then |
3311 |
+ echo "" |
3312 |
+ fi |
3313 |
+ echo "${section}" |
3314 |
+ prevsect="${section}" |
3315 |
+ fi |
3316 |
+ infoname=`echo $file | sed 's/\.gz$//'` |
3317 |
+ infoname=`echo $infoname | sed 's/\.info$//'` |
3318 |
+ if [ "${file##*.}" = "gz" ] ; then |
3319 |
+ entry=`zcat ${INFODIR}/$file | sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3320 |
+ -e '/END-INFO-DIR-ENTRY/,$d' ` |
3321 |
+ else |
3322 |
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3323 |
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file` |
3324 |
+ fi |
3325 |
+ if [ ! -z "${entry}" ] ; then |
3326 |
+ echo "${entry}" |
3327 |
+ elif [ ! -d "${INFODIR}/${file}" ] ; then |
3328 |
+ echo "* ${infoname}: (${infoname})." |
3329 |
+ fi |
3330 |
+done |
3331 |
+ |
3332 |
+# Process miscellaneous files. |
3333 |
+for file in ${infofiles}; do |
3334 |
+ if [ ! -z "${prevsect}" ] ; then |
3335 |
+ echo "" |
3336 |
+ echo "Miscellaneous" |
3337 |
+ prevsect="" |
3338 |
+ fi |
3339 |
+ |
3340 |
+ infoname=`echo $file | sed 's/\.gz$//'` |
3341 |
+ infoname=`echo $infoname | sed 's/\.info$//'` |
3342 |
+ if [ "${file##*.}" = "gz" ] ; then |
3343 |
+ entry=`zcat ${INFODIR}/${file} | sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3344 |
+ -e '/END-INFO-DIR-ENTRY/,$d'` |
3345 |
+ else |
3346 |
+ entry=`sed -e '1,/START-INFO-DIR-ENTRY/d' \ |
3347 |
+ -e '/END-INFO-DIR-ENTRY/,$d' ${INFODIR}/$file` |
3348 |
+ fi |
3349 |
+ |
3350 |
+ |
3351 |
+ if [ ! -z "${entry}" ] ; then |
3352 |
+ echo "${entry}" |
3353 |
+ elif [ ! -d "${INFODIR}/${file}" ] ; then |
3354 |
+ echo "* ${infoname}: (${infoname})." |
3355 |
+ fi |
3356 |
+done |
3357 |
+ |
3358 |
|
3359 |
diff --git a/sys-devel/gcc/gcc-9999.ebuild b/sys-devel/gcc/gcc-9999.ebuild |
3360 |
new file mode 100644 |
3361 |
index 0000000..b6b5078 |
3362 |
--- /dev/null |
3363 |
+++ b/sys-devel/gcc/gcc-9999.ebuild |
3364 |
@@ -0,0 +1,30 @@ |
3365 |
+# Copyright 1999-2012 Gentoo Foundation |
3366 |
+# Distributed under the terms of the GNU General Public License v2 |
3367 |
+# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc/gcc-4.6.2.ebuild,v 1.9 2012/03/15 20:21:44 vapier Exp $ |
3368 |
+ |
3369 |
+EAPI=4 |
3370 |
+ |
3371 |
+PATCH_VER="1.4" |
3372 |
+ |
3373 |
+inherit toolchain2 |
3374 |
+ |
3375 |
+DESCRIPTION="The GNU Compiler Collection" |
3376 |
+ |
3377 |
+LICENSE="GPL-3 LGPL-3 || ( GPL-3 libgcc libstdc++ gcc-runtime-library-exception-3.1 ) FDL-1.2" |
3378 |
+KEYWORDS="" |
3379 |
+ |
3380 |
+RDEPEND="" |
3381 |
+DEPEND="${RDEPEND} |
3382 |
+ elibc_glibc? ( >=sys-libs/glibc-2.8 ) |
3383 |
+ amd64? ( multilib? ( gcj? ( app-emulation/emul-linux-x86-xlibs ) ) ) |
3384 |
+ >=${CATEGORY}/binutils-2.18" |
3385 |
+ |
3386 |
+if [[ ${CATEGORY} != cross-* ]] ; then |
3387 |
+ PDEPEND="${PDEPEND} elibc_glibc? ( >=sys-libs/glibc-2.8 )" |
3388 |
+fi |
3389 |
+ |
3390 |
+#src_unpack() { |
3391 |
+# |
3392 |
+# [[ ${CHOST} == ${CTARGET} ]] && epatch "${FILESDIR}"/gcc-spec-env.patch |
3393 |
+#} |
3394 |
+ |
3395 |
|
3396 |
diff --git a/sys-devel/gcc/metadata.xml b/sys-devel/gcc/metadata.xml |
3397 |
new file mode 100644 |
3398 |
index 0000000..4980ae5 |
3399 |
--- /dev/null |
3400 |
+++ b/sys-devel/gcc/metadata.xml |
3401 |
@@ -0,0 +1,35 @@ |
3402 |
+<?xml version="1.0" encoding="UTF-8"?> |
3403 |
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> |
3404 |
+<pkgmetadata> |
3405 |
+ <herd>toolchain</herd> |
3406 |
+ <use> |
3407 |
+ <flag name="d">Enable support for the D programming language</flag> |
3408 |
+ <flag name="fixed-point">Enable fixed-point arithmetic support for MIPS targets |
3409 |
+ in gcc (Warning: significantly increases compile time!)</flag> |
3410 |
+ <flag name="go">Build the GCC Go language frontend.</flag> |
3411 |
+ <flag name="graphite">Add support for the framework for loop |
3412 |
+ optimizations based on a polyhedral intermediate representation</flag> |
3413 |
+ <flag name="gtk">Useful only when building GCJ, this enables Abstract Window Toolkit |
3414 |
+ (AWT) peer support on top of GTK+</flag> |
3415 |
+ <flag name="ip28">Enable building a compiler capable of building a kernel |
3416 |
+ for SGI Indigo2 Impact R10000 (IP28)</flag> |
3417 |
+ <flag name="ip32r10k">Enable building a compiler capable of building an |
3418 |
+ experimental kernel for SGI O2 w/ R1x000 CPUs (IP32)</flag> |
3419 |
+ <flag name="libffi">Build the portable foreign function interface library</flag> |
3420 |
+ <flag name="libssp">Build SSP support into a dedicated library rather than use the |
3421 |
+ code in the C library (DO NOT ENABLE THIS IF YOU DON'T KNOW WHAT IT DOES)</flag> |
3422 |
+ <flag name="lto">Add support for link-time optimizations (unsupported, use |
3423 |
+ at your own risk).</flag> |
3424 |
+ <flag name="mudflap">Add support for mudflap, a pointer use checking library</flag> |
3425 |
+ <flag name="multislot">Allow for SLOTs to include minor version (3.3.4 |
3426 |
+ instead of just 3.3)</flag> |
3427 |
+ <flag name="n32">Enable n32 ABI support on mips</flag> |
3428 |
+ <flag name="n64">Enable n64 ABI support on mips</flag> |
3429 |
+ <flag name="nopie">Disable PIE support (NOT FOR GENERAL USE)</flag> |
3430 |
+ <flag name="nossp">Disable SSP support (NOT FOR GENERAL USE)</flag> |
3431 |
+ <flag name="objc">Build support for the Objective C code language</flag> |
3432 |
+ <flag name="objc++">Build support for the Objective C++ language</flag> |
3433 |
+ <flag name="objc-gc">Build support for the Objective C code language Garbage |
3434 |
+ Collector</flag> |
3435 |
+ </use> |
3436 |
+</pkgmetadata> |