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-4.3.ebuild ChangeLog
Date: Sun, 04 Mar 2012 16:16:28
Message-Id: 20120304161619.5C9D02004C@flycatcher.gentoo.org
1 grobian 12/03/04 16:16:19
2
3 Modified: ChangeLog
4 Added: binutils-apple-4.3.ebuild
5 Log:
6 Bump to version from Developer Tools 4.3
7
8 (Portage version: 2.2.01.20271-prefix/cvs/Darwin i386)
9
10 Revision Changes Path
11 1.30 sys-devel/binutils-apple/ChangeLog
12
13 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/ChangeLog?rev=1.30&view=markup
14 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/ChangeLog?rev=1.30&content-type=text/plain
15 diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/ChangeLog?r1=1.29&r2=1.30
16
17 Index: ChangeLog
18 ===================================================================
19 RCS file: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/ChangeLog,v
20 retrieving revision 1.29
21 retrieving revision 1.30
22 diff -u -r1.29 -r1.30
23 --- ChangeLog 4 Mar 2012 15:44:48 -0000 1.29
24 +++ ChangeLog 4 Mar 2012 16:16:19 -0000 1.30
25 @@ -1,6 +1,12 @@
26 # ChangeLog for sys-devel/binutils-apple
27 # Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
28 -# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/ChangeLog,v 1.29 2012/03/04 15:44:48 grobian Exp $
29 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/ChangeLog,v 1.30 2012/03/04 16:16:19 grobian Exp $
30 +
31 +*binutils-apple-4.3 (04 Mar 2012)
32 +
33 + 04 Mar 2012; Fabian Groffen <grobian@g.o> +binutils-apple-4.3.ebuild,
34 + +files/ld64-128.2-Makefile:
35 + Bump to version from Developer Tools 4.3
36
37 04 Mar 2012; Fabian Groffen <grobian@g.o> binutils-apple-4.2.ebuild:
38 Avoid the need for vers_string program that seems no longer to be installed
39
40
41
42 1.1 sys-devel/binutils-apple/binutils-apple-4.3.ebuild
43
44 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/binutils-apple-4.3.ebuild?rev=1.1&view=markup
45 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/sys-devel/binutils-apple/binutils-apple-4.3.ebuild?rev=1.1&content-type=text/plain
46
47 Index: binutils-apple-4.3.ebuild
48 ===================================================================
49 # Copyright 1999-2012 Gentoo Foundation
50 # Distributed under the terms of the GNU General Public License v2
51 # $Header: /var/cvsroot/gentoo-x86/sys-devel/binutils-apple/binutils-apple-4.3.ebuild,v 1.1 2012/03/04 16:16:19 grobian Exp $
52
53 EAPI="3"
54
55 inherit eutils flag-o-matic toolchain-funcs
56
57 RESTRICT="test" # the test suite will test what's installed.
58
59 LD64=ld64-128.2
60 CCTOOLS=cctools-822
61 LIBUNWIND=libunwind-30
62 DYLD=dyld-195.6
63 # http://lists.apple.com/archives/Darwin-dev/2009/Sep/msg00025.html
64 UNWIND=binutils-apple-3.2-unwind-patches-5
65
66 DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}"
67 HOMEPAGE="http://www.opensource.apple.com/darwinsource/"
68 SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz
69 http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz
70 http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz
71 http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz
72 http://www.gentoo.org/~grobian/distfiles/${UNWIND}.tar.xz
73 http://www.gentoo.org/~grobian/distfiles/libunwind-llvm-115426.tar.bz2"
74
75 LICENSE="APSL-2"
76 KEYWORDS="~ppc-macos ~x64-macos ~x86-macos"
77 IUSE="lto test"
78
79 RDEPEND="sys-devel/binutils-config
80 lto? ( sys-devel/llvm )
81 test? ( >=dev-lang/perl-5.8.8 )"
82 DEPEND="${RDEPEND}
83 >=sys-devel/gcc-apple-4.2.1"
84
85 export CTARGET=${CTARGET:-${CHOST}}
86 if [[ ${CTARGET} == ${CHOST} ]] ; then
87 if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
88 export CTARGET=${CATEGORY/cross-}
89 fi
90 fi
91 is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }
92
93 if is_cross ; then
94 SLOT="${CTARGET}-4"
95 else
96 SLOT="4"
97 fi
98
99 LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV}
100 INCPATH=${LIBPATH}/include
101 DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV}
102 if is_cross ; then
103 BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV}
104 else
105 BINPATH=/usr/${CTARGET}/binutils-bin/${PV}
106 fi
107
108 S=${WORKDIR}
109
110 src_prepare() {
111 cd "${S}"/${LIBUNWIND}/src
112 cp "${FILESDIR}"/${LIBUNWIND}-Makefile Makefile
113
114 cd "${S}"/${LD64}/src
115 cp "${FILESDIR}"/ld64-128.2-Makefile Makefile
116 epatch "${FILESDIR}"/ld64-127.2-lto.patch
117 epatch "${FILESDIR}"/ld64-127.2-ppc-range-warning.patch
118
119 ln -s ../../${CCTOOLS}/include
120 cp other/prune_trie.h include/mach-o/ || die
121 # use our own copy of lto.h, which doesn't require llvm build-env
122 mkdir -p include/llvm-c || die
123 cp "${WORKDIR}"/ld64-unwind/ld64-97.14-llvm-lto.h include/llvm-c/lto.h || die
124 # make libunwind sources known
125 ln -s ../../${LIBUNWIND}/src libunwind || die
126 cp ../../${LIBUNWIND}/include/*.h include/ || die
127 # mimic OS X Lion-style Availability.h macros
128 if [[ ${CHOST#*-darwin} -le 10 ]] ; then
129 {
130 echo "#define __OSX_AVAILABLE_STARTING(x,y) "
131 echo "#define __OSX_AVAILABLE_BUT_DEPRECATED(a,b,c,d) "
132 } > include/Availability.h
133 fi
134
135 echo '' > configure.h
136 echo '' > linker_opts
137 local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\""
138 echo "char ldVersionString[] = ${VER_STR};" > version.cpp
139
140 epatch "${FILESDIR}"/ld64-123.2-debug-backtrace.patch
141 if [[ ${CHOST} == powerpc*-darwin* ]] ; then
142 epatch "${FILESDIR}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch
143 sed -i -e '/#include <mach-o\/loader.h>/a\#include <mach/i386/thread_status.h>' \
144 ld/HeaderAndLoadCommands.hpp || die
145 fi
146 if use !lto ; then
147 sed -i -e '/#define LTO_SUPPORT 1/d' other/ObjectDump.cpp || die
148 fi
149
150 cd "${S}"/${CCTOOLS}
151 epatch "${FILESDIR}"/${PN}-4.0-as.patch
152 epatch "${FILESDIR}"/${PN}-4.2-as-dir.patch
153 epatch "${FILESDIR}"/${PN}-3.2.3-ranlib.patch
154 epatch "${FILESDIR}"/${PN}-3.1.1-libtool-ranlib.patch
155 epatch "${FILESDIR}"/${PN}-3.1.1-nmedit.patch
156 epatch "${FILESDIR}"/${PN}-3.1.1-no-headers.patch
157 epatch "${FILESDIR}"/${PN}-4.0-no-oss-dir.patch
158 epatch "${FILESDIR}"/${PN}-4.2-lto.patch
159
160 local program
161 for program in ar efitools gprof libmacho misc otool ; do
162 VER_STR="@(#)PROGRAM:${program} PROJECT:${CCTOOLS} (Gentoo ${PN}-${PVR}) DEVELOPER:${PORTAGE_ROOT_USER} BUILT:$(date)"
163 cat > ${program}/vers.c <<- _EOF
164 #include <sys/cdefs.h>
165 __IDSTRING(SGS_VERS,"${VER_STR}\n");
166 _EOF
167 [[ ${program} != "libmacho" ]] && \
168 echo '__IDSTRING(VERS_NUM,"apple");' >> ${program}/vers.c
169 done
170
171 VER_STR="${CCTOOLS} (Gentoo ${PN}-${PVR})"
172 echo "const char apple_version[] = \"${VER_STR}\";" \
173 >> as/apple_version.c || die
174 echo "const char apple_version[] = \"${VER_STR})\";" \
175 >> efitools/vers.c || die
176 echo "const char apple_version[] = \"${VER_STR})\";" \
177 >> ld/ld_vers.c || die
178 echo "const char apple_version[] = \"${VER_STR})\";" \
179 >> misc/vers.c || die
180
181 # clean up test suite
182 cd "${S}"/${LD64}
183 # epatch "${FILESDIR}"/${PN}-3.1.1-testsuite.patch
184
185 cd "${S}"/${LD64}/unit-tests/test-cases
186 local c
187
188 # we don't have llvm
189 ((++c)); rm -rf llvm-integration;
190
191 # we don't have dtrace
192 ((++c)); rm -rf dtrace-static-probes-coalescing;
193 ((++c)); rm -rf dtrace-static-probes;
194
195 # a file is missing
196 ((++c)); rm -rf eh-coalescing-r
197
198 # we don't do universal binaries
199 ((++c)); rm -rf blank-stubs;
200
201 # looks like a problem with apple's result-filter.pl
202 ((++c)); rm -rf implicit-common3;
203 ((++c)); rm -rf order_file-ans;
204
205 # TODO no idea what goes wrong here
206 ((++c)); rm -rf dwarf-debug-notes;
207
208 einfo "Deleted $c tests that were bound to fail"
209
210 cd "${S}"
211 ebegin "cleaning Makefiles from unwanted CFLAGS"
212 find . -name "Makefile" -print0 | xargs -0 sed \
213 -i \
214 -e 's/ -g / /g' \
215 -e 's/^OFLAG =.*$/OFLAG =/' \
216 -e 's/install -c -s/install/g'
217 eend $?
218
219 # -pg is used and the two are incompatible
220 filter-flags -fomit-frame-pointer
221 }
222
223 src_configure() {
224 tc-export CC CXX AR
225 if use lto ; then
226 append-cppflags -DLTO_SUPPORT
227 append-ldflags -L"${EPREFIX}"/usr/$(get_libdir)/llvm
228 append-libs LTO
229 LTO=1
230 else
231 append-cppflags -ULTO_SUPPORT
232 LTO=0
233 fi
234 append-cppflags -DNDEBUG
235 append-cppflags -I${WORKDIR}/libunwind/include
236 }
237
238 compile_libunwind() {
239 # not used, just for testing, and possible use in the future
240 einfo "building ${LIBUNWIND}"
241 cd "${S}"/${LIBUNWIND}/src
242 emake DYLDINCS=-I../../${DYLD}/include || die
243 }
244
245 compile_ld64() {
246 einfo "building ${LD64}"
247 cd "${S}"/${LD64}/src
248 # remove antiquated copy that's available on any OSX system and
249 # breaks ld64 compilation
250 mv include/mach-o/dyld.h{,.disable}
251 emake \
252 LTO=${LTO} \
253 CFLAGS="${CFLAGS}" \
254 CXXFLAGS="${CXXFLAGS} -I../../${DYLD}/include" \
255 LDFLAGS="${LDFLAGS} ${LIBS}" \
256 || die "emake failed for ld64"
257 use test && emake build_test
258 # restore, it's necessary for cctools' install
259 mv include/mach-o/dyld.h{.disable,}
260 }
261
262 compile_cctools() {
263 einfo "building ${CCTOOLS}"
264 cd "${S}"/${CCTOOLS}
265 emake \
266 LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \
267 EFITOOLS= LTO= \
268 COMMON_SUBDIRS='libstuff ar misc otool' \
269 SUBDIRS_32= \
270 RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
271 || die "emake failed for the cctools"
272 cd "${S}"/${CCTOOLS}/as
273 emake \
274 BUILD_OBSOLETE_ARCH= \
275 RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" ${CFLAGS}" \
276 || die "emake failed for as"
277 }
278
279 src_compile() {
280 compile_ld64
281 compile_cctools
282 }
283
284 install_ld64() {
285 exeinto ${BINPATH}
286 doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump}
287 dosym ld64 ${BINPATH}/ld
288 insinto ${DATAPATH}/man/man1
289 doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1
290 }
291
292 install_cctools() {
293 cd "${S}"/${CCTOOLS}
294 emake install_all_but_headers \
295 EFITOOLS= LTO= \
296 COMMON_SUBDIRS='ar misc otool' \
297 SUBDIRS_32= \
298 RC_CFLAGS="${CFLAGS}" OFLAG="${CFLAGS}" \
299 DSTROOT=\"${D}\" \
300 BINDIR=\"${EPREFIX}\"${BINPATH} \
301 LOCBINDIR=\"${EPREFIX}\"${BINPATH} \
302 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
303 LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \
304 MANDIR=\"${EPREFIX}\"${DATAPATH}/man/
305 cd "${S}"/${CCTOOLS}/as
306 emake install \
307 BUILD_OBSOLETE_ARCH= \
308 DSTROOT=\"${D}\" \
309 USRBINDIR=\"${EPREFIX}\"${BINPATH} \
310 LIBDIR=\"${EPREFIX}\"${LIBPATH} \
311 LOCLIBDIR=\"${EPREFIX}\"${LIBPATH}
312
313 cd "${ED}"${BINPATH}
314 insinto ${DATAPATH}/man/man1
315 local skips manpage
316 # ar brings an up-to-date manpage with it
317 skips=( ar )
318 for bin in *; do
319 for skip in ${skips[@]}; do
320 if [[ ${bin} == ${skip} ]]; then
321 continue 2;
322 fi
323 done
324 manpage=${S}/${CCTOOLS}/man/${bin}.1
325 if [[ -f "${manpage}" ]]; then
326 doins "${manpage}"
327 fi
328 done
329 insinto ${DATAPATH}/man/man5
330 doins "${S}"/${CCTOOLS}/man/*.5
331 }
332
333 src_test() {
334 einfo "Running unit tests"
335 cd "${S}"/${LD64}/unit-tests/test-cases
336 # need host arch, since GNU arch doesn't do what Apple's does
337 tc-export CC CXX
338 perl ../bin/make-recursive.pl \
339 ARCH="$(/usr/bin/arch)" \
340 RELEASEDIR="${S}"/${LD64}/src \
341 | perl ../bin/result-filter.pl
342 }
343
344 src_install() {
345 install_ld64
346 install_cctools
347
348 cd "${S}"
349 insinto /etc/env.d/binutils
350 cat <<-EOF > env.d
351 TARGET="${CHOST}"
352 VER="${PV}"
353 FAKE_TARGETS="${CHOST}"
354 EOF
355 newins env.d ${CHOST}-${PV}
356 }
357
358 pkg_postinst() {
359 binutils-config ${CHOST}-${PV}
360 }