Gentoo Archives: gentoo-commits

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