1 |
commit: 5e648a50f95c170bd0dc3983e93adf96e1c8e037 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Jul 10 17:30:30 2016 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Jul 10 17:30:30 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5e648a50 |
7 |
|
8 |
sys-devel/binutils-apple: fix LTO for 7.x series, thanks Michael Weiser, bug #587622 |
9 |
|
10 |
Package-Manager: portage-2.2.28 |
11 |
|
12 |
sys-devel/binutils-apple/Manifest | 6 + |
13 |
.../binutils-apple/binutils-apple-7.0-r1.ebuild | 373 ++++++++++++++++++++ |
14 |
.../binutils-apple/binutils-apple-7.1-r1.ebuild | 374 ++++++++++++++++++++ |
15 |
.../binutils-apple/binutils-apple-7.2-r1.ebuild | 374 ++++++++++++++++++++ |
16 |
.../binutils-apple/binutils-apple-7.3.1.ebuild | 390 +++++++++++++++++++++ |
17 |
sys-devel/binutils-apple/binutils-apple-7.3.ebuild | 390 +++++++++++++++++++++ |
18 |
6 files changed, 1907 insertions(+) |
19 |
|
20 |
diff --git a/sys-devel/binutils-apple/Manifest b/sys-devel/binutils-apple/Manifest |
21 |
index 711ba52..6b5b191 100644 |
22 |
--- a/sys-devel/binutils-apple/Manifest |
23 |
+++ b/sys-devel/binutils-apple/Manifest |
24 |
@@ -5,6 +5,9 @@ DIST binutils-apple-patches-5.1-r2.tar.bz2 51642 SHA256 fa179acf848b3cb4f888d8f8 |
25 |
DIST binutils-apple-patches-6.1-r1.tar.bz2 42189 SHA256 8efc006a59a589d498cd0a745e3096f6e0387031a69b0583b94f8ff943bdd10a SHA512 be8ee5af5c8c9f9228cf6980f032aa101058ac1a414bec89401dbc4ff32ea96d6ebf96b7b79285fa1e7b4037a9ed68b285dbe59ff8e3d3e62bfc0145199e72f3 WHIRLPOOL 80fa76ed8c8f60908ac12b4a2d252d8ec1ae6d418f3e20faa6e1905f6d6284dae74d9d82190d02fdd2690ce572c7e97cf38e9e4b88089beaf8962b6162616b20 |
26 |
DIST binutils-apple-patches-6.3-r1.tar.bz2 37951 SHA256 3a5f647eea58f37c091fc7358ee8b8a36de75a5ea826b50e4de1507d31540c79 SHA512 07262f4cb621d7afa240c4d81f80eb1a2adf486b60eb480fe283235eac12167f8efa0a462bf9d0036226aa5e6a5382f9f74420ba3269bc260d0a48d0e4442578 WHIRLPOOL 37429146254f62bb3b67b63551ae7c759131d117ee98a3a9e465b2765550378487d425c435ac7e37f20a0259a536dec7b66851bae1c680c9c25a117a4921ced9 |
27 |
DIST binutils-apple-patches-7.0-r1.tar.bz2 43705 SHA256 e016615294167a539c716094ee595c37d7e11a44e76c6aeadb4d9e6bd14622fb SHA512 a25570062628979e23d73ce9dfd0a9bbb4237fdac472a30f2ec564a9bc9afa7d91d8d8b5bf460d16344677f817b55154394608d74c937f0b1fc6dda64f538266 WHIRLPOOL 2b9b2db3c5e81c26bc6857e2b9b38ae487e3c34e58e2180d84e26762bea287f82d290633efe0d9c4b531b4167782487e260963ff8bc4f2775c23a36c9fe3a0ba |
28 |
+DIST binutils-apple-patches-7.0-r2.tar.bz2 50934 SHA256 5be8cf3ed268bb413ffd05aff91a74a138c5ee92f3cad7c1bcafb4abd957ce8d SHA512 c7c8f50fad0507228336b6144b8be3e70df07d64f1df617bfd9cd717a095c49cd9555c441cde7d24bbe2d179ab8763e4f6ab1074dd6c5532b80a1bbb4f13a244 WHIRLPOOL 35e735356ee72161b0f69ea12ca3ae6745dcea18f8bcba62adbe8c189da9ddf0595bbd837c21acecf0a32a6a50a998c80a2cc3088e63b64655c6f0d0949e05c8 |
29 |
+DIST binutils-apple-patches-7.2-r0.tar.bz2 2917 SHA256 8fa3c64c840aefb71c32fc0294ce6c2b0cf058a5e7f624d736dac6b8c1f44287 SHA512 ca2fc2da88144fbf01f34f1664e6177105a5d1bff956e83f6c7cd530b8e80dcd59b0c921ad95d3c4554e02909bcd846d3a2a4535bf47569b343c85e765619821 WHIRLPOOL 9ba63b8407f6015dd8cca48bea474c375cf90047a138fac8aef800622a780bfcc98910cc46781aea72a2b9803e7cd86c3ea35cfe9fa33bba8813499cc8b91c2c |
30 |
+DIST binutils-apple-patches-7.3-r0.tar.bz2 44576 SHA256 18a9484b53225004ccd37d34d0e208e3a716f73831f4a433be211f233d855fb1 SHA512 6b092c586ac4c3a3c65229a7490f93b0f0d38348e5a2db4f73d6062c737007ee0a5b6bdb5948b7aac1d74d32442fa501ba92161a9ffe13151288432c6a706c43 WHIRLPOOL ef159c24cd1e53538f73aac805e06d14775f82921b1e8a10919981dbec0017d0c70ada0e80ea6135cca5551ccfb38f229df666bcb2e692880d6a23d380d39801 |
31 |
DIST cctools-698.1.tar.gz 2318018 SHA256 383f1c0c78a2b3efdfdf7ce01adb7e2f8ee9985164dba6ab1c0fae800a211cec SHA512 05e64df9bead958e6035b3cf449a2cb21b19cef10278348ebea8b47816b05a77ebd7f72fd90270400784a231b5d55c8f909653e8177cbe1332d7f7d618453f12 WHIRLPOOL 6ae1244ca97b13378e864609aa62efc4bf028b3e55bfb00cdbf9d20ed6cedd917c64ce337b2635dcabce334b8f994e2558fbda36055b951bf769a21950673e12 |
32 |
DIST cctools-750.tar.gz 1947953 SHA256 188855640da114e37e4ddd4824ff6cdc1ea89dfb6c90a23905c9ca315342f356 SHA512 e2e152a9fb7db47c60fe450e1fc92c6866ab89682c7fdc594b97e419ce93ea1353654bd4419bf3df99d119f554aa0f32993dc645dd7c4680840cd01b7dce2f67 WHIRLPOOL 98e48fca183ee47d138426c65401138954a86abc3b80bfc4c5d105b97b8eb583ae350657f1a7dc1154259d0bcdfe1d60dc0a63409826e9a24b178674a5afdf21 |
33 |
DIST cctools-795.tar.gz 1993795 SHA256 7fab7044b648e92a9fefd493a1bb6daa4246f24c5838d8b5c913a446e6bbd2ef SHA512 5a34a73dc71d3574a357f6b0f26a48a99dd0995d62695b309cdfe85c4960934b410455b1ba6bdbc9a4e32106bb45b35555604975d2a80ad1be21f5d4eac69254 WHIRLPOOL 2bd074ac8ef8542c2c3df5fae91a0bece2e1c31d6c6c771c55e7c7a3d90929f9a7cd420760dcb5ecffb9dd279abed4ba5ebf840c9e9bb983a806707d735cd735 |
34 |
@@ -16,6 +19,7 @@ DIST cctools-870.tar.gz 1702965 SHA256 b83f4b4696414b814cc1781ec4b68ff9c7bb97920 |
35 |
DIST cctools-877.5.tar.gz 1717664 SHA256 5e7525c86581d9dead8a8508a9e824101765d05a3e14d612de1aa38def9adde9 SHA512 cec8520450c3b1ffe77bd841ad6b8f6b0d28657e7c39ae1525bfe7ec1460c0f4bb394da316e6ed5b08cb5df26b757b9d94a9923cc7eaf9b14315d045ea891062 WHIRLPOOL 30b8c8fad772804a449318b08b7e3362e9a73345a4fe43758216d41f533189dac6a2bee37f1884fc049702f2705fda250767cf3a776956796c270147197920b7 |
36 |
DIST cctools-877.7.tar.gz 1720523 SHA256 c3809b7604a27db0c0b418fcccd5cad49f002e2a750ec611f92f806521f7ed9e SHA512 5c381fe8b85d1254f660eb3c3510d9e0a49792ae5bb0e69a4dfb5a18e7f1706ee1411589f20583a9d7f12126ef616f66f1ad5c1c4ff405f66b52759c0a4272b5 WHIRLPOOL 2c8e85fd33f183bd074abf90237301eff252ca05aa48a59aea713d263b10e0710d261a5ac01185e9a17d1a391fa025fb91d60df0f3b426140defdbd5536e4bbb |
37 |
DIST cctools-877.8.tar.gz 1720708 SHA256 88be2788adf461f1d8278324b0078f6003b2328b6f95a54b16ec6ed1ba651dc2 SHA512 3f75fbe4eacd89f2e6372a3167ed197e2b8bda9faa10fe6bce0cf9d3d3eca536f0af5fc4ce1e4bc6a24eb68db36f5d0b1d0bc3f9807e285e67cfaa2d336d81ef WHIRLPOOL eea67bacd8037b19ba3efcc2fecfcc74ec3e785ce92628fdeccbeca6e17dee4d1926719a02ca7f68fc2045f9b37571cb044cc29a3a8fe6a5bd704a3446f44945 |
38 |
+DIST cctools-886.tar.gz 1731850 SHA256 f3a4fa7dad4a54d862b1d9f48e3dfb25fc532c9cf46a041cf8134694328a8878 SHA512 49f14e165da3a9fcf16614a810b8a2a68907348bd27a60b268b330e416a0bc070fb6445e1e6b80d849026bd6ce7de4459623ab86168e2d63bb492d1ba6680c5b WHIRLPOOL 91a09d3c773f0aede36de548310879a1ad4158f39e9d4d91b4e1a9460d31acdcab5c658113381742512861c6281661dea7fd8273d7146ac6838088d1435ebe2f |
39 |
DIST dyld-195.5.tar.gz 411615 SHA256 2cf0484c87cf79b606b351a7055a247dae84093ae92c747a74e0cde2c8c8f83c SHA512 f316d32f3e417cf0898a8e231df66572d3424765831375863799d3ff30f8e28342ca692426d0ece7a8d069b341a3b9ca79c625edc322d90e3f26f528ea555324 WHIRLPOOL e0e231653ad37ad8fdb7d5fbd372fe1dc34b80e41f7dafa8bb46f4c8fa4f5acb4574f4cd346304dfaca1f074667f381931ca5ff7a7efddaea770fb35d30539dc |
40 |
DIST dyld-195.6.tar.gz 412518 SHA256 69296e9b4192bdac778ea899fffc18b02be62b51b5e8474b4cf85ae5f2b08aa4 SHA512 58a9ea27efc02e66f9d99bfa250af1d90326385385431e5279386bbd9ab53366bf7e8236543296908b7214c33523c8f60098a6298a7393b3180e2a6bce18e7c5 WHIRLPOOL e37b11d3996559f8a1843577a5fa42f96e4d42419f205276600f0ed79fcd2490da1f8a77eecf29f111b3db62a65e8e9cd77a154e3b389d633a7ac1525273b9b5 |
41 |
DIST dyld-353.2.1.tar.gz 510036 SHA256 051089e284c5a4d671b21b73866abd01d54e5ea1912cadf3a9b916890fb31540 SHA512 a9488620499f682e245b55b7e0e4ec02fc0bcf03bd8a70d4a4ee0ba762067ade2f41c188990c101727476d41c19368b4cc89cccf2df40231da1c777742c7391f WHIRLPOOL 3164746ed8c866df993f08e405e7e329db427af8eeded681d5fb88031ef2c025363d5bfb647e9315738024adf9f48efacf49226f86f27def584ec7f538da292e |
42 |
@@ -30,6 +34,8 @@ DIST ld64-242.tar.gz 641597 SHA256 bec1a5e20b599d108be0017736833c1f6212ea26c67f2 |
43 |
DIST ld64-253.3.tar.gz 671087 SHA256 76c02f6f297c251b66504e1115946bda6e1618640bc6cf03d0ad99b17bd8a5d6 SHA512 ce2c86f2f37ee37bd417315ba51815707b0ca6f24da06819fd1b2d0b4fe0762e45a08c3faf2c0c980e4913c9cbfbf6c8185f9a6810cfa1d9dad231b5bb276081 WHIRLPOOL 7e168bb6dc1474d26da77ca6afde1b591781eb5c0a7a50530b334e4ed6dc0206a2d047375d7d924aa05ccc0912ec8ee966874a9324c66820c454ebd173d1520e |
44 |
DIST ld64-253.6.tar.gz 671838 SHA256 7fbae5e88ac1420480de8a495dcd3b876d399278bfce9ffbef7d54334dd80b4a SHA512 40b29e273ed3d69e4f92593cadea831fd618452d3f05e30c0b836ffc05db61fd345cb2f6d63271563c786ecabd47f19f8369456cbe6422800117a53c654a98c6 WHIRLPOOL b687166038f0ad3dd65a623c91aa7204025ab371b90d5be57fff3bf8f8d89df93aaf8d781fd3a950ced4deab667917a379ad5ac479d25fb00644a02950c118cd |
45 |
DIST ld64-253.9.tar.gz 673388 SHA256 8fa3a1b65f665824ac129c02e2fab8926a06e503ec277ea32cd8bc27c8de11c3 SHA512 a52b081295c19f28858f8ee47c05249bba3e15cc8bb6f7017d9f6dcf7509cdacef7a4b16b3940cd0b1f72b3b67efb503ab2e3801b31e50cda1d34c6bc8df8dcf WHIRLPOOL 07e850984d2ff24637a64d76860799136e63af56dc2740f8d1e1bd3311ae3f33eac902e7850f94555407002d0d16f44d4a276470f54e60a0633169b884b7dfc1 |
46 |
+DIST ld64-264.3.101.tar.gz 681491 SHA256 2882f0c104334bdba8eb64cd3a9f9059ceca4d4e0c08473506a926d53c9ef218 SHA512 ffa37af95f1a6e76829d0ac8badfd0236d93dc2f9988c7f4b88fe271b7b02a4b5553402a1e9a49feed9da4d04a50e2a2cacdb1bd4c04ecbef09d68b85a2e8a6a WHIRLPOOL cdc466a24fdbc2bf3756d73f89f91d26fec21d8004a2e77804e2b678a9da08afe83bb5aa9fb4548496feb3d9180c3d2521a8d5329b875ed76d4e3a0ea231d5be |
47 |
+DIST ld64-264.3.102.tar.gz 681509 SHA256 307f73678a3e5c9ed4d1bcf77da7399d84efac32916c5df6cd477c3b5c36f953 SHA512 ec221de3624dcce3db694ec2d7b05f3c939cd1ba79c97437ba9f2d4e5d9c37369bb5df82cc37bc158bf5c4e2128cc2b96ca1a7477f98538850092bffa4601da0 WHIRLPOOL 509774429d498c4a070a54798715776eddf2b8ef70a99dd4250d60144efa2d4a6a324914112556435709beb614172dd45b860f3963b0da9a0825cb0756bcd719 |
48 |
DIST ld64-85.2.1.tar.gz 598524 SHA256 4bcbcbdfd62efdc46c51700b8f5dae2cbd1638e9e50f649d5c7f242d32fca804 SHA512 b5ffaffc43e74f22688fecd9fb3023a59160cf051f9412f34e6b0acf1c4f9d43ba641e199d8d6b1c6cf3bbbbf117645988fd879ded1fec8be056b6941fe79999 WHIRLPOOL 7c50f462eb41808b57ea06b82bdf576460bddb4150abe7a678af541aa0b179105d994a2b6fd10152481aa28acc903265160945b4aae9dcfce0a1a1cfe4b9460a |
49 |
DIST ld64-97.17.tar.gz 421947 SHA256 02bd46af0809eaa415d096d7d41c3e8e7d80f7d8d181840866fb87f036b4e089 SHA512 841774a1a7c0e2f661ac7e66703f7578d8f11274897ffa15f8c49daf290a23465763f264a4dae99f15754891f44c425c0d327652112007b499bc8f755a7fc9d6 WHIRLPOOL 7225b44d845b13c6b6d1a685170f2b6e15b81c48320fa3b570771938ed457a59452e80873996a4b2712a8f6813486063afd73acf979a97d823afb3d510d74678 |
50 |
DIST libunwind-30.tar.gz 82811 SHA256 6ac97d18cc2b05e6de1269bf5af03b81948bd2200dae827527f3dc618b82bd41 SHA512 57106eafa1516791b4e0db2de6c6336bc0c1cbd8bf098a6d3a809fafa457802c95a7aeae9137f4ca5922a3018dfd8f597907ea4187b0afbbf267500eae00041f WHIRLPOOL c3caf5ba593cffa2f0a9cdb256f518524e9500eaf0a013c4973dc9881b16efa0c388e70407bbed1fd331f100af2da01ddeee12d33b3afc1213d69c32ab5e1d0b |
51 |
|
52 |
diff --git a/sys-devel/binutils-apple/binutils-apple-7.0-r1.ebuild b/sys-devel/binutils-apple/binutils-apple-7.0-r1.ebuild |
53 |
new file mode 100644 |
54 |
index 0000000..0606643 |
55 |
--- /dev/null |
56 |
+++ b/sys-devel/binutils-apple/binutils-apple-7.0-r1.ebuild |
57 |
@@ -0,0 +1,373 @@ |
58 |
+# Copyright 1999-2016 Gentoo Foundation |
59 |
+# Distributed under the terms of the GNU General Public License v2 |
60 |
+# $Id$ |
61 |
+ |
62 |
+EAPI="5" |
63 |
+ |
64 |
+inherit eutils flag-o-matic toolchain-funcs |
65 |
+ |
66 |
+LD64=ld64-253.3 |
67 |
+CCTOOLS_VERSION=877.5 |
68 |
+CCTOOLS=cctools-${CCTOOLS_VERSION} |
69 |
+LIBUNWIND=libunwind-35.3 |
70 |
+DYLD=dyld-360.14 |
71 |
+ |
72 |
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}" |
73 |
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/" |
74 |
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz |
75 |
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz |
76 |
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz |
77 |
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz |
78 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r1.tar.bz2 |
79 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r2.tar.bz2 |
80 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r1.tar.bz2 |
81 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r1.tar.bz2 |
82 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r2.tar.bz2" |
83 |
+ |
84 |
+LICENSE="APSL-2" |
85 |
+KEYWORDS="~x64-macos ~x86-macos" |
86 |
+IUSE="lto test multitarget" |
87 |
+ |
88 |
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses |
89 |
+# C++11 language fatures. *But additionally* the as driver now defaults to |
90 |
+# calling clang as the assembler on many platforms. This can be disabled using |
91 |
+# -Wa,-Q but since it's default we make llvm a static runtime dependency. |
92 |
+RDEPEND="sys-devel/binutils-config |
93 |
+ lto? ( app-arch/xar ) |
94 |
+ sys-devel/llvm |
95 |
+ sys-libs/libcxx" |
96 |
+DEPEND="${RDEPEND} |
97 |
+ test? ( >=dev-lang/perl-5.8.8 )" |
98 |
+ |
99 |
+export CTARGET=${CTARGET:-${CHOST}} |
100 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
101 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
102 |
+ export CTARGET=${CATEGORY#cross-} |
103 |
+ fi |
104 |
+fi |
105 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
106 |
+ |
107 |
+if is_cross ; then |
108 |
+ SLOT="${CTARGET}-7" |
109 |
+else |
110 |
+ SLOT="7" |
111 |
+fi |
112 |
+ |
113 |
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
114 |
+INCPATH=${LIBPATH}/include |
115 |
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
116 |
+if is_cross ; then |
117 |
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV} |
118 |
+else |
119 |
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV} |
120 |
+fi |
121 |
+ |
122 |
+S=${WORKDIR} |
123 |
+ |
124 |
+src_prepare() { |
125 |
+ if use multitarget ; then |
126 |
+ ewarn "You have enabled support for non-standard target architectures" |
127 |
+ ewarn "using USE=multitarget. This includes experimental support for" |
128 |
+ ewarn "ppc and ppc64 which is a community forward-port from the last" |
129 |
+ ewarn "version of ld64 to officially support PPC." |
130 |
+ |
131 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
132 |
+ ewarn "HERE BE DRAGONS! Your system seems to be PPC which means that" |
133 |
+ ewarn "the actual usability of your Gentoo programs will depend on the" |
134 |
+ ewarn "above-mentioned experimental PPC support in the linker. Be" |
135 |
+ ewarn "sure to keep a known-to-work version like ${PN}-3.2.6 around!" |
136 |
+ fi |
137 |
+ fi |
138 |
+ |
139 |
+ cd "${S}"/${LD64}/src |
140 |
+ cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h |
141 |
+ cp "${S}"/ld64-253.3-Makefile-3 Makefile |
142 |
+ |
143 |
+ epatch "${S}"/ld64-253.3-nolto.patch |
144 |
+ epatch "${S}"/ld64-241.9-extraneous-includes.patch |
145 |
+ epatch "${S}"/ld64-241.9-osatomic.patch |
146 |
+ epatch "${S}"/ld64-236.3-crashreporter.patch |
147 |
+ epatch "${S}"/ld64-253.3-nosnapshots.patch |
148 |
+ epatch "${S}"/ld64-253.3-ppc.patch |
149 |
+ epatch "${S}"/ld64-236.3-constant-types-2.patch |
150 |
+ epatch "${S}"/ld64-241.9-register-names.patch |
151 |
+ epatch "${S}"/ld64-241.9-get-comm-align.patch |
152 |
+ epatch "${S}"/ld64-241.9-cc_md5.patch |
153 |
+ epatch "${S}"/ld64-253.3-make_pair.patch |
154 |
+ epatch "${S}"/ld64-253.3-delete-warning.patch |
155 |
+ |
156 |
+ # provide missing headers from libunwind and dyld |
157 |
+ mkdir -p include/{mach,mach-o/arm} || die |
158 |
+ # never present because it's private |
159 |
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die |
160 |
+ # missing on <= 10.5 |
161 |
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die |
162 |
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die |
163 |
+ # missing on <= 10.4 |
164 |
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die |
165 |
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die |
166 |
+ # use copies from cctools because they're otherwise hidden in some SDK |
167 |
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die |
168 |
+ # provide all required CPU_TYPEs on all platforms |
169 |
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h |
170 |
+ # add alias for newer identifiers, because ld64 uses both but cctools |
171 |
+ # header only defines the older |
172 |
+ epatch "${S}"/ld64-236.3-missing-cputypes.patch |
173 |
+ |
174 |
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on |
175 |
+ # older systems |
176 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \ |
177 |
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h |
178 |
+ |
179 |
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\"" |
180 |
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp |
181 |
+ |
182 |
+ epatch "${S}"/ld64-123.2-debug-backtrace.patch |
183 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
184 |
+ epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch |
185 |
+ epatch "${S}"/ld64-127.2-thread_state.patch |
186 |
+ fi |
187 |
+ |
188 |
+ cd "${S}"/${CCTOOLS} |
189 |
+ epatch "${S}"/${PN}-4.5-as.patch |
190 |
+ epatch "${S}"/${PN}-5.1-as-dir.patch |
191 |
+ epatch "${S}"/${PN}-5.1-ranlib.patch |
192 |
+ epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch |
193 |
+ epatch "${S}"/${PN}-3.1.1-no-headers.patch |
194 |
+ epatch "${S}"/${PN}-4.0-no-oss-dir.patch |
195 |
+ epatch "${S}"/cctools-839-intel-retf.patch |
196 |
+ epatch "${S}"/${PN}-5.1-extraneous-includes.patch |
197 |
+ #epatch "${S}"/${PN}-5.1-otool-stdc.patch |
198 |
+ epatch "${S}"/${PN}-5.1-constant-types.patch |
199 |
+ epatch "${S}"/${PN}-5.1-strnlen.patch |
200 |
+ epatch "${S}"/${PN}-5.1-ppc.patch |
201 |
+ epatch "${S}"/${PN}-5.1-thread-state-redefined.patch |
202 |
+ epatch "${S}"/${PN}-7.0-make-j.patch |
203 |
+ epatch "${S}"/${PN}-7.0-lto-prefix-2.patch |
204 |
+ epatch "${S}"/${PN}-7.0-clang-as.patch |
205 |
+ epatch "${S}"/${PN}-7.0-nolto.patch |
206 |
+ epatch "${S}"/${PN}-7.0-nollvm.patch |
207 |
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die |
208 |
+ |
209 |
+ # do not build profileable libstuff to save compile time |
210 |
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile |
211 |
+ |
212 |
+ # cctools version is provided to make via RC_ProjectSourceVersion which |
213 |
+ # generates and compiles it as apple_version[] into libstuff. From |
214 |
+ # there it's picked up by the individual tools. Since |
215 |
+ # RC_ProjectSourceVersion is also used as library version, we can't |
216 |
+ # just append our local version info. So we hack the libstuff Makefile |
217 |
+ # to include our Gentoo version. |
218 |
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \ |
219 |
+ libstuff/Makefile |
220 |
+ |
221 |
+ # clean up test suite |
222 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
223 |
+ local c |
224 |
+ |
225 |
+ # we don't have llvm |
226 |
+ ((++c)); rm -rf llvm-integration; |
227 |
+ |
228 |
+ # we don't have dtrace |
229 |
+ ((++c)); rm -rf dtrace-static-probes-coalescing; |
230 |
+ ((++c)); rm -rf dtrace-static-probes; |
231 |
+ |
232 |
+ # a file is missing |
233 |
+ ((++c)); rm -rf eh-coalescing-r |
234 |
+ |
235 |
+ # we don't do universal binaries |
236 |
+ ((++c)); rm -rf blank-stubs; |
237 |
+ |
238 |
+ # looks like a problem with apple's result-filter.pl |
239 |
+ ((++c)); rm -rf implicit-common3; |
240 |
+ ((++c)); rm -rf order_file-ans; |
241 |
+ |
242 |
+ # TODO no idea what goes wrong here |
243 |
+ ((++c)); rm -rf dwarf-debug-notes; |
244 |
+ |
245 |
+ einfo "Deleted $c tests that were bound to fail" |
246 |
+ |
247 |
+ cd "${S}" |
248 |
+ ebegin "cleaning Makefiles from unwanted CFLAGS" |
249 |
+ find . -name "Makefile" -print0 | xargs -0 sed \ |
250 |
+ -i \ |
251 |
+ -e 's/ -g / /g' \ |
252 |
+ -e 's/^G =.*$/G =/' \ |
253 |
+ -e 's/^OFLAG =.*$/OFLAG =/' \ |
254 |
+ -e 's/install -c -s/install/g' |
255 |
+ eend $? |
256 |
+} |
257 |
+ |
258 |
+src_configure() { |
259 |
+ ENABLE_LTO=0 |
260 |
+ use lto && ENABLE_LTO=1 |
261 |
+ |
262 |
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is |
263 |
+ # what we want) |
264 |
+ append-cppflags -DNDEBUG |
265 |
+ |
266 |
+ # Block API and thus snapshots supported on >= 10.6 |
267 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \ |
268 |
+ append-cppflags -DSUPPORT_SNAPSHOTS |
269 |
+ |
270 |
+ CCTOOLS_OFLAG= |
271 |
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then |
272 |
+ # cctools expect to use UNIX03 struct member names. |
273 |
+ # This is default on > 10.4. Activate it on <= 10.4 by defining |
274 |
+ # __DARWIN_UNIX03 explicitly. |
275 |
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1" |
276 |
+ fi |
277 |
+ |
278 |
+ # if compiling with USE multitarget, extract all the known arches from |
279 |
+ # create_configure and pass them back to it |
280 |
+ creco=${LD64}/src/create_configure |
281 |
+ ARCHS_TO_SUPPORT="" |
282 |
+ if use multitarget ; then |
283 |
+ ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \ |
284 |
+ cut -d\" -f2 | tr ',' ' ')" |
285 |
+ fi |
286 |
+ |
287 |
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it. |
288 |
+ DERIVED_FILE_DIR=${LD64}/src \ |
289 |
+ RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \ |
290 |
+ $creco |
291 |
+ |
292 |
+ # do not depend on MachOFileAbstraction.hpp to define |
293 |
+ # SUPPORT_ARCH_arm_any because that's not included by every file where |
294 |
+ # our ppc/arm-optional patch uses it, ld.hpp in particular |
295 |
+ grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \ |
296 |
+ echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h |
297 |
+} |
298 |
+ |
299 |
+compile_ld64() { |
300 |
+ einfo "building ${LD64}" |
301 |
+ cd "${S}"/${LD64}/src |
302 |
+ emake \ |
303 |
+ LTO=${ENABLE_LTO} \ |
304 |
+ || die "emake failed for ld64" |
305 |
+ use test && emake build_test |
306 |
+} |
307 |
+ |
308 |
+compile_cctools() { |
309 |
+ einfo "building ${CCTOOLS}" |
310 |
+ cd "${S}"/${CCTOOLS} |
311 |
+ # Suppress running dsymutil because it will warn about missing debug |
312 |
+ # info which is expected when compiling without -g as we normally do. |
313 |
+ # This might need some more thought if anyone ever wanted to build us |
314 |
+ # for debugging with Apple's tools. |
315 |
+ emake \ |
316 |
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \ |
317 |
+ EFITOOLS= \ |
318 |
+ LTO="${ENABLE_LTO}" \ |
319 |
+ LTO_LIBDIR=../../../lib \ |
320 |
+ COMMON_SUBDIRS='libstuff ar misc otool' \ |
321 |
+ SUBDIRS_32= \ |
322 |
+ LEGACY= \ |
323 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
324 |
+ RC_CFLAGS="${CFLAGS}" \ |
325 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
326 |
+ DSYMUTIL=": disabled: dsymutil" \ |
327 |
+ || die "emake failed for the cctools" |
328 |
+ cd "${S}"/${CCTOOLS}/as |
329 |
+ emake \ |
330 |
+ BUILD_OBSOLETE_ARCH= \ |
331 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
332 |
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" -DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \ |
333 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
334 |
+ DSYMUTIL=": disabled: dsymutil" \ |
335 |
+ || die "emake failed for as" |
336 |
+} |
337 |
+ |
338 |
+src_compile() { |
339 |
+ compile_ld64 |
340 |
+ compile_cctools |
341 |
+} |
342 |
+ |
343 |
+install_ld64() { |
344 |
+ exeinto ${BINPATH} |
345 |
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump} |
346 |
+ dosym ld64 ${BINPATH}/ld |
347 |
+ insinto ${DATAPATH}/man/man1 |
348 |
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1 |
349 |
+} |
350 |
+ |
351 |
+install_cctools() { |
352 |
+ cd "${S}"/${CCTOOLS} |
353 |
+ emake install_all_but_headers \ |
354 |
+ EFITOOLS= \ |
355 |
+ COMMON_SUBDIRS='ar misc otool' \ |
356 |
+ SUBDIRS_32= \ |
357 |
+ DSTROOT=\"${D}\" \ |
358 |
+ BINDIR=\"${EPREFIX}\"${BINPATH} \ |
359 |
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \ |
360 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
361 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
362 |
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/ |
363 |
+ cd "${S}"/${CCTOOLS}/as |
364 |
+ emake install \ |
365 |
+ BUILD_OBSOLETE_ARCH= \ |
366 |
+ DSTROOT=\"${D}\" \ |
367 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
368 |
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
369 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} |
370 |
+ |
371 |
+ cd "${ED}"${BINPATH} |
372 |
+ insinto ${DATAPATH}/man/man1 |
373 |
+ local skips manpage |
374 |
+ # ar brings an up-to-date manpage with it |
375 |
+ skips=( ar ) |
376 |
+ for bin in *; do |
377 |
+ for skip in ${skips[@]}; do |
378 |
+ if [[ ${bin} == ${skip} ]]; then |
379 |
+ continue 2; |
380 |
+ fi |
381 |
+ done |
382 |
+ manpage=${S}/${CCTOOLS}/man/${bin}.1 |
383 |
+ if [[ -f "${manpage}" ]]; then |
384 |
+ doins "${manpage}" |
385 |
+ fi |
386 |
+ done |
387 |
+ insinto ${DATAPATH}/man/man5 |
388 |
+ doins "${S}"/${CCTOOLS}/man/*.5 |
389 |
+} |
390 |
+ |
391 |
+src_test() { |
392 |
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then |
393 |
+ einfo "Test suite only works properly with clang - please install" |
394 |
+ return |
395 |
+ fi |
396 |
+ |
397 |
+ einfo "Running unit tests" |
398 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
399 |
+ # provide the new ld as a symlink to clang so that -ccc-install-dir |
400 |
+ # will pick it up |
401 |
+ ln -sfn ../../src/ld64 ld |
402 |
+ # use our arch command because the System's will report i386 even for an |
403 |
+ # x86_64 prefix |
404 |
+ perl ../bin/make-recursive.pl \ |
405 |
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \ |
406 |
+ ARCH="$(arch)" \ |
407 |
+ LD="${S}"/${LD64}/src/ld64 \ |
408 |
+ CC="${CC} -ccc-install-dir $PWD" \ |
409 |
+ CXX="${CXX} -ccc-install-dir $PWD" \ |
410 |
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \ |
411 |
+ | perl ../bin/result-filter.pl |
412 |
+} |
413 |
+ |
414 |
+src_install() { |
415 |
+ install_ld64 |
416 |
+ install_cctools |
417 |
+ |
418 |
+ cd "${S}" |
419 |
+ insinto /etc/env.d/binutils |
420 |
+ cat <<-EOF > env.d |
421 |
+ TARGET="${CHOST}" |
422 |
+ VER="${PV}" |
423 |
+ FAKE_TARGETS="${CHOST}" |
424 |
+ EOF |
425 |
+ newins env.d ${CHOST}-${PV} |
426 |
+} |
427 |
+ |
428 |
+pkg_postinst() { |
429 |
+ binutils-config ${CHOST}-${PV} |
430 |
+} |
431 |
|
432 |
diff --git a/sys-devel/binutils-apple/binutils-apple-7.1-r1.ebuild b/sys-devel/binutils-apple/binutils-apple-7.1-r1.ebuild |
433 |
new file mode 100644 |
434 |
index 0000000..f588ce7 |
435 |
--- /dev/null |
436 |
+++ b/sys-devel/binutils-apple/binutils-apple-7.1-r1.ebuild |
437 |
@@ -0,0 +1,374 @@ |
438 |
+# Copyright 1999-2016 Gentoo Foundation |
439 |
+# Distributed under the terms of the GNU General Public License v2 |
440 |
+# $Id$ |
441 |
+ |
442 |
+EAPI="5" |
443 |
+ |
444 |
+inherit eutils flag-o-matic toolchain-funcs |
445 |
+ |
446 |
+LD64=ld64-253.6 |
447 |
+CCTOOLS_VERSION=877.7 |
448 |
+CCTOOLS=cctools-${CCTOOLS_VERSION} |
449 |
+LIBUNWIND=libunwind-35.3 |
450 |
+DYLD=dyld-360.17 |
451 |
+ |
452 |
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}" |
453 |
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/" |
454 |
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz |
455 |
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz |
456 |
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz |
457 |
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz |
458 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r1.tar.bz2 |
459 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r2.tar.bz2 |
460 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r1.tar.bz2 |
461 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r1.tar.bz2 |
462 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r2.tar.bz2" |
463 |
+ |
464 |
+ |
465 |
+LICENSE="APSL-2" |
466 |
+KEYWORDS="~x64-macos ~x86-macos" |
467 |
+IUSE="lto test multitarget" |
468 |
+ |
469 |
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses |
470 |
+# C++11 language fatures. *But additionally* the as driver now defaults to |
471 |
+# calling clang as the assembler on many platforms. This can be disabled using |
472 |
+# -Wa,-Q but since it's default we make llvm a static runtime dependency. |
473 |
+RDEPEND="sys-devel/binutils-config |
474 |
+ lto? ( app-arch/xar ) |
475 |
+ sys-devel/llvm |
476 |
+ sys-libs/libcxx" |
477 |
+DEPEND="${RDEPEND} |
478 |
+ test? ( >=dev-lang/perl-5.8.8 )" |
479 |
+ |
480 |
+export CTARGET=${CTARGET:-${CHOST}} |
481 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
482 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
483 |
+ export CTARGET=${CATEGORY#cross-} |
484 |
+ fi |
485 |
+fi |
486 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
487 |
+ |
488 |
+if is_cross ; then |
489 |
+ SLOT="${CTARGET}-7" |
490 |
+else |
491 |
+ SLOT="7" |
492 |
+fi |
493 |
+ |
494 |
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
495 |
+INCPATH=${LIBPATH}/include |
496 |
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
497 |
+if is_cross ; then |
498 |
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV} |
499 |
+else |
500 |
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV} |
501 |
+fi |
502 |
+ |
503 |
+S=${WORKDIR} |
504 |
+ |
505 |
+src_prepare() { |
506 |
+ if use multitarget ; then |
507 |
+ ewarn "You have enabled support for non-standard target architectures" |
508 |
+ ewarn "using USE=multitarget. This includes experimental support for" |
509 |
+ ewarn "ppc and ppc64 which is a community forward-port from the last" |
510 |
+ ewarn "version of ld64 to officially support PPC." |
511 |
+ |
512 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
513 |
+ ewarn "HERE BE DRAGONS! Your system seems to be PPC which means that" |
514 |
+ ewarn "the actual usability of your Gentoo programs will depend on the" |
515 |
+ ewarn "above-mentioned experimental PPC support in the linker. Be" |
516 |
+ ewarn "sure to keep a known-to-work version like ${PN}-3.2.6 around!" |
517 |
+ fi |
518 |
+ fi |
519 |
+ |
520 |
+ cd "${S}"/${LD64}/src |
521 |
+ cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h |
522 |
+ cp "${S}"/ld64-253.3-Makefile-3 Makefile |
523 |
+ |
524 |
+ epatch "${S}"/ld64-253.3-nolto.patch |
525 |
+ epatch "${S}"/ld64-241.9-extraneous-includes.patch |
526 |
+ epatch "${S}"/ld64-241.9-osatomic.patch |
527 |
+ epatch "${S}"/ld64-236.3-crashreporter.patch |
528 |
+ epatch "${S}"/ld64-253.3-nosnapshots.patch |
529 |
+ epatch "${S}"/ld64-253.3-ppc.patch |
530 |
+ epatch "${S}"/ld64-236.3-constant-types-2.patch |
531 |
+ epatch "${S}"/ld64-241.9-register-names.patch |
532 |
+ epatch "${S}"/ld64-241.9-get-comm-align.patch |
533 |
+ epatch "${S}"/ld64-241.9-cc_md5.patch |
534 |
+ epatch "${S}"/ld64-253.3-make_pair.patch |
535 |
+ epatch "${S}"/ld64-253.3-delete-warning.patch |
536 |
+ |
537 |
+ # provide missing headers from libunwind and dyld |
538 |
+ mkdir -p include/{mach,mach-o/arm} || die |
539 |
+ # never present because it's private |
540 |
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die |
541 |
+ # missing on <= 10.5 |
542 |
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die |
543 |
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die |
544 |
+ # missing on <= 10.4 |
545 |
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die |
546 |
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die |
547 |
+ # use copies from cctools because they're otherwise hidden in some SDK |
548 |
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die |
549 |
+ # provide all required CPU_TYPEs on all platforms |
550 |
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h |
551 |
+ # add alias for newer identifiers, because ld64 uses both but cctools |
552 |
+ # header only defines the older |
553 |
+ epatch "${S}"/ld64-236.3-missing-cputypes.patch |
554 |
+ |
555 |
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on |
556 |
+ # older systems |
557 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \ |
558 |
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h |
559 |
+ |
560 |
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\"" |
561 |
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp |
562 |
+ |
563 |
+ epatch "${S}"/ld64-123.2-debug-backtrace.patch |
564 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
565 |
+ epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch |
566 |
+ epatch "${S}"/ld64-127.2-thread_state.patch |
567 |
+ fi |
568 |
+ |
569 |
+ cd "${S}"/${CCTOOLS} |
570 |
+ epatch "${S}"/${PN}-4.5-as.patch |
571 |
+ epatch "${S}"/${PN}-5.1-as-dir.patch |
572 |
+ epatch "${S}"/${PN}-5.1-ranlib.patch |
573 |
+ epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch |
574 |
+ epatch "${S}"/${PN}-3.1.1-no-headers.patch |
575 |
+ epatch "${S}"/${PN}-4.0-no-oss-dir.patch |
576 |
+ epatch "${S}"/cctools-839-intel-retf.patch |
577 |
+ epatch "${S}"/${PN}-5.1-extraneous-includes.patch |
578 |
+ #epatch "${S}"/${PN}-5.1-otool-stdc.patch |
579 |
+ epatch "${S}"/${PN}-5.1-constant-types.patch |
580 |
+ epatch "${S}"/${PN}-5.1-strnlen.patch |
581 |
+ epatch "${S}"/${PN}-5.1-ppc.patch |
582 |
+ epatch "${S}"/${PN}-5.1-thread-state-redefined.patch |
583 |
+ epatch "${S}"/${PN}-7.0-make-j.patch |
584 |
+ epatch "${S}"/${PN}-7.0-lto-prefix-2.patch |
585 |
+ epatch "${S}"/${PN}-7.0-clang-as.patch |
586 |
+ epatch "${S}"/${PN}-7.0-nolto.patch |
587 |
+ epatch "${S}"/${PN}-7.0-nollvm.patch |
588 |
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die |
589 |
+ |
590 |
+ # do not build profileable libstuff to save compile time |
591 |
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile |
592 |
+ |
593 |
+ # cctools version is provided to make via RC_ProjectSourceVersion which |
594 |
+ # generates and compiles it as apple_version[] into libstuff. From |
595 |
+ # there it's picked up by the individual tools. Since |
596 |
+ # RC_ProjectSourceVersion is also used as library version, we can't |
597 |
+ # just append our local version info. So we hack the libstuff Makefile |
598 |
+ # to include our Gentoo version. |
599 |
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \ |
600 |
+ libstuff/Makefile |
601 |
+ |
602 |
+ # clean up test suite |
603 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
604 |
+ local c |
605 |
+ |
606 |
+ # we don't have llvm |
607 |
+ ((++c)); rm -rf llvm-integration; |
608 |
+ |
609 |
+ # we don't have dtrace |
610 |
+ ((++c)); rm -rf dtrace-static-probes-coalescing; |
611 |
+ ((++c)); rm -rf dtrace-static-probes; |
612 |
+ |
613 |
+ # a file is missing |
614 |
+ ((++c)); rm -rf eh-coalescing-r |
615 |
+ |
616 |
+ # we don't do universal binaries |
617 |
+ ((++c)); rm -rf blank-stubs; |
618 |
+ |
619 |
+ # looks like a problem with apple's result-filter.pl |
620 |
+ ((++c)); rm -rf implicit-common3; |
621 |
+ ((++c)); rm -rf order_file-ans; |
622 |
+ |
623 |
+ # TODO no idea what goes wrong here |
624 |
+ ((++c)); rm -rf dwarf-debug-notes; |
625 |
+ |
626 |
+ einfo "Deleted $c tests that were bound to fail" |
627 |
+ |
628 |
+ cd "${S}" |
629 |
+ ebegin "cleaning Makefiles from unwanted CFLAGS" |
630 |
+ find . -name "Makefile" -print0 | xargs -0 sed \ |
631 |
+ -i \ |
632 |
+ -e 's/ -g / /g' \ |
633 |
+ -e 's/^G =.*$/G =/' \ |
634 |
+ -e 's/^OFLAG =.*$/OFLAG =/' \ |
635 |
+ -e 's/install -c -s/install/g' |
636 |
+ eend $? |
637 |
+} |
638 |
+ |
639 |
+src_configure() { |
640 |
+ ENABLE_LTO=0 |
641 |
+ use lto && ENABLE_LTO=1 |
642 |
+ |
643 |
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is |
644 |
+ # what we want) |
645 |
+ append-cppflags -DNDEBUG |
646 |
+ |
647 |
+ # Block API and thus snapshots supported on >= 10.6 |
648 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \ |
649 |
+ append-cppflags -DSUPPORT_SNAPSHOTS |
650 |
+ |
651 |
+ CCTOOLS_OFLAG= |
652 |
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then |
653 |
+ # cctools expect to use UNIX03 struct member names. |
654 |
+ # This is default on > 10.4. Activate it on <= 10.4 by defining |
655 |
+ # __DARWIN_UNIX03 explicitly. |
656 |
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1" |
657 |
+ fi |
658 |
+ |
659 |
+ # if compiling with USE multitarget, extract all the known arches from |
660 |
+ # create_configure and pass them back to it |
661 |
+ creco=${LD64}/src/create_configure |
662 |
+ ARCHS_TO_SUPPORT="" |
663 |
+ if use multitarget ; then |
664 |
+ ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \ |
665 |
+ cut -d\" -f2 | tr ',' ' ')" |
666 |
+ fi |
667 |
+ |
668 |
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it. |
669 |
+ DERIVED_FILE_DIR=${LD64}/src \ |
670 |
+ RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \ |
671 |
+ $creco |
672 |
+ |
673 |
+ # do not depend on MachOFileAbstraction.hpp to define |
674 |
+ # SUPPORT_ARCH_arm_any because that's not included by every file where |
675 |
+ # our ppc/arm-optional patch uses it, ld.hpp in particular |
676 |
+ grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \ |
677 |
+ echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h |
678 |
+} |
679 |
+ |
680 |
+compile_ld64() { |
681 |
+ einfo "building ${LD64}" |
682 |
+ cd "${S}"/${LD64}/src |
683 |
+ emake \ |
684 |
+ LTO=${ENABLE_LTO} \ |
685 |
+ || die "emake failed for ld64" |
686 |
+ use test && emake build_test |
687 |
+} |
688 |
+ |
689 |
+compile_cctools() { |
690 |
+ einfo "building ${CCTOOLS}" |
691 |
+ cd "${S}"/${CCTOOLS} |
692 |
+ # Suppress running dsymutil because it will warn about missing debug |
693 |
+ # info which is expected when compiling without -g as we normally do. |
694 |
+ # This might need some more thought if anyone ever wanted to build us |
695 |
+ # for debugging with Apple's tools. |
696 |
+ emake \ |
697 |
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \ |
698 |
+ EFITOOLS= \ |
699 |
+ LTO="${ENABLE_LTO}" \ |
700 |
+ LTO_LIBDIR=../../../lib \ |
701 |
+ COMMON_SUBDIRS='libstuff ar misc otool' \ |
702 |
+ SUBDIRS_32= \ |
703 |
+ LEGACY= \ |
704 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
705 |
+ RC_CFLAGS="${CFLAGS}" \ |
706 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
707 |
+ DSYMUTIL=": disabled: dsymutil" \ |
708 |
+ || die "emake failed for the cctools" |
709 |
+ cd "${S}"/${CCTOOLS}/as |
710 |
+ emake \ |
711 |
+ BUILD_OBSOLETE_ARCH= \ |
712 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
713 |
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" -DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \ |
714 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
715 |
+ DSYMUTIL=": disabled: dsymutil" \ |
716 |
+ || die "emake failed for as" |
717 |
+} |
718 |
+ |
719 |
+src_compile() { |
720 |
+ compile_ld64 |
721 |
+ compile_cctools |
722 |
+} |
723 |
+ |
724 |
+install_ld64() { |
725 |
+ exeinto ${BINPATH} |
726 |
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump} |
727 |
+ dosym ld64 ${BINPATH}/ld |
728 |
+ insinto ${DATAPATH}/man/man1 |
729 |
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1 |
730 |
+} |
731 |
+ |
732 |
+install_cctools() { |
733 |
+ cd "${S}"/${CCTOOLS} |
734 |
+ emake install_all_but_headers \ |
735 |
+ EFITOOLS= \ |
736 |
+ COMMON_SUBDIRS='ar misc otool' \ |
737 |
+ SUBDIRS_32= \ |
738 |
+ DSTROOT=\"${D}\" \ |
739 |
+ BINDIR=\"${EPREFIX}\"${BINPATH} \ |
740 |
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \ |
741 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
742 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
743 |
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/ |
744 |
+ cd "${S}"/${CCTOOLS}/as |
745 |
+ emake install \ |
746 |
+ BUILD_OBSOLETE_ARCH= \ |
747 |
+ DSTROOT=\"${D}\" \ |
748 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
749 |
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
750 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} |
751 |
+ |
752 |
+ cd "${ED}"${BINPATH} |
753 |
+ insinto ${DATAPATH}/man/man1 |
754 |
+ local skips manpage |
755 |
+ # ar brings an up-to-date manpage with it |
756 |
+ skips=( ar ) |
757 |
+ for bin in *; do |
758 |
+ for skip in ${skips[@]}; do |
759 |
+ if [[ ${bin} == ${skip} ]]; then |
760 |
+ continue 2; |
761 |
+ fi |
762 |
+ done |
763 |
+ manpage=${S}/${CCTOOLS}/man/${bin}.1 |
764 |
+ if [[ -f "${manpage}" ]]; then |
765 |
+ doins "${manpage}" |
766 |
+ fi |
767 |
+ done |
768 |
+ insinto ${DATAPATH}/man/man5 |
769 |
+ doins "${S}"/${CCTOOLS}/man/*.5 |
770 |
+} |
771 |
+ |
772 |
+src_test() { |
773 |
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then |
774 |
+ einfo "Test suite only works properly with clang - please install" |
775 |
+ return |
776 |
+ fi |
777 |
+ |
778 |
+ einfo "Running unit tests" |
779 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
780 |
+ # provide the new ld as a symlink to clang so that -ccc-install-dir |
781 |
+ # will pick it up |
782 |
+ ln -sfn ../../src/ld64 ld |
783 |
+ # use our arch command because the System's will report i386 even for an |
784 |
+ # x86_64 prefix |
785 |
+ perl ../bin/make-recursive.pl \ |
786 |
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \ |
787 |
+ ARCH="$(arch)" \ |
788 |
+ LD="${S}"/${LD64}/src/ld64 \ |
789 |
+ CC="${CC} -ccc-install-dir $PWD" \ |
790 |
+ CXX="${CXX} -ccc-install-dir $PWD" \ |
791 |
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \ |
792 |
+ | perl ../bin/result-filter.pl |
793 |
+} |
794 |
+ |
795 |
+src_install() { |
796 |
+ install_ld64 |
797 |
+ install_cctools |
798 |
+ |
799 |
+ cd "${S}" |
800 |
+ insinto /etc/env.d/binutils |
801 |
+ cat <<-EOF > env.d |
802 |
+ TARGET="${CHOST}" |
803 |
+ VER="${PV}" |
804 |
+ FAKE_TARGETS="${CHOST}" |
805 |
+ EOF |
806 |
+ newins env.d ${CHOST}-${PV} |
807 |
+} |
808 |
+ |
809 |
+pkg_postinst() { |
810 |
+ binutils-config ${CHOST}-${PV} |
811 |
+} |
812 |
|
813 |
diff --git a/sys-devel/binutils-apple/binutils-apple-7.2-r1.ebuild b/sys-devel/binutils-apple/binutils-apple-7.2-r1.ebuild |
814 |
new file mode 100644 |
815 |
index 0000000..e251faf |
816 |
--- /dev/null |
817 |
+++ b/sys-devel/binutils-apple/binutils-apple-7.2-r1.ebuild |
818 |
@@ -0,0 +1,374 @@ |
819 |
+# Copyright 1999-2016 Gentoo Foundation |
820 |
+# Distributed under the terms of the GNU General Public License v2 |
821 |
+# $Id$ |
822 |
+ |
823 |
+EAPI="5" |
824 |
+ |
825 |
+inherit eutils flag-o-matic toolchain-funcs |
826 |
+ |
827 |
+LD64=ld64-253.9 |
828 |
+CCTOOLS_VERSION=877.8 |
829 |
+CCTOOLS=cctools-${CCTOOLS_VERSION} |
830 |
+LIBUNWIND=libunwind-35.3 |
831 |
+DYLD=dyld-360.18 |
832 |
+ |
833 |
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}" |
834 |
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/" |
835 |
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz |
836 |
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz |
837 |
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz |
838 |
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz |
839 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r1.tar.bz2 |
840 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r2.tar.bz2 |
841 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r1.tar.bz2 |
842 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r1.tar.bz2 |
843 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r2.tar.bz2 |
844 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.2-r0.tar.bz2" |
845 |
+ |
846 |
+LICENSE="APSL-2" |
847 |
+KEYWORDS="~x64-macos ~x86-macos" |
848 |
+IUSE="lto test multitarget" |
849 |
+ |
850 |
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses |
851 |
+# C++11 language fatures. *But additionally* the as driver now defaults to |
852 |
+# calling clang as the assembler on many platforms. This can be disabled using |
853 |
+# -Wa,-Q but since it's default we make llvm a static runtime dependency. |
854 |
+RDEPEND="sys-devel/binutils-config |
855 |
+ lto? ( app-arch/xar ) |
856 |
+ sys-devel/llvm |
857 |
+ sys-libs/libcxx" |
858 |
+DEPEND="${RDEPEND} |
859 |
+ test? ( >=dev-lang/perl-5.8.8 )" |
860 |
+ |
861 |
+export CTARGET=${CTARGET:-${CHOST}} |
862 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
863 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
864 |
+ export CTARGET=${CATEGORY#cross-} |
865 |
+ fi |
866 |
+fi |
867 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
868 |
+ |
869 |
+if is_cross ; then |
870 |
+ SLOT="${CTARGET}-7" |
871 |
+else |
872 |
+ SLOT="7" |
873 |
+fi |
874 |
+ |
875 |
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
876 |
+INCPATH=${LIBPATH}/include |
877 |
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
878 |
+if is_cross ; then |
879 |
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV} |
880 |
+else |
881 |
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV} |
882 |
+fi |
883 |
+ |
884 |
+S=${WORKDIR} |
885 |
+ |
886 |
+src_prepare() { |
887 |
+ if use multitarget ; then |
888 |
+ ewarn "You have enabled support for non-standard target architectures" |
889 |
+ ewarn "using USE=multitarget. This includes experimental support for" |
890 |
+ ewarn "ppc and ppc64 which is a community forward-port from the last" |
891 |
+ ewarn "version of ld64 to officially support PPC." |
892 |
+ |
893 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
894 |
+ ewarn "HERE BE DRAGONS! Your system seems to be PPC which means that" |
895 |
+ ewarn "the actual usability of your Gentoo programs will depend on the" |
896 |
+ ewarn "above-mentioned experimental PPC support in the linker. Be" |
897 |
+ ewarn "sure to keep a known-to-work version like ${PN}-3.2.6 around!" |
898 |
+ fi |
899 |
+ fi |
900 |
+ |
901 |
+ cd "${S}"/${LD64}/src |
902 |
+ cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h |
903 |
+ cp "${S}"/ld64-253.3-Makefile-3 Makefile |
904 |
+ |
905 |
+ epatch "${S}"/ld64-253.9-nolto.patch |
906 |
+ epatch "${S}"/ld64-241.9-extraneous-includes.patch |
907 |
+ epatch "${S}"/ld64-241.9-osatomic.patch |
908 |
+ epatch "${S}"/ld64-236.3-crashreporter.patch |
909 |
+ epatch "${S}"/ld64-253.3-nosnapshots.patch |
910 |
+ epatch "${S}"/ld64-253.3-ppc.patch |
911 |
+ epatch "${S}"/ld64-236.3-constant-types-2.patch |
912 |
+ epatch "${S}"/ld64-241.9-register-names.patch |
913 |
+ epatch "${S}"/ld64-241.9-get-comm-align.patch |
914 |
+ epatch "${S}"/ld64-241.9-cc_md5.patch |
915 |
+ epatch "${S}"/ld64-253.3-make_pair.patch |
916 |
+ epatch "${S}"/ld64-253.3-delete-warning.patch |
917 |
+ |
918 |
+ # provide missing headers from libunwind and dyld |
919 |
+ mkdir -p include/{mach,mach-o/arm} || die |
920 |
+ # never present because it's private |
921 |
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die |
922 |
+ # missing on <= 10.5 |
923 |
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die |
924 |
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die |
925 |
+ # missing on <= 10.4 |
926 |
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die |
927 |
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die |
928 |
+ # use copies from cctools because they're otherwise hidden in some SDK |
929 |
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die |
930 |
+ # provide all required CPU_TYPEs on all platforms |
931 |
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h |
932 |
+ # add alias for newer identifiers, because ld64 uses both but cctools |
933 |
+ # header only defines the older |
934 |
+ epatch "${S}"/ld64-236.3-missing-cputypes.patch |
935 |
+ |
936 |
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on |
937 |
+ # older systems |
938 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \ |
939 |
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h |
940 |
+ |
941 |
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\"" |
942 |
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp |
943 |
+ |
944 |
+ epatch "${S}"/ld64-123.2-debug-backtrace.patch |
945 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
946 |
+ epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch |
947 |
+ epatch "${S}"/ld64-127.2-thread_state.patch |
948 |
+ fi |
949 |
+ |
950 |
+ cd "${S}"/${CCTOOLS} |
951 |
+ epatch "${S}"/${PN}-4.5-as.patch |
952 |
+ epatch "${S}"/${PN}-5.1-as-dir.patch |
953 |
+ epatch "${S}"/${PN}-5.1-ranlib.patch |
954 |
+ epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch |
955 |
+ epatch "${S}"/${PN}-3.1.1-no-headers.patch |
956 |
+ epatch "${S}"/${PN}-4.0-no-oss-dir.patch |
957 |
+ epatch "${S}"/cctools-839-intel-retf.patch |
958 |
+ epatch "${S}"/${PN}-5.1-extraneous-includes.patch |
959 |
+ #epatch "${S}"/${PN}-5.1-otool-stdc.patch |
960 |
+ epatch "${S}"/${PN}-5.1-constant-types.patch |
961 |
+ epatch "${S}"/${PN}-5.1-strnlen.patch |
962 |
+ epatch "${S}"/${PN}-5.1-ppc.patch |
963 |
+ epatch "${S}"/${PN}-5.1-thread-state-redefined.patch |
964 |
+ epatch "${S}"/${PN}-7.0-make-j.patch |
965 |
+ epatch "${S}"/${PN}-7.0-lto-prefix-2.patch |
966 |
+ epatch "${S}"/${PN}-7.0-clang-as.patch |
967 |
+ epatch "${S}"/${PN}-7.0-nolto.patch |
968 |
+ epatch "${S}"/${PN}-7.0-nollvm.patch |
969 |
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die |
970 |
+ |
971 |
+ # do not build profileable libstuff to save compile time |
972 |
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile |
973 |
+ |
974 |
+ # cctools version is provided to make via RC_ProjectSourceVersion which |
975 |
+ # generates and compiles it as apple_version[] into libstuff. From |
976 |
+ # there it's picked up by the individual tools. Since |
977 |
+ # RC_ProjectSourceVersion is also used as library version, we can't |
978 |
+ # just append our local version info. So we hack the libstuff Makefile |
979 |
+ # to include our Gentoo version. |
980 |
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \ |
981 |
+ libstuff/Makefile |
982 |
+ |
983 |
+ # clean up test suite |
984 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
985 |
+ local c |
986 |
+ |
987 |
+ # we don't have llvm |
988 |
+ ((++c)); rm -rf llvm-integration; |
989 |
+ |
990 |
+ # we don't have dtrace |
991 |
+ ((++c)); rm -rf dtrace-static-probes-coalescing; |
992 |
+ ((++c)); rm -rf dtrace-static-probes; |
993 |
+ |
994 |
+ # a file is missing |
995 |
+ ((++c)); rm -rf eh-coalescing-r |
996 |
+ |
997 |
+ # we don't do universal binaries |
998 |
+ ((++c)); rm -rf blank-stubs; |
999 |
+ |
1000 |
+ # looks like a problem with apple's result-filter.pl |
1001 |
+ ((++c)); rm -rf implicit-common3; |
1002 |
+ ((++c)); rm -rf order_file-ans; |
1003 |
+ |
1004 |
+ # TODO no idea what goes wrong here |
1005 |
+ ((++c)); rm -rf dwarf-debug-notes; |
1006 |
+ |
1007 |
+ einfo "Deleted $c tests that were bound to fail" |
1008 |
+ |
1009 |
+ cd "${S}" |
1010 |
+ ebegin "cleaning Makefiles from unwanted CFLAGS" |
1011 |
+ find . -name "Makefile" -print0 | xargs -0 sed \ |
1012 |
+ -i \ |
1013 |
+ -e 's/ -g / /g' \ |
1014 |
+ -e 's/^G =.*$/G =/' \ |
1015 |
+ -e 's/^OFLAG =.*$/OFLAG =/' \ |
1016 |
+ -e 's/install -c -s/install/g' |
1017 |
+ eend $? |
1018 |
+} |
1019 |
+ |
1020 |
+src_configure() { |
1021 |
+ ENABLE_LTO=0 |
1022 |
+ use lto && ENABLE_LTO=1 |
1023 |
+ |
1024 |
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is |
1025 |
+ # what we want) |
1026 |
+ append-cppflags -DNDEBUG |
1027 |
+ |
1028 |
+ # Block API and thus snapshots supported on >= 10.6 |
1029 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \ |
1030 |
+ append-cppflags -DSUPPORT_SNAPSHOTS |
1031 |
+ |
1032 |
+ CCTOOLS_OFLAG= |
1033 |
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then |
1034 |
+ # cctools expect to use UNIX03 struct member names. |
1035 |
+ # This is default on > 10.4. Activate it on <= 10.4 by defining |
1036 |
+ # __DARWIN_UNIX03 explicitly. |
1037 |
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1" |
1038 |
+ fi |
1039 |
+ |
1040 |
+ # if compiling with USE multitarget, extract all the known arches from |
1041 |
+ # create_configure and pass them back to it |
1042 |
+ creco=${LD64}/src/create_configure |
1043 |
+ ARCHS_TO_SUPPORT="" |
1044 |
+ if use multitarget ; then |
1045 |
+ ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \ |
1046 |
+ cut -d\" -f2 | tr ',' ' ')" |
1047 |
+ fi |
1048 |
+ |
1049 |
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it. |
1050 |
+ DERIVED_FILE_DIR=${LD64}/src \ |
1051 |
+ RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \ |
1052 |
+ $creco |
1053 |
+ |
1054 |
+ # do not depend on MachOFileAbstraction.hpp to define |
1055 |
+ # SUPPORT_ARCH_arm_any because that's not included by every file where |
1056 |
+ # our ppc/arm-optional patch uses it, ld.hpp in particular |
1057 |
+ grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \ |
1058 |
+ echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h |
1059 |
+} |
1060 |
+ |
1061 |
+compile_ld64() { |
1062 |
+ einfo "building ${LD64}" |
1063 |
+ cd "${S}"/${LD64}/src |
1064 |
+ emake \ |
1065 |
+ LTO=${ENABLE_LTO} \ |
1066 |
+ || die "emake failed for ld64" |
1067 |
+ use test && emake build_test |
1068 |
+} |
1069 |
+ |
1070 |
+compile_cctools() { |
1071 |
+ einfo "building ${CCTOOLS}" |
1072 |
+ cd "${S}"/${CCTOOLS} |
1073 |
+ # Suppress running dsymutil because it will warn about missing debug |
1074 |
+ # info which is expected when compiling without -g as we normally do. |
1075 |
+ # This might need some more thought if anyone ever wanted to build us |
1076 |
+ # for debugging with Apple's tools. |
1077 |
+ emake \ |
1078 |
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \ |
1079 |
+ EFITOOLS= \ |
1080 |
+ LTO="${ENABLE_LTO}" \ |
1081 |
+ LTO_LIBDIR=../../../lib \ |
1082 |
+ COMMON_SUBDIRS='libstuff ar misc otool' \ |
1083 |
+ SUBDIRS_32= \ |
1084 |
+ LEGACY= \ |
1085 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1086 |
+ RC_CFLAGS="${CFLAGS}" \ |
1087 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1088 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1089 |
+ || die "emake failed for the cctools" |
1090 |
+ cd "${S}"/${CCTOOLS}/as |
1091 |
+ emake \ |
1092 |
+ BUILD_OBSOLETE_ARCH= \ |
1093 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1094 |
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" -DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \ |
1095 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1096 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1097 |
+ || die "emake failed for as" |
1098 |
+} |
1099 |
+ |
1100 |
+src_compile() { |
1101 |
+ compile_ld64 |
1102 |
+ compile_cctools |
1103 |
+} |
1104 |
+ |
1105 |
+install_ld64() { |
1106 |
+ exeinto ${BINPATH} |
1107 |
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump} |
1108 |
+ dosym ld64 ${BINPATH}/ld |
1109 |
+ insinto ${DATAPATH}/man/man1 |
1110 |
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1 |
1111 |
+} |
1112 |
+ |
1113 |
+install_cctools() { |
1114 |
+ cd "${S}"/${CCTOOLS} |
1115 |
+ emake install_all_but_headers \ |
1116 |
+ EFITOOLS= \ |
1117 |
+ COMMON_SUBDIRS='ar misc otool' \ |
1118 |
+ SUBDIRS_32= \ |
1119 |
+ DSTROOT=\"${D}\" \ |
1120 |
+ BINDIR=\"${EPREFIX}\"${BINPATH} \ |
1121 |
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1122 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1123 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1124 |
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/ |
1125 |
+ cd "${S}"/${CCTOOLS}/as |
1126 |
+ emake install \ |
1127 |
+ BUILD_OBSOLETE_ARCH= \ |
1128 |
+ DSTROOT=\"${D}\" \ |
1129 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1130 |
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1131 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} |
1132 |
+ |
1133 |
+ cd "${ED}"${BINPATH} |
1134 |
+ insinto ${DATAPATH}/man/man1 |
1135 |
+ local skips manpage |
1136 |
+ # ar brings an up-to-date manpage with it |
1137 |
+ skips=( ar ) |
1138 |
+ for bin in *; do |
1139 |
+ for skip in ${skips[@]}; do |
1140 |
+ if [[ ${bin} == ${skip} ]]; then |
1141 |
+ continue 2; |
1142 |
+ fi |
1143 |
+ done |
1144 |
+ manpage=${S}/${CCTOOLS}/man/${bin}.1 |
1145 |
+ if [[ -f "${manpage}" ]]; then |
1146 |
+ doins "${manpage}" |
1147 |
+ fi |
1148 |
+ done |
1149 |
+ insinto ${DATAPATH}/man/man5 |
1150 |
+ doins "${S}"/${CCTOOLS}/man/*.5 |
1151 |
+} |
1152 |
+ |
1153 |
+src_test() { |
1154 |
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then |
1155 |
+ einfo "Test suite only works properly with clang - please install" |
1156 |
+ return |
1157 |
+ fi |
1158 |
+ |
1159 |
+ einfo "Running unit tests" |
1160 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
1161 |
+ # provide the new ld as a symlink to clang so that -ccc-install-dir |
1162 |
+ # will pick it up |
1163 |
+ ln -sfn ../../src/ld64 ld |
1164 |
+ # use our arch command because the System's will report i386 even for an |
1165 |
+ # x86_64 prefix |
1166 |
+ perl ../bin/make-recursive.pl \ |
1167 |
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \ |
1168 |
+ ARCH="$(arch)" \ |
1169 |
+ LD="${S}"/${LD64}/src/ld64 \ |
1170 |
+ CC="${CC} -ccc-install-dir $PWD" \ |
1171 |
+ CXX="${CXX} -ccc-install-dir $PWD" \ |
1172 |
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \ |
1173 |
+ | perl ../bin/result-filter.pl |
1174 |
+} |
1175 |
+ |
1176 |
+src_install() { |
1177 |
+ install_ld64 |
1178 |
+ install_cctools |
1179 |
+ |
1180 |
+ cd "${S}" |
1181 |
+ insinto /etc/env.d/binutils |
1182 |
+ cat <<-EOF > env.d |
1183 |
+ TARGET="${CHOST}" |
1184 |
+ VER="${PV}" |
1185 |
+ FAKE_TARGETS="${CHOST}" |
1186 |
+ EOF |
1187 |
+ newins env.d ${CHOST}-${PV} |
1188 |
+} |
1189 |
+ |
1190 |
+pkg_postinst() { |
1191 |
+ binutils-config ${CHOST}-${PV} |
1192 |
+} |
1193 |
|
1194 |
diff --git a/sys-devel/binutils-apple/binutils-apple-7.3.1.ebuild b/sys-devel/binutils-apple/binutils-apple-7.3.1.ebuild |
1195 |
new file mode 100644 |
1196 |
index 0000000..68ecb9f |
1197 |
--- /dev/null |
1198 |
+++ b/sys-devel/binutils-apple/binutils-apple-7.3.1.ebuild |
1199 |
@@ -0,0 +1,390 @@ |
1200 |
+# Copyright 1999-2016 Gentoo Foundation |
1201 |
+# Distributed under the terms of the GNU General Public License v2 |
1202 |
+# $Id$ |
1203 |
+ |
1204 |
+EAPI="5" |
1205 |
+ |
1206 |
+inherit eutils flag-o-matic toolchain-funcs |
1207 |
+ |
1208 |
+LD64=ld64-264.3.102 |
1209 |
+CCTOOLS_VERSION=886 |
1210 |
+CCTOOLS=cctools-${CCTOOLS_VERSION} |
1211 |
+LIBUNWIND=libunwind-35.3 |
1212 |
+DYLD=dyld-360.18 |
1213 |
+ |
1214 |
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}" |
1215 |
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/" |
1216 |
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz |
1217 |
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz |
1218 |
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz |
1219 |
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz |
1220 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r1.tar.bz2 |
1221 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r2.tar.bz2 |
1222 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r1.tar.bz2 |
1223 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r1.tar.bz2 |
1224 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r2.tar.bz2 |
1225 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.2-r0.tar.bz2 |
1226 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.3-r0.tar.bz2" |
1227 |
+ |
1228 |
+LICENSE="APSL-2" |
1229 |
+KEYWORDS="~x64-macos ~x86-macos" |
1230 |
+IUSE="lto test multitarget" |
1231 |
+ |
1232 |
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses |
1233 |
+# C++11 language fatures. *But additionally* the as driver now defaults to |
1234 |
+# calling clang as the assembler on many platforms. This can be disabled using |
1235 |
+# -Wa,-Q but since it's default we make llvm a static runtime dependency. |
1236 |
+RDEPEND="sys-devel/binutils-config |
1237 |
+ lto? ( app-arch/xar ) |
1238 |
+ sys-devel/llvm |
1239 |
+ sys-libs/libcxx" |
1240 |
+DEPEND="${RDEPEND} |
1241 |
+ test? ( >=dev-lang/perl-5.8.8 )" |
1242 |
+ |
1243 |
+export CTARGET=${CTARGET:-${CHOST}} |
1244 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
1245 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
1246 |
+ export CTARGET=${CATEGORY#cross-} |
1247 |
+ fi |
1248 |
+fi |
1249 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
1250 |
+ |
1251 |
+if is_cross ; then |
1252 |
+ SLOT="${CTARGET}-7" |
1253 |
+else |
1254 |
+ SLOT="7" |
1255 |
+fi |
1256 |
+ |
1257 |
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
1258 |
+INCPATH=${LIBPATH}/include |
1259 |
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
1260 |
+if is_cross ; then |
1261 |
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV} |
1262 |
+else |
1263 |
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV} |
1264 |
+fi |
1265 |
+ |
1266 |
+S=${WORKDIR} |
1267 |
+ |
1268 |
+src_prepare() { |
1269 |
+ if use multitarget ; then |
1270 |
+ ewarn "You have enabled support for non-standard target architectures" |
1271 |
+ ewarn "using USE=multitarget. This includes experimental support for" |
1272 |
+ ewarn "ppc and ppc64 which is a community forward-port from the last" |
1273 |
+ ewarn "version of ld64 to officially support PPC." |
1274 |
+ |
1275 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
1276 |
+ ewarn "HERE BE DRAGONS! Your system seems to be PPC which means that" |
1277 |
+ ewarn "the actual usability of your Gentoo programs will depend on the" |
1278 |
+ ewarn "above-mentioned experimental PPC support in the linker. Be" |
1279 |
+ ewarn "sure to keep a known-to-work version like ${PN}-3.2.6 around!" |
1280 |
+ fi |
1281 |
+ fi |
1282 |
+ |
1283 |
+ cd "${S}"/${LD64}/src |
1284 |
+ cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h |
1285 |
+ cp "${S}"/ld64-264.3.101-Makefile Makefile |
1286 |
+ |
1287 |
+ epatch "${S}"/ld64-264.3.101-nolto.patch |
1288 |
+ epatch "${S}"/ld64-241.9-extraneous-includes.patch |
1289 |
+ epatch "${S}"/ld64-241.9-osatomic.patch |
1290 |
+ epatch "${S}"/ld64-236.3-crashreporter.patch |
1291 |
+ epatch "${S}"/ld64-264.3.101-nosnapshots.patch |
1292 |
+ epatch "${S}"/ld64-264.3.101-ppc.patch |
1293 |
+ epatch "${S}"/ld64-264.3.101-constant-types.patch |
1294 |
+ epatch "${S}"/ld64-241.9-register-names.patch |
1295 |
+ epatch "${S}"/ld64-241.9-get-comm-align.patch |
1296 |
+ epatch "${S}"/ld64-241.9-cc_md5.patch |
1297 |
+ |
1298 |
+ # provide missing headers from libunwind and dyld |
1299 |
+ mkdir -p include/{mach,mach-o/arm} || die |
1300 |
+ # never present because it's private |
1301 |
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die |
1302 |
+ # missing on <= 10.5 |
1303 |
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die |
1304 |
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die |
1305 |
+ # missing on <= 10.4 |
1306 |
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die |
1307 |
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die |
1308 |
+ # use copies from cctools because they're otherwise hidden in some SDK |
1309 |
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die |
1310 |
+ # provide all required CPU_TYPEs on all platforms |
1311 |
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h |
1312 |
+ # add alias for newer identifiers, because ld64 uses both but cctools |
1313 |
+ # header only defines the older |
1314 |
+ epatch "${S}"/ld64-236.3-missing-cputypes.patch |
1315 |
+ |
1316 |
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on |
1317 |
+ # older systems |
1318 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \ |
1319 |
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h |
1320 |
+ |
1321 |
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\"" |
1322 |
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp |
1323 |
+ |
1324 |
+ epatch "${S}"/ld64-123.2-debug-backtrace.patch |
1325 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
1326 |
+ epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch |
1327 |
+ epatch "${S}"/ld64-127.2-thread_state.patch |
1328 |
+ fi |
1329 |
+ |
1330 |
+ cd "${S}"/${CCTOOLS} |
1331 |
+ epatch "${S}"/${PN}-4.5-as.patch |
1332 |
+ epatch "${S}"/${PN}-5.1-as-dir.patch |
1333 |
+ epatch "${S}"/${PN}-5.1-ranlib.patch |
1334 |
+ epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch |
1335 |
+ epatch "${S}"/${PN}-3.1.1-no-headers.patch |
1336 |
+ epatch "${S}"/${PN}-4.0-no-oss-dir.patch |
1337 |
+ epatch "${S}"/cctools-839-intel-retf.patch |
1338 |
+ epatch "${S}"/${PN}-5.1-extraneous-includes.patch |
1339 |
+ #epatch "${S}"/${PN}-5.1-otool-stdc.patch |
1340 |
+ epatch "${S}"/${PN}-5.1-constant-types.patch |
1341 |
+ epatch "${S}"/${PN}-5.1-strnlen.patch |
1342 |
+ epatch "${S}"/${PN}-5.1-ppc.patch |
1343 |
+ epatch "${S}"/${PN}-5.1-thread-state-redefined.patch |
1344 |
+ epatch "${S}"/${PN}-7.3-make-j.patch |
1345 |
+ epatch "${S}"/${PN}-7.0-lto-prefix-2.patch |
1346 |
+ epatch "${S}"/${PN}-7.0-clang-as.patch |
1347 |
+ epatch "${S}"/${PN}-7.3-nolto.patch |
1348 |
+ epatch "${S}"/${PN}-7.3-nollvm.patch |
1349 |
+ epatch "${S}"/${PN}-7.3-no-developertools-dir.patch |
1350 |
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die |
1351 |
+ |
1352 |
+ # do not build profileable libstuff to save compile time |
1353 |
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile |
1354 |
+ |
1355 |
+ # cctools version is provided to make via RC_ProjectSourceVersion which |
1356 |
+ # generates and compiles it as apple_version[] into libstuff. From |
1357 |
+ # there it's picked up by the individual tools. Since |
1358 |
+ # RC_ProjectSourceVersion is also used as library version, we can't |
1359 |
+ # just append our local version info. So we hack the libstuff Makefile |
1360 |
+ # to include our Gentoo version. |
1361 |
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \ |
1362 |
+ libstuff/Makefile |
1363 |
+ |
1364 |
+ # clean up test suite |
1365 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
1366 |
+ local c |
1367 |
+ |
1368 |
+ # we don't have llvm |
1369 |
+ ((++c)); rm -rf llvm-integration; |
1370 |
+ |
1371 |
+ # we don't have dtrace |
1372 |
+ ((++c)); rm -rf dtrace-static-probes-coalescing; |
1373 |
+ ((++c)); rm -rf dtrace-static-probes; |
1374 |
+ |
1375 |
+ # a file is missing |
1376 |
+ ((++c)); rm -rf eh-coalescing-r |
1377 |
+ |
1378 |
+ # we don't do universal binaries |
1379 |
+ ((++c)); rm -rf blank-stubs; |
1380 |
+ |
1381 |
+ # looks like a problem with apple's result-filter.pl |
1382 |
+ ((++c)); rm -rf implicit-common3; |
1383 |
+ ((++c)); rm -rf order_file-ans; |
1384 |
+ |
1385 |
+ # TODO no idea what goes wrong here |
1386 |
+ ((++c)); rm -rf dwarf-debug-notes; |
1387 |
+ |
1388 |
+ einfo "Deleted $c tests that were bound to fail" |
1389 |
+ |
1390 |
+ cd "${S}" |
1391 |
+ ebegin "cleaning Makefiles from unwanted CFLAGS" |
1392 |
+ find . -name "Makefile" -print0 | xargs -0 sed \ |
1393 |
+ -i \ |
1394 |
+ -e 's/ -g / /g' \ |
1395 |
+ -e 's/^G =.*$/G =/' \ |
1396 |
+ -e 's/^OFLAG =.*$/OFLAG =/' \ |
1397 |
+ -e 's/install -c -s/install/g' |
1398 |
+ eend $? |
1399 |
+} |
1400 |
+ |
1401 |
+src_configure() { |
1402 |
+ ENABLE_LTO=0 |
1403 |
+ use lto && ENABLE_LTO=1 |
1404 |
+ |
1405 |
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is |
1406 |
+ # what we want) |
1407 |
+ append-cppflags -DNDEBUG |
1408 |
+ |
1409 |
+ # Block API and thus snapshots supported on >= 10.6 |
1410 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \ |
1411 |
+ append-cppflags -DSUPPORT_SNAPSHOTS |
1412 |
+ |
1413 |
+ CCTOOLS_OFLAG= |
1414 |
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then |
1415 |
+ # cctools expect to use UNIX03 struct member names. |
1416 |
+ # This is default on > 10.4. Activate it on <= 10.4 by defining |
1417 |
+ # __DARWIN_UNIX03 explicitly. |
1418 |
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1" |
1419 |
+ fi |
1420 |
+ |
1421 |
+ # if compiling with USE multitarget, extract all the known arches from |
1422 |
+ # create_configure and pass them back to it |
1423 |
+ creco=${LD64}/src/create_configure |
1424 |
+ ARCHS_TO_SUPPORT="" |
1425 |
+ if use multitarget ; then |
1426 |
+ ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \ |
1427 |
+ cut -d\" -f2 | tr ',' ' ')" |
1428 |
+ fi |
1429 |
+ |
1430 |
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it. |
1431 |
+ DERIVED_FILE_DIR=${LD64}/src \ |
1432 |
+ RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \ |
1433 |
+ $creco |
1434 |
+ |
1435 |
+ # do not depend on MachOFileAbstraction.hpp to define |
1436 |
+ # SUPPORT_ARCH_arm_any because that's not included by every file where |
1437 |
+ # our ppc/arm-optional patch uses it, ld.hpp in particular |
1438 |
+ grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \ |
1439 |
+ echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h |
1440 |
+} |
1441 |
+ |
1442 |
+compile_ld64() { |
1443 |
+ einfo "building ${LD64}" |
1444 |
+ cd "${S}"/${LD64}/src |
1445 |
+ emake \ |
1446 |
+ LTO=${ENABLE_LTO} \ |
1447 |
+ || die "emake failed for ld64" |
1448 |
+ use test && emake build_test |
1449 |
+} |
1450 |
+ |
1451 |
+compile_cctools() { |
1452 |
+ einfo "building ${CCTOOLS}" |
1453 |
+ cd "${S}"/${CCTOOLS} |
1454 |
+ # Suppress running dsymutil because it will warn about missing debug |
1455 |
+ # info which is expected when compiling without -g as we normally do. |
1456 |
+ # This might need some more thought if anyone ever wanted to build us |
1457 |
+ # for debugging with Apple's tools. |
1458 |
+ emake \ |
1459 |
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \ |
1460 |
+ EFITOOLS= \ |
1461 |
+ LTO="${ENABLE_LTO}" \ |
1462 |
+ LTO_LIBDIR=../../../lib \ |
1463 |
+ COMMON_SUBDIRS='libstuff ar misc otool' \ |
1464 |
+ SUBDIRS_32= \ |
1465 |
+ LEGACY= \ |
1466 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1467 |
+ RC_CFLAGS="${CFLAGS}" \ |
1468 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1469 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1470 |
+ || die "emake failed for the cctools" |
1471 |
+ cd "${S}"/${CCTOOLS}/as |
1472 |
+ emake \ |
1473 |
+ BUILD_OBSOLETE_ARCH= \ |
1474 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1475 |
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" -DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \ |
1476 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1477 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1478 |
+ || die "emake failed for as" |
1479 |
+} |
1480 |
+ |
1481 |
+src_compile() { |
1482 |
+ compile_ld64 |
1483 |
+ compile_cctools |
1484 |
+} |
1485 |
+ |
1486 |
+install_ld64() { |
1487 |
+ exeinto ${BINPATH} |
1488 |
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump} |
1489 |
+ dosym ld64 ${BINPATH}/ld |
1490 |
+ insinto ${DATAPATH}/man/man1 |
1491 |
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1 |
1492 |
+} |
1493 |
+ |
1494 |
+install_cctools() { |
1495 |
+ cd "${S}"/${CCTOOLS} |
1496 |
+ emake install_all_but_headers \ |
1497 |
+ EFITOOLS= \ |
1498 |
+ COMMON_SUBDIRS='ar misc otool' \ |
1499 |
+ SUBDIRS_32= \ |
1500 |
+ DSTROOT=\"${D}\" \ |
1501 |
+ BINDIR=\"${EPREFIX}\"${BINPATH} \ |
1502 |
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1503 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1504 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1505 |
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/ |
1506 |
+ cd "${S}"/${CCTOOLS}/as |
1507 |
+ emake install \ |
1508 |
+ BUILD_OBSOLETE_ARCH= \ |
1509 |
+ DSTROOT=\"${D}\" \ |
1510 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1511 |
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1512 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} |
1513 |
+ |
1514 |
+ # upstream is starting to replace classic binutils with llvm-integrated |
1515 |
+ # ones. nm and size are now symlinks to llvm-{nm,size} while the classic |
1516 |
+ # version is preserved as {nm,size}-classic. (BTW: otool is a symlink to |
1517 |
+ # otool-classic for now but a wrapper llvm-otool that is calling |
1518 |
+ # llvm-objdump is present already.) |
1519 |
+ # Since our binutils do not live in the same directory as the llvm |
1520 |
+ # installation, we have to rewrite the symlinks to the llvm tools. |
1521 |
+ # This also means, that these tools still appear to be versioned via |
1522 |
+ # binutils-config but actually always run the currently installed llvm |
1523 |
+ # tool. |
1524 |
+ for tool in nm size ; do |
1525 |
+ # ${EPREFIX}/usr/x86_64-apple-darwin15/binutils-bin/7.3/$tool |
1526 |
+ # -> ${EPREFIX}/bin/llvm-$tool |
1527 |
+ ln -sfn ../../../bin/llvm-$tool "${D}/${EPREFIX}/${BINPATH}/$tool" |
1528 |
+ done |
1529 |
+ |
1530 |
+ cd "${ED}"${BINPATH} |
1531 |
+ insinto ${DATAPATH}/man/man1 |
1532 |
+ local skips manpage |
1533 |
+ # ar brings an up-to-date manpage with it |
1534 |
+ skips=( ar ) |
1535 |
+ for bin in *; do |
1536 |
+ for skip in ${skips[@]}; do |
1537 |
+ if [[ ${bin} == ${skip} ]]; then |
1538 |
+ continue 2; |
1539 |
+ fi |
1540 |
+ done |
1541 |
+ manpage=${S}/${CCTOOLS}/man/${bin}.1 |
1542 |
+ if [[ -f "${manpage}" ]]; then |
1543 |
+ doins "${manpage}" |
1544 |
+ fi |
1545 |
+ done |
1546 |
+ insinto ${DATAPATH}/man/man5 |
1547 |
+ doins "${S}"/${CCTOOLS}/man/*.5 |
1548 |
+} |
1549 |
+ |
1550 |
+src_test() { |
1551 |
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then |
1552 |
+ einfo "Test suite only works properly with clang - please install" |
1553 |
+ return |
1554 |
+ fi |
1555 |
+ |
1556 |
+ einfo "Running unit tests" |
1557 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
1558 |
+ # provide the new ld as a symlink to clang so that -ccc-install-dir |
1559 |
+ # will pick it up |
1560 |
+ ln -sfn ../../src/ld64 ld |
1561 |
+ # use our arch command because the System's will report i386 even for an |
1562 |
+ # x86_64 prefix |
1563 |
+ perl ../bin/make-recursive.pl \ |
1564 |
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \ |
1565 |
+ ARCH="$(arch)" \ |
1566 |
+ LD="${S}"/${LD64}/src/ld64 \ |
1567 |
+ CC="${CC} -ccc-install-dir $PWD" \ |
1568 |
+ CXX="${CXX} -ccc-install-dir $PWD" \ |
1569 |
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \ |
1570 |
+ | perl ../bin/result-filter.pl |
1571 |
+} |
1572 |
+ |
1573 |
+src_install() { |
1574 |
+ install_ld64 |
1575 |
+ install_cctools |
1576 |
+ |
1577 |
+ cd "${S}" |
1578 |
+ insinto /etc/env.d/binutils |
1579 |
+ cat <<-EOF > env.d |
1580 |
+ TARGET="${CHOST}" |
1581 |
+ VER="${PV}" |
1582 |
+ FAKE_TARGETS="${CHOST}" |
1583 |
+ EOF |
1584 |
+ newins env.d ${CHOST}-${PV} |
1585 |
+} |
1586 |
+ |
1587 |
+pkg_postinst() { |
1588 |
+ binutils-config ${CHOST}-${PV} |
1589 |
+} |
1590 |
|
1591 |
diff --git a/sys-devel/binutils-apple/binutils-apple-7.3.ebuild b/sys-devel/binutils-apple/binutils-apple-7.3.ebuild |
1592 |
new file mode 100644 |
1593 |
index 0000000..89e17b0 |
1594 |
--- /dev/null |
1595 |
+++ b/sys-devel/binutils-apple/binutils-apple-7.3.ebuild |
1596 |
@@ -0,0 +1,390 @@ |
1597 |
+# Copyright 1999-2016 Gentoo Foundation |
1598 |
+# Distributed under the terms of the GNU General Public License v2 |
1599 |
+# $Id$ |
1600 |
+ |
1601 |
+EAPI="5" |
1602 |
+ |
1603 |
+inherit eutils flag-o-matic toolchain-funcs |
1604 |
+ |
1605 |
+LD64=ld64-264.3.101 |
1606 |
+CCTOOLS_VERSION=886 |
1607 |
+CCTOOLS=cctools-${CCTOOLS_VERSION} |
1608 |
+LIBUNWIND=libunwind-35.3 |
1609 |
+DYLD=dyld-360.18 |
1610 |
+ |
1611 |
+DESCRIPTION="Darwin assembler as(1) and static linker ld(1), Xcode Tools ${PV}" |
1612 |
+HOMEPAGE="http://www.opensource.apple.com/darwinsource/" |
1613 |
+SRC_URI="http://www.opensource.apple.com/tarballs/ld64/${LD64}.tar.gz |
1614 |
+ http://www.opensource.apple.com/tarballs/cctools/${CCTOOLS}.tar.gz |
1615 |
+ http://www.opensource.apple.com/tarballs/dyld/${DYLD}.tar.gz |
1616 |
+ http://www.opensource.apple.com/tarballs/libunwind/${LIBUNWIND}.tar.gz |
1617 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-4.3-r1.tar.bz2 |
1618 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-5.1-r2.tar.bz2 |
1619 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.1-r1.tar.bz2 |
1620 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-6.3-r1.tar.bz2 |
1621 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.0-r2.tar.bz2 |
1622 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.2-r0.tar.bz2 |
1623 |
+ http://dev.gentoo.org/~grobian/distfiles/${PN}-patches-7.3-r0.tar.bz2" |
1624 |
+ |
1625 |
+LICENSE="APSL-2" |
1626 |
+KEYWORDS="~x64-macos ~x86-macos" |
1627 |
+IUSE="lto test multitarget" |
1628 |
+ |
1629 |
+# ld64 can now only be compiled using llvm and libc++ since it massivley uses |
1630 |
+# C++11 language fatures. *But additionally* the as driver now defaults to |
1631 |
+# calling clang as the assembler on many platforms. This can be disabled using |
1632 |
+# -Wa,-Q but since it's default we make llvm a static runtime dependency. |
1633 |
+RDEPEND="sys-devel/binutils-config |
1634 |
+ lto? ( app-arch/xar ) |
1635 |
+ sys-devel/llvm |
1636 |
+ sys-libs/libcxx" |
1637 |
+DEPEND="${RDEPEND} |
1638 |
+ test? ( >=dev-lang/perl-5.8.8 )" |
1639 |
+ |
1640 |
+export CTARGET=${CTARGET:-${CHOST}} |
1641 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
1642 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
1643 |
+ export CTARGET=${CATEGORY#cross-} |
1644 |
+ fi |
1645 |
+fi |
1646 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
1647 |
+ |
1648 |
+if is_cross ; then |
1649 |
+ SLOT="${CTARGET}-7" |
1650 |
+else |
1651 |
+ SLOT="7" |
1652 |
+fi |
1653 |
+ |
1654 |
+LIBPATH=/usr/$(get_libdir)/binutils/${CTARGET}/${PV} |
1655 |
+INCPATH=${LIBPATH}/include |
1656 |
+DATAPATH=/usr/share/binutils-data/${CTARGET}/${PV} |
1657 |
+if is_cross ; then |
1658 |
+ BINPATH=/usr/${CHOST}/${CTARGET}/binutils-bin/${PV} |
1659 |
+else |
1660 |
+ BINPATH=/usr/${CTARGET}/binutils-bin/${PV} |
1661 |
+fi |
1662 |
+ |
1663 |
+S=${WORKDIR} |
1664 |
+ |
1665 |
+src_prepare() { |
1666 |
+ if use multitarget ; then |
1667 |
+ ewarn "You have enabled support for non-standard target architectures" |
1668 |
+ ewarn "using USE=multitarget. This includes experimental support for" |
1669 |
+ ewarn "ppc and ppc64 which is a community forward-port from the last" |
1670 |
+ ewarn "version of ld64 to officially support PPC." |
1671 |
+ |
1672 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
1673 |
+ ewarn "HERE BE DRAGONS! Your system seems to be PPC which means that" |
1674 |
+ ewarn "the actual usability of your Gentoo programs will depend on the" |
1675 |
+ ewarn "above-mentioned experimental PPC support in the linker. Be" |
1676 |
+ ewarn "sure to keep a known-to-work version like ${PN}-3.2.6 around!" |
1677 |
+ fi |
1678 |
+ fi |
1679 |
+ |
1680 |
+ cd "${S}"/${LD64}/src |
1681 |
+ cp "${S}"/ld64-136-compile_stubs.h ld/compile_stubs.h |
1682 |
+ cp "${S}"/ld64-264.3.101-Makefile Makefile |
1683 |
+ |
1684 |
+ epatch "${S}"/ld64-264.3.101-nolto.patch |
1685 |
+ epatch "${S}"/ld64-241.9-extraneous-includes.patch |
1686 |
+ epatch "${S}"/ld64-241.9-osatomic.patch |
1687 |
+ epatch "${S}"/ld64-236.3-crashreporter.patch |
1688 |
+ epatch "${S}"/ld64-264.3.101-nosnapshots.patch |
1689 |
+ epatch "${S}"/ld64-264.3.101-ppc.patch |
1690 |
+ epatch "${S}"/ld64-264.3.101-constant-types.patch |
1691 |
+ epatch "${S}"/ld64-241.9-register-names.patch |
1692 |
+ epatch "${S}"/ld64-241.9-get-comm-align.patch |
1693 |
+ epatch "${S}"/ld64-241.9-cc_md5.patch |
1694 |
+ |
1695 |
+ # provide missing headers from libunwind and dyld |
1696 |
+ mkdir -p include/{mach,mach-o/arm} || die |
1697 |
+ # never present because it's private |
1698 |
+ cp ../../${DYLD}/include/mach-o/dyld_priv.h include/mach-o || die |
1699 |
+ # missing on <= 10.5 |
1700 |
+ cp ../../${LIBUNWIND}/include/libunwind.h include/ || die |
1701 |
+ cp ../../${LIBUNWIND}/include/mach-o/compact_unwind_encoding.h include/mach-o || die |
1702 |
+ # missing on <= 10.4 |
1703 |
+ cp ../../${DYLD}/include/mach-o/dyld_images.h include/mach-o || die |
1704 |
+ cp ../../${CCTOOLS}/include/mach-o/loader.h include/mach-o || die |
1705 |
+ # use copies from cctools because they're otherwise hidden in some SDK |
1706 |
+ cp ../../${CCTOOLS}/include/mach-o/arm/reloc.h include/mach-o/arm || die |
1707 |
+ # provide all required CPU_TYPEs on all platforms |
1708 |
+ cp ../../${CCTOOLS}/include/mach/machine.h include/mach/machine.h |
1709 |
+ # add alias for newer identifiers, because ld64 uses both but cctools |
1710 |
+ # header only defines the older |
1711 |
+ epatch "${S}"/ld64-236.3-missing-cputypes.patch |
1712 |
+ |
1713 |
+ # mimic OS X Leopard-style Availability.h macros for libunwind.h on |
1714 |
+ # older systems |
1715 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] && \ |
1716 |
+ echo "#define __OSX_AVAILABLE_STARTING(x,y) " > include/Availability.h |
1717 |
+ |
1718 |
+ local VER_STR="\"@(#)PROGRAM:ld PROJECT:${LD64} (Gentoo ${PN}-${PVR})\\n\"" |
1719 |
+ echo "char ldVersionString[] = ${VER_STR};" > version.cpp |
1720 |
+ |
1721 |
+ epatch "${S}"/ld64-123.2-debug-backtrace.patch |
1722 |
+ if [[ ${CHOST} == powerpc*-darwin* ]] ; then |
1723 |
+ epatch "${S}"/ld64-123.2-darwin8-no-mlong-branch-warning.patch |
1724 |
+ epatch "${S}"/ld64-127.2-thread_state.patch |
1725 |
+ fi |
1726 |
+ |
1727 |
+ cd "${S}"/${CCTOOLS} |
1728 |
+ epatch "${S}"/${PN}-4.5-as.patch |
1729 |
+ epatch "${S}"/${PN}-5.1-as-dir.patch |
1730 |
+ epatch "${S}"/${PN}-5.1-ranlib.patch |
1731 |
+ epatch "${S}"/${PN}-3.1.1-libtool-ranlib.patch |
1732 |
+ epatch "${S}"/${PN}-3.1.1-no-headers.patch |
1733 |
+ epatch "${S}"/${PN}-4.0-no-oss-dir.patch |
1734 |
+ epatch "${S}"/cctools-839-intel-retf.patch |
1735 |
+ epatch "${S}"/${PN}-5.1-extraneous-includes.patch |
1736 |
+ #epatch "${S}"/${PN}-5.1-otool-stdc.patch |
1737 |
+ epatch "${S}"/${PN}-5.1-constant-types.patch |
1738 |
+ epatch "${S}"/${PN}-5.1-strnlen.patch |
1739 |
+ epatch "${S}"/${PN}-5.1-ppc.patch |
1740 |
+ epatch "${S}"/${PN}-5.1-thread-state-redefined.patch |
1741 |
+ epatch "${S}"/${PN}-7.3-make-j.patch |
1742 |
+ epatch "${S}"/${PN}-7.0-lto-prefix-2.patch |
1743 |
+ epatch "${S}"/${PN}-7.0-clang-as.patch |
1744 |
+ epatch "${S}"/${PN}-7.3-nolto.patch |
1745 |
+ epatch "${S}"/${PN}-7.3-nollvm.patch |
1746 |
+ epatch "${S}"/${PN}-7.3-no-developertools-dir.patch |
1747 |
+ cp ../${LD64}/src/other/prune_trie.h include/mach-o/ || die |
1748 |
+ |
1749 |
+ # do not build profileable libstuff to save compile time |
1750 |
+ sed -i -e "/^all:/s, profile , ," libstuff/Makefile |
1751 |
+ |
1752 |
+ # cctools version is provided to make via RC_ProjectSourceVersion which |
1753 |
+ # generates and compiles it as apple_version[] into libstuff. From |
1754 |
+ # there it's picked up by the individual tools. Since |
1755 |
+ # RC_ProjectSourceVersion is also used as library version, we can't |
1756 |
+ # just append our local version info. So we hack the libstuff Makefile |
1757 |
+ # to include our Gentoo version. |
1758 |
+ sed -i -e "/cctools-.*(RC_ProjectSourceVersion).*OFILE_DIR/s,Version),Version) (Gentoo ${PN}-${PVR})," \ |
1759 |
+ libstuff/Makefile |
1760 |
+ |
1761 |
+ # clean up test suite |
1762 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
1763 |
+ local c |
1764 |
+ |
1765 |
+ # we don't have llvm |
1766 |
+ ((++c)); rm -rf llvm-integration; |
1767 |
+ |
1768 |
+ # we don't have dtrace |
1769 |
+ ((++c)); rm -rf dtrace-static-probes-coalescing; |
1770 |
+ ((++c)); rm -rf dtrace-static-probes; |
1771 |
+ |
1772 |
+ # a file is missing |
1773 |
+ ((++c)); rm -rf eh-coalescing-r |
1774 |
+ |
1775 |
+ # we don't do universal binaries |
1776 |
+ ((++c)); rm -rf blank-stubs; |
1777 |
+ |
1778 |
+ # looks like a problem with apple's result-filter.pl |
1779 |
+ ((++c)); rm -rf implicit-common3; |
1780 |
+ ((++c)); rm -rf order_file-ans; |
1781 |
+ |
1782 |
+ # TODO no idea what goes wrong here |
1783 |
+ ((++c)); rm -rf dwarf-debug-notes; |
1784 |
+ |
1785 |
+ einfo "Deleted $c tests that were bound to fail" |
1786 |
+ |
1787 |
+ cd "${S}" |
1788 |
+ ebegin "cleaning Makefiles from unwanted CFLAGS" |
1789 |
+ find . -name "Makefile" -print0 | xargs -0 sed \ |
1790 |
+ -i \ |
1791 |
+ -e 's/ -g / /g' \ |
1792 |
+ -e 's/^G =.*$/G =/' \ |
1793 |
+ -e 's/^OFLAG =.*$/OFLAG =/' \ |
1794 |
+ -e 's/install -c -s/install/g' |
1795 |
+ eend $? |
1796 |
+} |
1797 |
+ |
1798 |
+src_configure() { |
1799 |
+ ENABLE_LTO=0 |
1800 |
+ use lto && ENABLE_LTO=1 |
1801 |
+ |
1802 |
+ # CPPFLAGS only affects ld64, cctools don't use 'em (which currently is |
1803 |
+ # what we want) |
1804 |
+ append-cppflags -DNDEBUG |
1805 |
+ |
1806 |
+ # Block API and thus snapshots supported on >= 10.6 |
1807 |
+ [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -ge 10 ]] && \ |
1808 |
+ append-cppflags -DSUPPORT_SNAPSHOTS |
1809 |
+ |
1810 |
+ CCTOOLS_OFLAG= |
1811 |
+ if [[ ${CHOST} == *darwin* && ${CHOST#*-darwin} -le 8 ]] ; then |
1812 |
+ # cctools expect to use UNIX03 struct member names. |
1813 |
+ # This is default on > 10.4. Activate it on <= 10.4 by defining |
1814 |
+ # __DARWIN_UNIX03 explicitly. |
1815 |
+ CCTOOLS_OFLAG="-D__DARWIN_UNIX03=1" |
1816 |
+ fi |
1817 |
+ |
1818 |
+ # if compiling with USE multitarget, extract all the known arches from |
1819 |
+ # create_configure and pass them back to it |
1820 |
+ creco=${LD64}/src/create_configure |
1821 |
+ ARCHS_TO_SUPPORT="" |
1822 |
+ if use multitarget ; then |
1823 |
+ ARCHS_TO_SUPPORT="$(grep KNOWN_ARCHS= $creco | \ |
1824 |
+ cut -d\" -f2 | tr ',' ' ')" |
1825 |
+ fi |
1826 |
+ |
1827 |
+ # Create configure.h for ld64 with SUPPORT_ARCH_<arch> defines in it. |
1828 |
+ DERIVED_FILE_DIR=${LD64}/src \ |
1829 |
+ RC_SUPPORTED_ARCHS="$ARCHS_TO_SUPPORT" \ |
1830 |
+ $creco |
1831 |
+ |
1832 |
+ # do not depend on MachOFileAbstraction.hpp to define |
1833 |
+ # SUPPORT_ARCH_arm_any because that's not included by every file where |
1834 |
+ # our ppc/arm-optional patch uses it, ld.hpp in particular |
1835 |
+ grep "SUPPORT_ARCH_armv[0-9]" ${LD64}/src/configure.h >/dev/null && \ |
1836 |
+ echo "#define SUPPORT_ARCH_arm_any 1" >> ${LD64}/src/configure.h |
1837 |
+} |
1838 |
+ |
1839 |
+compile_ld64() { |
1840 |
+ einfo "building ${LD64}" |
1841 |
+ cd "${S}"/${LD64}/src |
1842 |
+ emake \ |
1843 |
+ LTO=${ENABLE_LTO} \ |
1844 |
+ || die "emake failed for ld64" |
1845 |
+ use test && emake build_test |
1846 |
+} |
1847 |
+ |
1848 |
+compile_cctools() { |
1849 |
+ einfo "building ${CCTOOLS}" |
1850 |
+ cd "${S}"/${CCTOOLS} |
1851 |
+ # Suppress running dsymutil because it will warn about missing debug |
1852 |
+ # info which is expected when compiling without -g as we normally do. |
1853 |
+ # This might need some more thought if anyone ever wanted to build us |
1854 |
+ # for debugging with Apple's tools. |
1855 |
+ emake \ |
1856 |
+ LIB_PRUNETRIE="-L../../${LD64}/src -lprunetrie" \ |
1857 |
+ EFITOOLS= \ |
1858 |
+ LTO="${ENABLE_LTO}" \ |
1859 |
+ LTO_LIBDIR=../../../lib \ |
1860 |
+ COMMON_SUBDIRS='libstuff ar misc otool' \ |
1861 |
+ SUBDIRS_32= \ |
1862 |
+ LEGACY= \ |
1863 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1864 |
+ RC_CFLAGS="${CFLAGS}" \ |
1865 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1866 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1867 |
+ || die "emake failed for the cctools" |
1868 |
+ cd "${S}"/${CCTOOLS}/as |
1869 |
+ emake \ |
1870 |
+ BUILD_OBSOLETE_ARCH= \ |
1871 |
+ RC_ProjectSourceVersion=${CCTOOLS_VERSION} \ |
1872 |
+ RC_CFLAGS="-DASLIBEXECDIR=\"\\\"${EPREFIX}${LIBPATH}/\\\"\" -DCLANGDIR=\"\\\"${EPREFIX}/usr/bin/\\\"\" ${CFLAGS}" \ |
1873 |
+ OFLAG="${CCTOOLS_OFLAG}" \ |
1874 |
+ DSYMUTIL=": disabled: dsymutil" \ |
1875 |
+ || die "emake failed for as" |
1876 |
+} |
1877 |
+ |
1878 |
+src_compile() { |
1879 |
+ compile_ld64 |
1880 |
+ compile_cctools |
1881 |
+} |
1882 |
+ |
1883 |
+install_ld64() { |
1884 |
+ exeinto ${BINPATH} |
1885 |
+ doexe "${S}"/${LD64}/src/{ld64,rebase,dyldinfo,unwinddump,ObjectDump} |
1886 |
+ dosym ld64 ${BINPATH}/ld |
1887 |
+ insinto ${DATAPATH}/man/man1 |
1888 |
+ doins "${S}"/${LD64}/doc/man/man1/{ld,ld64,rebase}.1 |
1889 |
+} |
1890 |
+ |
1891 |
+install_cctools() { |
1892 |
+ cd "${S}"/${CCTOOLS} |
1893 |
+ emake install_all_but_headers \ |
1894 |
+ EFITOOLS= \ |
1895 |
+ COMMON_SUBDIRS='ar misc otool' \ |
1896 |
+ SUBDIRS_32= \ |
1897 |
+ DSTROOT=\"${D}\" \ |
1898 |
+ BINDIR=\"${EPREFIX}\"${BINPATH} \ |
1899 |
+ LOCBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1900 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1901 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1902 |
+ MANDIR=\"${EPREFIX}\"${DATAPATH}/man/ |
1903 |
+ cd "${S}"/${CCTOOLS}/as |
1904 |
+ emake install \ |
1905 |
+ BUILD_OBSOLETE_ARCH= \ |
1906 |
+ DSTROOT=\"${D}\" \ |
1907 |
+ USRBINDIR=\"${EPREFIX}\"${BINPATH} \ |
1908 |
+ LIBDIR=\"${EPREFIX}\"${LIBPATH} \ |
1909 |
+ LOCLIBDIR=\"${EPREFIX}\"${LIBPATH} |
1910 |
+ |
1911 |
+ # upstream is starting to replace classic binutils with llvm-integrated |
1912 |
+ # ones. nm and size are now symlinks to llvm-{nm,size} while the classic |
1913 |
+ # version is preserved as {nm,size}-classic. (BTW: otool is a symlink to |
1914 |
+ # otool-classic for now but a wrapper llvm-otool that is calling |
1915 |
+ # llvm-objdump is present already.) |
1916 |
+ # Since our binutils do not live in the same directory as the llvm |
1917 |
+ # installation, we have to rewrite the symlinks to the llvm tools. |
1918 |
+ # This also means, that these tools still appear to be versioned via |
1919 |
+ # binutils-config but actually always run the currently installed llvm |
1920 |
+ # tool. |
1921 |
+ for tool in nm size ; do |
1922 |
+ # ${EPREFIX}/usr/x86_64-apple-darwin15/binutils-bin/7.3/$tool |
1923 |
+ # -> ${EPREFIX}/bin/llvm-$tool |
1924 |
+ ln -sfn ../../../bin/llvm-$tool "${D}/${EPREFIX}/${BINPATH}/$tool" |
1925 |
+ done |
1926 |
+ |
1927 |
+ cd "${ED}"${BINPATH} |
1928 |
+ insinto ${DATAPATH}/man/man1 |
1929 |
+ local skips manpage |
1930 |
+ # ar brings an up-to-date manpage with it |
1931 |
+ skips=( ar ) |
1932 |
+ for bin in *; do |
1933 |
+ for skip in ${skips[@]}; do |
1934 |
+ if [[ ${bin} == ${skip} ]]; then |
1935 |
+ continue 2; |
1936 |
+ fi |
1937 |
+ done |
1938 |
+ manpage=${S}/${CCTOOLS}/man/${bin}.1 |
1939 |
+ if [[ -f "${manpage}" ]]; then |
1940 |
+ doins "${manpage}" |
1941 |
+ fi |
1942 |
+ done |
1943 |
+ insinto ${DATAPATH}/man/man5 |
1944 |
+ doins "${S}"/${CCTOOLS}/man/*.5 |
1945 |
+} |
1946 |
+ |
1947 |
+src_test() { |
1948 |
+ if ! [ "${EPREFIX}"/usr/bin/clang ] ; then |
1949 |
+ einfo "Test suite only works properly with clang - please install" |
1950 |
+ return |
1951 |
+ fi |
1952 |
+ |
1953 |
+ einfo "Running unit tests" |
1954 |
+ cd "${S}"/${LD64}/unit-tests/test-cases |
1955 |
+ # provide the new ld as a symlink to clang so that -ccc-install-dir |
1956 |
+ # will pick it up |
1957 |
+ ln -sfn ../../src/ld64 ld |
1958 |
+ # use our arch command because the System's will report i386 even for an |
1959 |
+ # x86_64 prefix |
1960 |
+ perl ../bin/make-recursive.pl \ |
1961 |
+ BUILT_PRODUCTS_DIR="${S}"/${LD64}/src \ |
1962 |
+ ARCH="$(arch)" \ |
1963 |
+ LD="${S}"/${LD64}/src/ld64 \ |
1964 |
+ CC="${CC} -ccc-install-dir $PWD" \ |
1965 |
+ CXX="${CXX} -ccc-install-dir $PWD" \ |
1966 |
+ OTOOL="${S}"/${CCTOOLS}/otool/otool.NEW \ |
1967 |
+ | perl ../bin/result-filter.pl |
1968 |
+} |
1969 |
+ |
1970 |
+src_install() { |
1971 |
+ install_ld64 |
1972 |
+ install_cctools |
1973 |
+ |
1974 |
+ cd "${S}" |
1975 |
+ insinto /etc/env.d/binutils |
1976 |
+ cat <<-EOF > env.d |
1977 |
+ TARGET="${CHOST}" |
1978 |
+ VER="${PV}" |
1979 |
+ FAKE_TARGETS="${CHOST}" |
1980 |
+ EOF |
1981 |
+ newins env.d ${CHOST}-${PV} |
1982 |
+} |
1983 |
+ |
1984 |
+pkg_postinst() { |
1985 |
+ binutils-config ${CHOST}-${PV} |
1986 |
+} |