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/binutils-apple: binutils-apple-3.1.1.ebuild ChangeLog binutils-apple-3.1.2.ebuild metadata.xml binutils-apple-3.1.2-r1.ebuild
Date: Sun, 21 Jun 2009 10:06:55
Message-Id: E1MIJwq-0005vS-5Q@stork.gentoo.org
1 grobian 09/06/21 10:06:52
2
3 Added: binutils-apple-3.1.1.ebuild ChangeLog
4 binutils-apple-3.1.2.ebuild metadata.xml
5 binutils-apple-3.1.2-r1.ebuild
6 Log:
7 add sys-devel/binutils-apple from Gentoo Prefix tree
8 (Portage version: 2.1.6.13/cvs/Linux x86_64)
9
10 Revision Changes Path
11 1.1 sys-devel/binutils-apple/binutils-apple-3.1.1.ebuild
12
13 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.1.ebuild?rev=1.1&view=markup
14 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.1.ebuild?rev=1.1&content-type=text/plain
15
16 Index: binutils-apple-3.1.1.ebuild
17 ===================================================================
18 # Copyright 1999-2009 Gentoo Foundation
19 # Distributed under the terms of the GNU General Public License v2
20 # $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.1.ebuild,v 1.1 2009/06/21 10:06:52 grobian Exp $
21
22 inherit eutils flag-o-matic toolchain-funcs
23
24 RESTRICT="test mirror" # the test suite will test what's installed.
25
26 LD64=ld64-85.2.2
27 CCTOOLS=cctools-698
28
29 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools 3.1.1"
30 HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
31 SRC_URI="http://www.gentoo.org/~grobian/distfiles/${LD64}.tar.gz
32 http://www.gentoo.org/~grobian/distfiles/${CCTOOLS}.tar.gz"
33
34 LICENSE="APSL-2"
35 KEYWORDS="~ppc-macos ~x86-macos"
36 IUSE="test"
37 SLOT="0"
38
39 DEPEND="sys-devel/binutils-config
40 test? ( >=dev-lang/perl-5.8.8 )"
41 RDEPEND="${DEPEND}"
42
43 export CTARGET=${CTARGET:-${CHOST}}
44 if [[ ${CTARGET} == ${CHOST} ]] ; then
45 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
46 export CTARGET=${CATEGORY/cross-}
47 fi
48 fi
49 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
50
51 if is_cross ; then
52 SLOT="${CTARGET}"
53 else
54 SLOT="0"
55 fi
56
57 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
58 INCPATH=${LIBPATH}/include
59 DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
60 if is_cross ; then
61 BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
62 else
63 BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
64 fi
65
66 S=${WORKDIR}
67
68 unpack_ld64() {
69 cd "${S}"/${LD64}/src
70 cp "${FILESDIR}"/Makefile .
71
72 local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64}\\n\""
73 sed -i \
74 -e '/^#define LTO_SUPPORT 1/s:1:0:' \
75 ObjectDump.cpp
76 echo '#undef LTO_SUPPORT' > configure.h
77 echo "char ldVersionString[] = ${VER_STR};" > version.cpp
78
79 # clean up test suite
80 cd "${S}"/${LD64}/unit-tests/test-cases
81 local c
82
83 # we don't have llvm
84 ((++c)); rm -rf llvm-integration;
85
86 # we don't have dtrace
87 ((++c)); rm -rf dtrace-static-probes-coalescing;
88 ((++c)); rm -rf dtrace-static-probes;
89
90 # a file is missing
91 ((++c)); rm -rf eh-coalescing-r
92
93 # we don't do universal binaries
94 ((++c)); rm -rf blank-stubs;
95
96 # looks like a problem with apple's result-filter.pl
97 ((++c)); rm -rf implicit-common3;
98 ((++c)); rm -rf order_file-ans;
99
100 # TODO no idea what goes wrong here
101 ((++c)); rm -rf dwarf-debug-notes;
102
103 elog "Deleted $c tests that were bound to fail"
104 }
105
106 src_unpack() {
107 unpack ${A}
108 unpack_ld64
109 cd "${S}"
110
111 epatch "${FILESDIR}"/${P}-as.patch
112 epatch "${FILESDIR}"/${P}-as-dir.patch
113 epatch "${FILESDIR}"/${P}-ranlib.patch
114 epatch "${FILESDIR}"/${P}-libtool-ranlib.patch
115 epatch "${FILESDIR}"/${P}-nmedit.patch
116 epatch "${FILESDIR}"/${P}-no-efi-man.patch
117 epatch "${FILESDIR}"/${P}-no-headers.patch
118 epatch "${FILESDIR}"/${P}-no-oss-dir.patch
119 epatch "${FILESDIR}"/${P}-testsuite.patch
120
121 # -pg is used and the two are incompatible
122 filter-flags -fomit-frame-pointer
123 }
124
125 compile_ld64() {
126 cd "${S}"/${LD64}/src
127 # 'struct linkedit_data_command' is defined in mach-o/loader.h on leopard,
128 # but not on tiger.
129 [[ ${CHOST} == *-apple-darwin8 ]] && \
130 append-flags -isystem "${S}"/${CCTOOLS}/include/
131 emake
132 use test && emake build_test
133 }
134
135 compile_cctools() {
136 cd "${S}"/${CCTOOLS}
137 emake \
138 LTO= \
139 EFITOOLS= \
140 COMMON_SUBDIRS='libstuff ar misc otool' \
141 RC_CFLAGS="${CFLAGS}"
142 cd "${S}"/${CCTOOLS}/as
143 # the errors can be ignored
144 emake -k \
145 BUILD_OBSOLETE_ARCH= \
146 RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}"
147 emake \
148 BUILD_OBSOLETE_ARCH= \
149 RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}"
150 }
151
152 src_compile() {
153 compile_cctools
154 compile_ld64
155 }
156
157 install_ld64() {
158 exeinto ${BINPATH}
159 doexe "${S}"/${LD64}/src/{ld64,rebase}
160 dosym ld64 ${BINPATH}/ld
161 insinto ${DATAPATH}/man/man1
162 doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
163 }
164
165 install_cctools() {
166 cd "${S}"/${CCTOOLS}
167 emake install_all_but_headers \
168 EFITOOLS= \
169 COMMON_SUBDIRS='ar misc otool' \
170 DSTROOT=\"${D}\" \
171 BINDIR=\"${EPREFIX}\"${BINPATH} \
172 LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
173 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
174 LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
175 MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
176 cd "${S}"/${CCTOOLS}/as
177 emake install \
178 BUILD_OBSOLETE_ARCH= \
179 DSTROOT=\"${D}\" \
180 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
181 LIBDIR=\"${EPREFIX}\"${LIBPATH}
182
183 cd "${ED}"${BINPATH}
184 insinto ${DATAPATH}/man/man1
185 local skips manpage
186 # ar brings an up-to-date manpage with it
187 skips=( ar )
188 for bin in *; do
189 for skip in ${skips[@]}; do
190 if [[ ${bin} == ${skip} ]]; then
191 continue 2;
192 fi
193 done
194 manpage=${S}/${CCTOOLS}/man/${bin}.1
195 if [[ -f "${manpage}" ]]; then
196 doins "${manpage}"
197 fi
198 done
199 insinto ${DATAPATH}/man/man5
200 doins "${S}"/${CCTOOLS}/man/*.5
201 }
202
203 src_test() {
204 cd "${S}"/${LD64}/unit-tests/test-cases
205 # need host arch, since GNU arch doesn't do what Apple's does
206 tc-export CC CXX
207 perl ../bin/make-recursive.pl \
208 ARCH="$(/usr/bin/arch)" \
209 RELEASEDIR="${S}"/${LD64}/src \
210 | perl ../bin/result-filter.pl
211 }
212
213 src_install() {
214 install_ld64
215 install_cctools
216
217 cd "${S}"
218 insinto /etc/env.d/binutils
219 cat <<-EOF > env.d
220 TARGET="${CHOST}"
221 VER="${PV}"
222 FAKE_TARGETS="${CHOST}"
223 EOF
224 newins env.d ${CHOST}-${PV}
225 }
226
227 pkg_postinst() {
228 binutils-config ${CHOST}-${PV}
229 }
230
231
232
233 1.1 sys-devel/binutils-apple/ChangeLog
234
235 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/ChangeLog?rev=1.1&view=markup
236 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/ChangeLog?rev=1.1&content-type=text/plain
237
238 Index: ChangeLog
239 ===================================================================
240 # ChangeLog for sys-devel/binutils-apple
241 # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2
242 # $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/ChangeLog,v 1.1 2009/06/21 10:06:52 grobian Exp $
243
244 *binutils-apple-3.1.2-r1 (01 Jun 2009)
245
246 01 Jun 2009; Fabian Groffen <grobian@g.o>
247 +binutils-apple-3.1.2-r1.ebuild:
248 Version bump for 64-bits native testing purposes, not yet ready for
249 prime-time
250
251 01 Jan 2009; Fabian Groffen <grobian@g.o>
252 +files/binutils-apple-3.1.2-as-Makefile.patch,
253 binutils-apple-3.1.2.ebuild, binutils-apple-3.1.2.ebuild:
254 Add patch to avoid having to do a make -k
255
256 *binutils-apple-3.1.2 (21 Dec 2008)
257
258 21 Dec 2008; Fabian Groffen <grobian@g.o>
259 binutils-apple-3.1.2.ebuild, ChangeLog:
260 Version bump to Xcode Tools 3.1.2
261
262 *binutils-apple-3.1.1 (08 Oct 2008)
263
264 08 Oct 2008; Fabian Groffen <grobian@g.o>
265 +files/binutils-apple-3.1.1-as-dir.patch,
266 +files/binutils-apple-3.1.1-libtool-ranlib.patch,
267 +files/binutils-apple-3.1.1-ranlib.patch,
268 -files/20080922-libtool-ranlib.patch,
269 +files/binutils-apple-3.1.1-no-efi-man.patch, -files/20080922-as.patch,
270 -files/20080922-as-dir.patch, -files/20080922-nmedit.patch,
271 +files/binutils-apple-3.1.1-no-oss-dir.patch,
272 -files/20080922-no-efi-man.patch, -files/20080922-no-oss-dir.patch,
273 -files/20080922-ranlib.patch, +files/binutils-apple-3.1.1-as.patch,
274 +files/binutils-apple-3.1.1-nmedit.patch,
275 -files/20080922-no-headers.patch,
276 +files/binutils-apple-3.1.1-no-headers.patch,
277 -files/20080922-testsuite.patch,
278 +files/binutils-apple-3.1.1-testsuite.patch, +binutils-apple-3.1.1.ebuild,
279 -binutils-apple-20080922.ebuild:
280 Reversion to binutils-apple-3.1.1 matching Xcode release it comes from.
281
282 03 Oct 2008; Fabian Groffen <grobian@g.o>
283 +files/20080922-as-dir.patch, +files/Makefile,
284 binutils-apple-20080922.ebuild:
285 Add latest patches by Elias Pipping to get as behave nicely.
286
287 28 Sep 2008; Fabian Groffen <grobian@g.o>
288 +files/20080922-no-headers.patch, binutils-apple-20080922.ebuild:
289 Add patch from pipping to remove obsolete headers, manpages and includes
290
291 28 Sep 2008; Fabian Groffen <grobian@g.o>
292 +files/20080922-libtool-ranlib.patch, binutils-apple-20080922.ebuild:
293 Add patch to make libtool better detect whether it's called as ranlib
294
295 28 Sep 2008; Fabian Groffen <grobian@g.o> +files/20080922-as.patch,
296 binutils-apple-20080922.ebuild:
297 Two patches by Elias pipping: 1) fix version string of ld64 2) no longer
298 build hppa, sparc, etc. assemblers.
299
300 *binutils-apple-20080922 (27 Sep 2008)
301
302 27 Sep 2008; Fabian Groffen <grobian@g.o> +.,
303 +files/20080922-nmedit.patch, +files/20080922-no-oss-dir.patch, +files,
304 +files/20080922-no-efi-man.patch, +files/20080922-ranlib.patch,
305 +files/20080922-testsuite.patch, +metadata.xml,
306 +binutils-apple-20080922.ebuild:
307 Initial import of binutils-apple, Apple's linker tools, based on the work by
308 Elias Pipping in bug #238601. Not ready for public consumption.
309
310
311
312
313 1.1 sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild
314
315 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild?rev=1.1&view=markup
316 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild?rev=1.1&content-type=text/plain
317
318 Index: binutils-apple-3.1.2.ebuild
319 ===================================================================
320 # Copyright 1999-2009 Gentoo Foundation
321 # Distributed under the terms of the GNU General Public License v2
322 # $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2.ebuild,v 1.1 2009/06/21 10:06:52 grobian Exp $
323
324 inherit eutils flag-o-matic toolchain-funcs
325
326 RESTRICT="test" # the test suite will test what's installed.
327
328 LD64=ld64-85.2.1
329 CCTOOLS=cctools-698.1
330
331 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools 3.1.2"
332 HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
333 SRC_URI="http://www.gentoo.org/~grobian/distfiles/${LD64}.tar.gz
334 http://www.gentoo.org/~grobian/distfiles/${CCTOOLS}.tar.gz"
335
336 LICENSE="APSL-2"
337 KEYWORDS="~ppc-macos ~x86-macos"
338 IUSE="test"
339 SLOT="0"
340
341 DEPEND="sys-devel/binutils-config
342 test? ( >=dev-lang/perl-5.8.8 )"
343 RDEPEND="${DEPEND}"
344
345 export CTARGET=${CTARGET:-${CHOST}}
346 if [[ ${CTARGET} == ${CHOST} ]] ; then
347 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
348 export CTARGET=${CATEGORY/cross-}
349 fi
350 fi
351 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
352
353 if is_cross ; then
354 SLOT="${CTARGET}"
355 else
356 SLOT="0"
357 fi
358
359 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
360 INCPATH=${LIBPATH}/include
361 DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
362 if is_cross ; then
363 BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
364 else
365 BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
366 fi
367
368 S=${WORKDIR}
369
370 unpack_ld64() {
371 cd "${S}"/${LD64}/src
372 cp "${FILESDIR}"/Makefile .
373
374 local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64}\\n\""
375 sed -i \
376 -e '/^#define LTO_SUPPORT 1/s:1:0:' \
377 ObjectDump.cpp
378 echo '#undef LTO_SUPPORT' > configure.h
379 echo "char ldVersionString[] = ${VER_STR};" > version.cpp
380
381 # clean up test suite
382 cd "${S}"/${LD64}/unit-tests/test-cases
383 local c
384
385 # we don't have llvm
386 ((++c)); rm -rf llvm-integration;
387
388 # we don't have dtrace
389 ((++c)); rm -rf dtrace-static-probes-coalescing;
390 ((++c)); rm -rf dtrace-static-probes;
391
392 # a file is missing
393 ((++c)); rm -rf eh-coalescing-r
394
395 # we don't do universal binaries
396 ((++c)); rm -rf blank-stubs;
397
398 # looks like a problem with apple's result-filter.pl
399 ((++c)); rm -rf implicit-common3;
400 ((++c)); rm -rf order_file-ans;
401
402 # TODO no idea what goes wrong here
403 ((++c)); rm -rf dwarf-debug-notes;
404
405 elog "Deleted $c tests that were bound to fail"
406 }
407
408 src_unpack() {
409 unpack ${A}
410 unpack_ld64
411
412 cd "${S}"/${CCTOOLS}
413 epatch "${FILESDIR}"/${PN}-3.1.1-as.patch
414 epatch "${FILESDIR}"/${PN}-3.1.1-as-dir.patch
415 epatch "${FILESDIR}"/${PN}-3.1.1-ranlib.patch
416 epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
417 epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
418 epatch "${FILESDIR}"/${PN}-3.1.1-no-efi-man.patch
419 epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
420 epatch "${FILESDIR}"/${PN}-3.1.1-no-oss-dir.patch
421 epatch "${FILESDIR}"/${PN}-3.1.2-as-Makefile.patch
422 cd "${S}"/${LD64}
423 epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
424
425 # -pg is used and the two are incompatible
426 filter-flags -fomit-frame-pointer
427 }
428
429 compile_ld64() {
430 cd "${S}"/${LD64}/src
431 # 'struct linkedit_data_command' is defined in mach-o/loader.h on leopard,
432 # but not on tiger.
433 [[ ${CHOST} == *-apple-darwin8 ]] && \
434 append-flags -isystem "${S}"/${CCTOOLS}/include/
435 emake || die "emake failed for ld64"
436 use test && emake build_test
437 }
438
439 compile_cctools() {
440 cd "${S}"/${CCTOOLS}
441 emake \
442 LTO= \
443 EFITOOLS= \
444 COMMON_SUBDIRS='libstuff ar misc otool' \
445 RC_CFLAGS="${CFLAGS}" || die "emake failed for the cctools"
446 cd "${S}"/${CCTOOLS}/as
447 emake \
448 BUILD_OBSOLETE_ARCH= \
449 RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
450 || die "emake failed for as"
451 }
452
453 src_compile() {
454 compile_cctools
455 compile_ld64
456 }
457
458 install_ld64() {
459 exeinto ${BINPATH}
460 doexe "${S}"/${LD64}/src/{ld64,rebase}
461 dosym ld64 ${BINPATH}/ld
462 insinto ${DATAPATH}/man/man1
463 doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
464 }
465
466 install_cctools() {
467 local ED=${ED-${D}}
468
469 cd "${S}"/${CCTOOLS}
470 emake install_all_but_headers \
471 EFITOOLS= \
472 COMMON_SUBDIRS='ar misc otool' \
473 DSTROOT=\"${D}\" \
474 BINDIR=\"${EPREFIX}\"${BINPATH} \
475 LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
476 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
477 LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
478 MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
479 cd "${S}"/${CCTOOLS}/as
480 emake install \
481 BUILD_OBSOLETE_ARCH= \
482 DSTROOT=\"${D}\" \
483 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
484 LIBDIR=\"${EPREFIX}\"${LIBPATH}
485
486 cd "${ED}"${BINPATH}
487 insinto ${DATAPATH}/man/man1
488 local skips manpage
489 # ar brings an up-to-date manpage with it
490 skips=( ar )
491 for bin in *; do
492 for skip in ${skips[@]}; do
493 if [[ ${bin} == ${skip} ]]; then
494 continue 2;
495 fi
496 done
497 manpage=${S}/${CCTOOLS}/man/${bin}.1
498 if [[ -f "${manpage}" ]]; then
499 doins "${manpage}"
500 fi
501 done
502 insinto ${DATAPATH}/man/man5
503 doins "${S}"/${CCTOOLS}/man/*.5
504 }
505
506 src_test() {
507 einfo "Running unit tests"
508 cd "${S}"/${LD64}/unit-tests/test-cases
509 # need host arch, since GNU arch doesn't do what Apple's does
510 tc-export CC CXX
511 perl ../bin/make-recursive.pl \
512 ARCH="$(/usr/bin/arch)" \
513 RELEASEDIR="${S}"/${LD64}/src \
514 | perl ../bin/result-filter.pl
515 }
516
517 src_install() {
518 install_ld64
519 install_cctools
520
521 cd "${S}"
522 insinto /etc/env.d/binutils
523 cat <<-EOF > env.d
524 TARGET="${CHOST}"
525 VER="${PV}"
526 FAKE_TARGETS="${CHOST}"
527 EOF
528 newins env.d ${CHOST}-${PV}
529 }
530
531 pkg_postinst() {
532 binutils-config ${CHOST}-${PV}
533 }
534
535
536
537 1.1 sys-devel/binutils-apple/metadata.xml
538
539 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/metadata.xml?rev=1.1&view=markup
540 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/metadata.xml?rev=1.1&content-type=text/plain
541
542 Index: metadata.xml
543 ===================================================================
544 <?xml version="1.0" encoding="UTF-8"?>
545 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
546 <pkgmetadata>
547 <herd>apple</herd>
548 </pkgmetadata>
549
550
551
552 1.1 sys-devel/binutils-apple/binutils-apple-3.1.2-r1.ebuild
553
554 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2-r1.ebuild?rev=1.1&view=markup
555 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2-r1.ebuild?rev=1.1&content-type=text/plain
556
557 Index: binutils-apple-3.1.2-r1.ebuild
558 ===================================================================
559 # Copyright 1999-2009 Gentoo Foundation
560 # Distributed under the terms of the GNU General Public License v2
561 # $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/binutils-apple-3.1.2-r1.ebuild,v 1.1 2009/06/21 10:06:52 grobian Exp $
562
563 inherit eutils flag-o-matic toolchain-funcs
564
565 RESTRICT="test" # the test suite will test what's installed.
566
567 LD64=ld64-85.2.1
568 CCTOOLS=cctools-698.1
569 LP64PATCHES=binutils-apple-LP64-patches-1
570
571 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools 3.1.2"
572 HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
573 SRC_URI="http://www.gentoo.org/~grobian/distfiles/${LD64}.tar.gz
574 http://www.gentoo.org/~grobian/distfiles/${CCTOOLS}.tar.gz
575 http://www.gentoo.org/~grobian/distfiles/${LP64PATCHES}.tar.bz2"
576
577 LICENSE="APSL-2"
578 KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
579 IUSE="test"
580 SLOT="0"
581
582 DEPEND="sys-devel/binutils-config
583 test? ( >=dev-lang/perl-5.8.8 )"
584 RDEPEND="${DEPEND}"
585
586 export CTARGET=${CTARGET:-${CHOST}}
587 if [[ ${CTARGET} == ${CHOST} ]] ; then
588 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
589 export CTARGET=${CATEGORY/cross-}
590 fi
591 fi
592 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
593
594 if is_cross ; then
595 SLOT="${CTARGET}"
596 else
597 SLOT="0"
598 fi
599
600 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
601 INCPATH=${LIBPATH}/include
602 DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
603 if is_cross ; then
604 BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
605 else
606 BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
607 fi
608
609 S=${WORKDIR}
610
611 unpack_ld64() {
612 cd "${S}"/${LD64}/src
613 cp "${FILESDIR}"/Makefile .
614
615 local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
616 sed -i \
617 -e '/^#define LTO_SUPPORT 1/s:1:0:' \
618 ObjectDump.cpp || die
619 echo '#undef LTO_SUPPORT' > configure.h
620 echo "char ldVersionString[] = ${VER_STR};" > version.cpp
621
622 # clean up test suite
623 cd "${S}"/${LD64}/unit-tests/test-cases
624 local c
625
626 # we don't have llvm
627 ((++c)); rm -rf llvm-integration;
628
629 # we don't have dtrace
630 ((++c)); rm -rf dtrace-static-probes-coalescing;
631 ((++c)); rm -rf dtrace-static-probes;
632
633 # a file is missing
634 ((++c)); rm -rf eh-coalescing-r
635
636 # we don't do universal binaries
637 ((++c)); rm -rf blank-stubs;
638
639 # looks like a problem with apple's result-filter.pl
640 ((++c)); rm -rf implicit-common3;
641 ((++c)); rm -rf order_file-ans;
642
643 # TODO no idea what goes wrong here
644 ((++c)); rm -rf dwarf-debug-notes;
645
646 elog "Deleted $c tests that were bound to fail"
647 }
648
649 src_unpack() {
650 unpack ${A}
651 unpack_ld64
652
653 cd "${S}"/${CCTOOLS}
654 epatch "${FILESDIR}"/${PN}-3.1.1-as.patch
655 epatch "${FILESDIR}"/${PN}-3.1.1-as-dir.patch
656 epatch "${FILESDIR}"/${PN}-3.1.1-ranlib.patch
657 epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
658 epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
659 epatch "${FILESDIR}"/${PN}-3.1.1-no-efi-man.patch
660 epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
661 epatch "${FILESDIR}"/${PN}-3.1.1-no-oss-dir.patch
662 epatch "${FILESDIR}"/${PN}-3.1.2-as-Makefile.patch
663 epatch "${WORKDIR}"/LP64/cctools/*.patch
664 cd "${S}"/${LD64}
665 epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
666 epatch "${WORKDIR}"/LP64/ld64/*.patch
667
668 cd "${S}"
669 ebegin "cleaning Makefiles from unwanted CFLAGS"
670 find . -name "Makefile" -print0 | xargs -0 sed \
671 -i \
672 -e 's/ -g / /g' \
673 -e 's/^OFLAG =.*$/OFLAG =/' \
674 -e 's/install -c -s/install/g'
675 eend $?
676 ebegin "patching for LP64 mode"
677 ebegin " replacing SWAP_LONG() with SWAP_INT()"
678 find . -name "*.c" -print0 | xargs -0 sed \
679 -i \
680 -e 's/SWAP_LONG((long)/SWAP_INT((int)/g' \
681 -e 's/SWAP_LONG(/SWAP_INT(/g'
682 eend $?
683 ebegin " replacing sizeof(long) with sizeof(int)"
684 find . -name "*.c" -print0 | xargs -0 sed \
685 -i \
686 -e 's/sizeof(long)/sizeof(int)/g' \
687 -e 's/sizeof(unsigned long)/sizeof(unsigned int)/g' \
688 && sed -i \
689 -e '/long long \*/!s/long \*/int */g' \
690 ${CCTOOLS}/misc/{strip,lipo}.*
691 eend $?
692
693 # -pg is used and the two are incompatible
694 filter-flags -fomit-frame-pointer
695 }
696
697 compile_ld64() {
698 cd "${S}"/${LD64}/src
699 # 'struct linkedit_data_command' is defined in mach-o/loader.h on leopard,
700 # but not on tiger.
701 [[ ${CHOST} == *-apple-darwin8 ]] && \
702 append-flags -isystem "${S}"/${CCTOOLS}/include/
703 emake || die "emake failed for ld64"
704 use test && emake build_test
705 }
706
707 compile_cctools() {
708 cd "${S}"/${CCTOOLS}
709 emake \
710 LTO= \
711 EFITOOLS= \
712 COMMON_SUBDIRS='libstuff ar misc otool' \
713 RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
714 || die "emake failed for the cctools"
715 cd "${S}"/${CCTOOLS}/as
716 emake \
717 BUILD_OBSOLETE_ARCH= \
718 RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
719 || die "emake failed for as"
720 }
721
722 src_compile() {
723 compile_cctools
724 compile_ld64
725 }
726
727 install_ld64() {
728 exeinto ${BINPATH}
729 doexe "${S}"/${LD64}/src/{ld64,rebase}
730 dosym ld64 ${BINPATH}/ld
731 insinto ${DATAPATH}/man/man1
732 doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
733 }
734
735 install_cctools() {
736 local ED=${ED-${D}}
737
738 cd "${S}"/${CCTOOLS}
739 emake install_all_but_headers \
740 EFITOOLS= \
741 COMMON_SUBDIRS='ar misc otool' \
742 DSTROOT=\"${D}\" \
743 BINDIR=\"${EPREFIX}\"${BINPATH} \
744 LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
745 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
746 LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
747 MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
748 cd "${S}"/${CCTOOLS}/as
749 emake install \
750 BUILD_OBSOLETE_ARCH= \
751 DSTROOT=\"${D}\" \
752 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
753 LIBDIR=\"${EPREFIX}\"${LIBPATH}
754
755 cd "${ED}"${BINPATH}
756 insinto ${DATAPATH}/man/man1
757 local skips manpage
758 # ar brings an up-to-date manpage with it
759 skips=( ar )
760 for bin in *; do
761 for skip in ${skips[@]}; do
762 if [[ ${bin} == ${skip} ]]; then
763 continue 2;
764 fi
765 done
766 manpage=${S}/${CCTOOLS}/man/${bin}.1
767 if [[ -f "${manpage}" ]]; then
768 doins "${manpage}"
769 fi
770 done
771 insinto ${DATAPATH}/man/man5
772 doins "${S}"/${CCTOOLS}/man/*.5
773 }
774
775 src_test() {
776 einfo "Running unit tests"
777 cd "${S}"/${LD64}/unit-tests/test-cases
778 # need host arch, since GNU arch doesn't do what Apple's does
779 tc-export CC CXX
780 perl ../bin/make-recursive.pl \
781 ARCH="$(/usr/bin/arch)" \
782 RELEASEDIR="${S}"/${LD64}/src \
783 | perl ../bin/result-filter.pl
784 }
785
786 src_install() {
787 install_ld64
788 install_cctools
789
790 cd "${S}"
791 insinto /etc/env.d/binutils
792 cat <<-EOF > env.d
793 TARGET="${CHOST}"
794 VER="${PV}"
795 FAKE_TARGETS="${CHOST}"
796 EOF
797 newins env.d ${CHOST}-${PV}
798 }
799
800 pkg_postinst() {
801 binutils-config ${CHOST}-${PV}
802 }