Gentoo Archives: gentoo-commits

From: "Fabian Groffen (grobian)" <grobian@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-devel/gcc-apple: ChangeLog gcc-apple-4.2.1_p5666.ebuild
Date: Sat, 02 Apr 2011 15:38:28
Message-Id: 20110402153818.69A1420054@flycatcher.gentoo.org
1 grobian 11/04/02 15:38:18
2
3 Modified: ChangeLog
4 Added: gcc-apple-4.2.1_p5666.ebuild
5 Log:
6 Version bump to version from Developer Tools 4.0
7
8 (Portage version: 2.2.01.18213-prefix/cvs/Darwin powerpc)
9
10 Revision Changes Path
11 1.19 sys-devel/gcc-apple/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/ChangeLog?rev=1.19&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/ChangeLog?rev=1.19&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/ChangeLog?r1=1.18&r2=1.19
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/ChangeLog,v
20 retrieving revision 1.18
21 retrieving revision 1.19
22 diff -u -r1.18 -r1.19
23 --- ChangeLog 12 Aug 2010 17:58:51 -0000 1.18
24 +++ ChangeLog 2 Apr 2011 15:38:18 -0000 1.19
25 @@ -1,6 +1,12 @@
26 # ChangeLog for sys-devel/gcc-apple
27 -# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/ChangeLog,v 1.18 2010/08/12 17:58:51 grobian Exp $
29 +# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
30 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/ChangeLog,v 1.19 2011/04/02 15:38:18 grobian Exp $
31 +
32 +*gcc-apple-4.2.1_p5666 (02 Apr 2011)
33 +
34 + 02 Apr 2011; Fabian Groffen <grobian@g.o>
35 + +gcc-apple-4.2.1_p5666.ebuild:
36 + Version bump to version from Developer Tools 4.0
37
38 *gcc-apple-4.2.1_p5664 (12 Aug 2010)
39
40
41
42
43 1.1 sys-devel/gcc-apple/gcc-apple-4.2.1_p5666.ebuild
44
45 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666.ebuild?rev=1.1&view=markup
46 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666.ebuild?rev=1.1&content-type=text/plain
47
48 Index: gcc-apple-4.2.1_p5666.ebuild
49 ===================================================================
50 # Copyright 1999-2011 Gentoo Foundation
51 # Distributed under the terms of the GNU General Public License v2
52 # $Header: /var/cvsroot/gentoo-x86/sys-devel/gcc-apple/gcc-apple-4.2.1_p5666.ebuild,v 1.1 2011/04/02 15:38:18 grobian Exp $
53
54 EAPI="3"
55
56 ETYPE="gcc-compiler"
57
58 inherit eutils toolchain flag-o-matic autotools prefix
59
60 GCC_VERS=${PV/_p*/}
61 APPLE_VERS="${PV/*_p/}.3"
62 DESCRIPTION="Apple branch of the GNU Compiler Collection, Developer Tools 4.0"
63 HOMEPAGE="http://gcc.gnu.org"
64 SRC_URI="http://www.opensource.apple.com/darwinsource/tarballs/other/gcc-${APPLE_VERS}.tar.gz
65 http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-16.tar.gz
66 http://www.opensource.apple.com/darwinsource/tarballs/other/libstdcxx-39.tar.gz
67 fortran? ( mirror://gnu/gcc/gcc-4.2.4/gcc-fortran-4.2.4.tar.bz2 )"
68 LICENSE="GPL-2 GPL-3"
69
70 case ${CHOST} in
71 *-darwin1*|i?86-*-darwin9|powerpc-*-darwin9)
72 LIBSTDCXX_APPLE_VERSION=39
73 ;;
74 *)
75 # pre Leopard has no dtrace, which is required by 37.11 and above
76 # Leopard only has 32-bits version of dtrace
77 LIBSTDCXX_APPLE_VERSION=16
78 ;;
79 esac
80
81 if is_crosscompile; then
82 SLOT="${CTARGET}-42"
83 else
84 SLOT="42"
85 fi
86
87 KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
88
89 IUSE="fortran nls +openmp objc objc++ nocxx"
90
91 RDEPEND=">=sys-libs/zlib-1.1.4
92 >=sys-libs/ncurses-5.2-r2
93 nls? ( sys-devel/gettext )
94 >=sys-devel/gcc-config-1.3.12-r4
95 fortran? (
96 >=dev-libs/gmp-4.2.1
97 >=dev-libs/mpfr-2.2.0_p10
98 )"
99 DEPEND="${RDEPEND}
100 >=sys-apps/texinfo-4.2-r4
101 >=sys-devel/bison-1.875
102 ${CATEGORY}/binutils-apple
103 >=dev-libs/mpfr-2.2.0_p10"
104
105 S=${WORKDIR}/gcc-${APPLE_VERS}
106
107 # TPREFIX is the prefix of the CTARGET installation
108 export TPREFIX=${TPREFIX:-${EPREFIX}}
109
110 LIBPATH=${EPREFIX}/usr/lib/gcc/${CTARGET}/${GCC_VERS}
111 if is_crosscompile ; then
112 BINPATH=${EPREFIX}/usr/${CHOST}/${CTARGET}/gcc-bin/${GCC_VERS}
113 else
114 BINPATH=${EPREFIX}/usr/${CTARGET}/gcc-bin/${GCC_VERS}
115 fi
116 STDCXX_INCDIR=${LIBPATH}/include/g++-v${GCC_VERS/\.*/}
117
118 src_unpack() {
119 # override toolchain.eclass func
120 unpack ${A}
121 }
122
123 src_prepare() {
124 # Support for fortran
125 if use fortran ; then
126 mv "${WORKDIR}"/gcc-4.2.4/gcc/fortran gcc/ || die
127 mv "${WORKDIR}"/gcc-4.2.4/libgfortran . || die
128 # from: substracted from http://r.research.att.com/tools/
129 epatch "${FILESDIR}"/${PN}-4.2.1_p5646-gfortran.patch
130 fi
131
132 # move in libstdc++
133 mv "${WORKDIR}"/libstdcxx-${LIBSTDCXX_APPLE_VERSION}/libstdcxx/libstdc++-v3 .
134 if [[ ${LIBSTDCXX_APPLE_VERSION} == 16 ]] ; then
135 epatch "${FILESDIR}"/libstdc++-${LIBSTDCXX_APPLE_VERSION}.patch # does it apply on 37?
136 sed -i -e 's/__block\([^_]\)/__blk\1/g' \
137 libstdc++-v3/include/ext/mt_allocator.h \
138 libstdc++-v3/src/mt_allocator.cc || die "conflict fix failed"
139 fi
140
141 # we use our libtool
142 sed -i -e "s:/usr/bin/libtool:${EPREFIX}/usr/bin/${CTARGET}-libtool:" \
143 gcc/config/darwin.h || die "sed gcc/config/darwin.h failed"
144 # add prefixed Frameworks to default search paths (may want to change this
145 # in a cross-compile)
146 sed -i -e "/\"\/System\/Library\/Frameworks\"\,/i\ \ \"${EPREFIX}/Frameworks\"\, " \
147 gcc/config/darwin-c.c || die "sed gcc/config/darwin-c.c failed"
148
149 # Workaround deprecated "+Nc" syntax for GNU tail(1)
150 sed -i -e "s:tail +16c:tail -c +16:g" \
151 gcc/Makefile.in || die "sed gcc/Makefile.in failed."
152
153 epatch "${FILESDIR}"/${PN}-4.0.1_p5465-default-altivec.patch
154
155 # dsymutil stuff breaks on 10.4/x86, revert it
156 [[ ${CHOST} == *86*-apple-darwin8 ]] && \
157 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-dsymutil.patch
158
159 # bootstrapping might fail with host provided gcc on 10.4/x86
160 if ! is_crosscompile && ! echo "int main(){return 0;}" | gcc -o "${T}"/foo \
161 -mdynamic-no-pic -x c - >/dev/null 2>&1;
162 then
163 einfo "-mdynamic-no-pic doesn't work - disabling..."
164 echo "BOOT_CFLAGS=-g -O2" > config/mh-x86-darwin
165 XD=gcc/config/i386/x-darwin
166 awk 'BEGIN{x=1}{if ($0 ~ "use -mdynamic-no-pic to build x86")
167 {x=1-x} else if (x) print}' $XD > t && mv t $XD \
168 || die "Failed to rewrite $XD"
169 fi
170
171 epatch "${FILESDIR}"/${PN}-4.2.1-prefix-search-dirs.patch
172 eprefixify "${S}"/gcc/gcc.c
173
174 if use !bootstrap ; then
175 # this only occurs with up-to-date tools from the Prefix, and actually
176 # breaks the bootstrap since the autoconf needs a very recent automake
177 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-texinfo.patch
178 epatch "${FILESDIR}"/${PN}-${GCC_VERS}-autoconf-m4-precious.patch
179 cd "${S}"/gcc && eautoconf
180 cd "${S}"/libgomp && eautoconf
181 fi
182
183 local BRANDING_GCC_PKGVERSION="$(sed -n -e '/^#define VERSUFFIX/s/^[^"]*"\([^"]\+\)".*$/\1/p' "${S}"/gcc/version.c)"
184 BRANDING_GCC_PKGVERSION=${BRANDING_GCC_PKGVERSION/(/(Gentoo ${PVR}, }
185 einfo "patching gcc version: ${GCC_VERS}${BRANDING_GCC_PKGVERSION}"
186
187 sed -i -e "s~VERSUFFIX \"[^\"]*~VERSUFFIX \"${BRANDING_GCC_PKGVERSION}~" \
188 "${S}"/gcc/version.c || die "failed to update VERSUFFIX with Gentoo branding"
189 sed -i -e 's~developer\.apple\.com\/bugreporter~bugs\.gentoo\.org\/~' \
190 "${S}"/gcc/version.c || die "Failed to change the bug URL"
191 }
192
193 src_configure() {
194 local langs="c"
195 use nocxx || langs="${langs},c++"
196 use objc && langs="${langs},objc"
197 use objc++ && langs="${langs/,objc/},objc,obj-c++" # need objc with objc++
198 use fortran && langs="${langs},fortran"
199
200 local myconf="${myconf} \
201 --prefix=${EPREFIX}/usr \
202 --bindir=${BINPATH} \
203 --includedir=${LIBPATH}/include \
204 --datadir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS} \
205 --mandir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/man \
206 --infodir=${EPREFIX}/usr/share/gcc-data/${CTARGET}/${GCC_VERS}/info \
207 --with-gxx-include-dir=${STDCXX_INCDIR} \
208 --host=${CHOST}
209 --enable-version-specific-runtime-libs"
210
211 if is_crosscompile ; then
212 # Straight from the GCC install doc:
213 # "GCC has code to correctly determine the correct value for target
214 # for nearly all native systems. Therefore, we highly recommend you
215 # not provide a configure target when configuring a native compiler."
216 myconf="${myconf} --target=${CTARGET}"
217
218 # Tell compiler where to find what it needs
219 myconf="${myconf} --with-sysroot=${EPREFIX}/usr/${CTARGET}"
220
221 # Set this to something sane for both native and target
222 CFLAGS="-O2 -pipe"
223
224 local VAR="CFLAGS_"${CTARGET//-/_}
225 CXXFLAGS=${!VAR}
226 fi
227 [[ -n ${CBUILD} ]] && myconf="${myconf} --build=${CBUILD}"
228
229 # Native Language Support
230 if use nls ; then
231 myconf="${myconf} --enable-nls --without-included-gettext"
232 else
233 myconf="${myconf} --disable-nls"
234 fi
235
236 # reasonably sane globals (hopefully)
237 myconf="${myconf} \
238 --with-system-zlib \
239 --disable-checking \
240 --disable-werror"
241
242 # ???
243 myconf="${myconf} --enable-shared --enable-threads=posix"
244
245 # make clear we're in an offset
246 use prefix && myconf="${myconf} --with-local-prefix=${TPREFIX}/usr"
247
248 # we don't use a GNU linker, so tell GCC where to find the linker stuff we
249 # want it to use
250 myconf="${myconf} \
251 --with-as=${EPREFIX}/usr/bin/${CTARGET}-as \
252 --with-ld=${EPREFIX}/usr/bin/${CTARGET}-ld"
253
254 # make sure we never do multilib stuff, for that we need a different Prefix
255 [[ -z ${I_KNOW_WHAT_IM_DOING_I_WANT_APPLE_MULTILIB} ]] \
256 && myconf="${myconf} --disable-multilib"
257
258 myconf="${myconf} --enable-languages=${langs} $(use_enable openmp libgomp)"
259
260 # The produced libgcc_s.dylib is faulty if using a bit too much
261 # optimisation. Nail it down to something sane
262 CFLAGS="-O2 -pipe"
263 CXXFLAGS=${CFLAGS}
264
265 # http://gcc.gnu.org/ml/gcc-patches/2006-11/msg00765.html
266 # (won't hurt if already 64-bits, but is essential when coming from a
267 # multilib compiler -- the default)
268 [[ ${CTARGET} == powerpc64-* || ${CTARGET} == x86_64-* ]] && \
269 export CC="gcc -m64"
270
271 mkdir -p "${WORKDIR}"/build
272 cd "${WORKDIR}"/build
273 einfo "Configuring GCC with: ${myconf//--/\n\t--}"
274 "${S}"/configure ${myconf} || die "conf failed"
275 }
276
277 src_compile() {
278 cd "${WORKDIR}"/build || die
279 emake bootstrap || die "emake failed"
280 }
281
282 src_install() {
283 cd "${WORKDIR}"/build
284 # -jX doesn't work
285 emake -j1 DESTDIR="${D}" install || die
286
287 # Punt some tools which are really only useful while building gcc
288 find "${ED}" -name install-tools -prune -type d -exec rm -rf "{}" \;
289 # This one comes with binutils
290 find "${ED}" -name libiberty.a -exec rm -f "{}" \;
291
292 # Basic sanity check
293 if ! is_crosscompile ; then
294 local EXEEXT
295 eval $(grep ^EXEEXT= "${WORKDIR}"/build/gcc/config.log)
296 [[ -r ${D}${BINPATH}/gcc${EXEEXT} ]] || die "gcc not found in ${ED}"
297 fi
298
299 # create gcc-config entry
300 dodir /etc/env.d/gcc
301 local gcc_envd_base="/etc/env.d/gcc/${CHOST}-${GCC_VERS}"
302
303 gcc_envd_file="${ED}${gcc_envd_base}"
304
305 # phase PATH/ROOTPATH out ...
306 echo "PATH=\"${BINPATH}\"" > ${gcc_envd_file}
307 echo "ROOTPATH=\"${BINPATH}\"" >> ${gcc_envd_file}
308 echo "GCC_PATH=\"${BINPATH}\"" >> ${gcc_envd_file}
309
310 # we don't do multilib
311 LDPATH="${LIBPATH}"
312 echo "LDPATH=\"${LDPATH}\"" >> ${gcc_envd_file}
313 echo "MANPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/man\"" >> ${gcc_envd_file}
314 echo "INFOPATH=\"${EPREFIX}/usr/share/gcc-data/${CHOST}/${GCC_VERS}/info\"" >> ${gcc_envd_file}
315 echo "STDCXX_INCDIR=\"g++-v${GCC_VERS/\.*/}\"" >> ${gcc_envd_file}
316 is_crosscompile && echo "CTARGET=${CTARGET}" >> ${gcc_envd_file}
317
318 # Move <cxxabi.h> to compiler-specific directories
319 [[ -f ${D}${STDCXX_INCDIR}/cxxabi.h ]] && \
320 mv -f "${D}"${STDCXX_INCDIR}/cxxabi.h "${D}"${LIBPATH}/include/
321
322 # These should be symlinks
323 dodir /usr/bin
324 cd "${D}"${BINPATH}
325 for x in cpp gcc g++ c++ g77 gcj gcjh gfortran ; do
326 # For some reason, g77 gets made instead of ${CTARGET}-g77...
327 # this should take care of that
328 [[ -f ${x} ]] && mv ${x} ${CTARGET}-${x}
329
330 if [[ -f ${CTARGET}-${x} ]] && ! is_crosscompile ; then
331 ln -sf ${CTARGET}-${x} ${x}
332
333 # Create version-ed symlinks
334 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
335 /usr/bin/${CTARGET}-${x}-${GCC_VERS}
336 dosym ${BINPATH#${EPREFIX}}/${CTARGET}-${x} \
337 /usr/bin/${x}-${GCC_VERS}
338 fi
339
340 if [[ -f ${CTARGET}-${x}-${GCC_VERS} ]] ; then
341 rm -f ${CTARGET}-${x}-${GCC_VERS}
342 ln -sf ${CTARGET}-${x} ${CTARGET}-${x}-${GCC_VERS}
343 fi
344 done
345
346 # I do not know if this will break gcj stuff, so I'll only do it for
347 # objc for now; basically "ffi.h" is the correct file to include,
348 # but it gets installed in .../GCCVER/include and yet it does
349 # "#include <ffitarget.h>" which (correctly, as it's an "extra" file)
350 # is installed in .../GCCVER/include/libffi; the following fixes
351 # ffi.'s include of ffitarget.h - Armando Di Cianno <fafhrd@g.o>
352 if [[ -d ${D}${LIBPATH}/include/libffi ]] ; then
353 mv -i "${D}"${LIBPATH}/include/libffi/* "${D}"${LIBPATH}/include || die
354 rm -r "${D}"${LIBPATH}/include/libffi || die
355 fi
356
357 # Now do the fun stripping stuff
358 env RESTRICT="" CHOST=${CHOST} prepstrip "${D}${BINPATH}"
359 env RESTRICT="" CHOST=${CTARGET} prepstrip "${D}${LIBPATH}"
360 # gcc used to install helper binaries in lib/ but then moved to libexec/
361 [[ -d ${ED}/usr/libexec/gcc ]] && \
362 env RESTRICT="" CHOST=${CHOST} prepstrip "${ED}/usr/libexec/gcc/${CTARGET}/${GCC_VERS}"
363
364 # prune empty dirs left behind
365 find "${ED}" -type d | xargs rmdir >& /dev/null
366 }
367
368 pkg_postinst() {
369 # beware this also switches when it's on another branch version of GCC
370 gcc-config ${CTARGET}-${GCC_VERS}
371 }
372
373 pkg_postrm() {
374 # clean up the cruft left behind by cross-compilers
375 if is_crosscompile ; then
376 if [[ -z $(ls "${EROOT}"/etc/env.d/gcc/${CTARGET}* 2>/dev/null) ]] ; then
377 rm -f "${EROOT}"/etc/env.d/gcc/config-${CTARGET}
378 rm -f "${EROOT}"/etc/env.d/??gcc-${CTARGET}
379 rm -f "${EROOT}"/usr/bin/${CTARGET}-{gcc,{g,c}++}{,32,64}
380 fi
381 return 0
382 fi
383 }