1 |
commit: 2753a68af8707031ce6c2a368784f7533d8cd5cd |
2 |
Author: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Feb 25 12:50:52 2018 +0000 |
4 |
Commit: Patrick Lauer <patrick <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Feb 25 12:52:58 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2753a68a |
7 |
|
8 |
dev-libs/klibc: Bump KV, #621848 |
9 |
|
10 |
Package-Manager: Portage-2.3.24, Repoman-2.3.6 |
11 |
|
12 |
dev-libs/klibc/Manifest | 1 + |
13 |
dev-libs/klibc/klibc-2.0.4-r3.ebuild | 318 +++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 319 insertions(+) |
15 |
|
16 |
diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest |
17 |
index 5b833d7cec0..10df3d3198b 100644 |
18 |
--- a/dev-libs/klibc/Manifest |
19 |
+++ b/dev-libs/klibc/Manifest |
20 |
@@ -1,3 +1,4 @@ |
21 |
DIST klibc-2.0.4.tar.xz 469348 BLAKE2B 5975e3d25f72b70c4cbaa56ea5363417407e8dace1e02e2da0b835bbb2cad56648b0084e5404528206ef3facf4ffd3611e8bd729eadd80b00e30d1a70b3057cf SHA512 7a01d1744b49f3de64111fefc522b1d63f054199acf671254bc046d6f1d0b6ca68e050c99025bf8303751c2466a5e034677555649ae5909c40997858d393db8d |
22 |
DIST klibc_2.0.4-9.debian.tar.xz 28628 BLAKE2B aaad6fafb7372152987eebda5951b9f3de2e33da583e0ea7597f666461977f461303566f9e363e9c96994c7b0eb6213c6a17b2fab72df7460db3cfbc0c2e1cf8 SHA512 0fe9a6642be962fa631919850d7eeed5a87c10682766ee10fe31dec2b19a6179e0067602acb26bdc2aa8ceecfd39b1dc95a76f3b0a9bc813b172c0ffe9f0ff53 |
23 |
+DIST linux-4.14.tar.xz 100770500 BLAKE2B 85dc4aa953fe65e273a24473d8de98e4f204f97c43be9fc87cf5be01f796f94cfde5c8f9c84619751f1cac51f83ce0b4681fb19c5f2965a72d4a94fe5577846a SHA512 77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8 |
24 |
DIST linux-4.4.tar.xz 87295988 BLAKE2B f260f1858994f5d481fd078c86e51bddbc958f7c5d1586f60dced772e1b1107ecf3aae0558c3e6f39c36f7d3aa1e6cd1e5c64ec9d6f2218f47b98413da6466fb SHA512 13c8459933a8b80608e226a1398e3d1848352ace84bcfb7e6a4a33cb230bbe1ab719d4b58e067283df91ce5311be6d2d595fc8c19e2ae6ecc652499415614b3e |
25 |
|
26 |
diff --git a/dev-libs/klibc/klibc-2.0.4-r3.ebuild b/dev-libs/klibc/klibc-2.0.4-r3.ebuild |
27 |
new file mode 100644 |
28 |
index 00000000000..8e334dc61ba |
29 |
--- /dev/null |
30 |
+++ b/dev-libs/klibc/klibc-2.0.4-r3.ebuild |
31 |
@@ -0,0 +1,318 @@ |
32 |
+# Copyright 1999-2018 Gentoo Foundation |
33 |
+# Distributed under the terms of the GNU General Public License v2 |
34 |
+ |
35 |
+# Robin H. Johnson <robbat2@g.o>, 12 Nov 2007: |
36 |
+# This still needs major work. |
37 |
+# But it is significently better than the previous version. |
38 |
+# In that it will now build on biarch systems, such as ppc64-32ul. |
39 |
+ |
40 |
+# NOTES: |
41 |
+# ====== |
42 |
+# We need to bring in the kernel sources seperately |
43 |
+# Because they have to be configured in a way that differs from the copy in |
44 |
+# /usr/src/. The sys-kernel/linux-headers are too stripped down to use |
45 |
+# unfortunately. |
46 |
+# This will be able to go away once the klibc author updates his code |
47 |
+# to build again the headers provided by the kernel's 'headers_install' target. |
48 |
+ |
49 |
+EAPI=6 |
50 |
+K_TARBALL_SUFFIX="xz" |
51 |
+ |
52 |
+inherit eutils toolchain-funcs flag-o-matic |
53 |
+ |
54 |
+DESCRIPTION="A minimal libc subset for use with initramfs" |
55 |
+HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc/ https://www.kernel.org/pub/linux/libs/klibc/" |
56 |
+KV_MAJOR="4" KV_MINOR="x" KV_SUB="14" |
57 |
+PKV_EXTRA="" |
58 |
+if [[ ${PKV_EXTRA} ]]; then |
59 |
+ if [[ ${KV_MAJOR} == 2 ]]; then |
60 |
+ PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-${PKV_EXTRA}" |
61 |
+ else |
62 |
+ PKV="${KV_MAJOR}.$((${KV_SUB}+1))-${PKV_EXTRA}" |
63 |
+ fi |
64 |
+ PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.${K_TARBALL_SUFFIX}" |
65 |
+fi |
66 |
+if [[ ${KV_MAJOR} == 2 ]]; then |
67 |
+ OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}" |
68 |
+else |
69 |
+ OKV="${KV_MAJOR}.${KV_SUB}" |
70 |
+fi |
71 |
+KERNEL_URI=" |
72 |
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.${K_TARBALL_SUFFIX} |
73 |
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.${K_TARBALL_SUFFIX}" |
74 |
+DEBIAN_PV=2.0.4 |
75 |
+DEBIAN_PR=9 |
76 |
+DEBIAN_A="${PN}_${DEBIAN_PV}-${DEBIAN_PR}.debian.tar.xz" |
77 |
+SRC_URI=" |
78 |
+ mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX} |
79 |
+ mirror://debian/pool/main/k/klibc/${DEBIAN_A} |
80 |
+ ${PATCH_URI} |
81 |
+ ${KERNEL_URI}" |
82 |
+ |
83 |
+LICENSE="|| ( GPL-2 LGPL-2 )" |
84 |
+KEYWORDS="~alpha ~amd64 ~arm ~ia64 -mips ~ppc ~ppc64 ~sparc ~x86" |
85 |
+SLOT="0" |
86 |
+IUSE="debug test custom-cflags" |
87 |
+ |
88 |
+RDEPEND="dev-lang/perl" |
89 |
+DEPEND="${RDEPEND} |
90 |
+ sys-devel/bc" |
91 |
+ |
92 |
+KS="${WORKDIR}/linux-${OKV}" |
93 |
+ |
94 |
+# Klibc has no PT_GNU_STACK support, so scanning for execstacks is moot |
95 |
+QA_EXECSTACK="*" |
96 |
+# Do not strip |
97 |
+RESTRICT="strip" |
98 |
+ |
99 |
+kernel_asm_arch() { |
100 |
+ a="${1:${ARCH}}" |
101 |
+ case ${a} in |
102 |
+ # Merged arches |
103 |
+ x86) echo i386 ;; # for build on x86 userspace & 64bit kernel |
104 |
+ amd64) echo x86 ;; |
105 |
+ ppc*) echo powerpc ;; |
106 |
+ # Non-merged |
107 |
+ alpha|arm|arm64|ia64|m68k|mips|sh|sparc*) echo ${1} ;; |
108 |
+ *) die "TODO: Update the code for your asm-ARCH symlink" ;; |
109 |
+ esac |
110 |
+} |
111 |
+ |
112 |
+# For a given Gentoo ARCH, |
113 |
+# specify the kernel defconfig most relevant |
114 |
+kernel_defconfig() { |
115 |
+ a="${1:${ARCH}}" |
116 |
+ # most, but not all arches have a sanely named defconfig |
117 |
+ case ${a} in |
118 |
+ ppc64) echo ppc64_defconfig ;; |
119 |
+ ppc) echo pmac32_defconfig ;; |
120 |
+ sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;; |
121 |
+ *) echo defconfig ;; |
122 |
+ esac |
123 |
+} |
124 |
+ |
125 |
+src_unpack() { |
126 |
+ unpack linux-${OKV}.tar.${K_TARBALL_SUFFIX} ${P}.tar.${K_TARBALL_SUFFIX} ${DEBIAN_A} |
127 |
+} |
128 |
+ |
129 |
+PATCHES=( |
130 |
+ # Build interp.o with EXTRA_KLIBCAFLAGS (.S source) |
131 |
+ "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch |
132 |
+ # Fix usage of -s, bug #201006 |
133 |
+ "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch |
134 |
+ # The inline definition from sys/stat.h does not seem to get used |
135 |
+ # So just copy it to make this compile for now |
136 |
+ "${FILESDIR}"/klibc-2.0.2-mkfifo.patch |
137 |
+ # Newer kernels have some headers in the uapi dir |
138 |
+ "${FILESDIR}"/klibc-2.0.3-kernel-uapi.patch |
139 |
+) |
140 |
+ |
141 |
+src_prepare() { |
142 |
+ [[ ${PKV} ]] && eapply "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX} |
143 |
+ |
144 |
+ # Symlink /usr/src/linux to ${S}/linux |
145 |
+ ln -snf "${KS}" linux |
146 |
+ #ln -snf "/usr" linux |
147 |
+ |
148 |
+ # Borrow the debian fixes too |
149 |
+ for p in $(<"${WORKDIR}"/debian/patches/series) ; do |
150 |
+ PATCHES+=( "${WORKDIR}/debian/patches/${p}" ) |
151 |
+ done |
152 |
+ |
153 |
+ default |
154 |
+} |
155 |
+ |
156 |
+# klibc has it's own ideas of arches |
157 |
+# They reflect userspace strictly. |
158 |
+# This functions maps from a Gentoo ARCH, to an arch that klibc expects |
159 |
+# Look at klibc-${S}/usr/klibc/arch for a list of these arches |
160 |
+klibc_arch() { |
161 |
+ a="${1:${ARCH}}" |
162 |
+ case ${a} in |
163 |
+ amd64) echo x86_64;; |
164 |
+ mips) die 'TODO: Use the $ABI' ;; |
165 |
+ x86) echo i386;; |
166 |
+ *) echo ${a} ;; |
167 |
+ esac |
168 |
+} |
169 |
+ |
170 |
+src_compile() { |
171 |
+ local myargs="all" |
172 |
+ local myARCH="${ARCH}" myABI="${ABI}" |
173 |
+ # TODO: For cross-compiling |
174 |
+ # You should set ARCH and ABI here |
175 |
+ CC="$(tc-getCC)" |
176 |
+ LD="$(tc-getLD)" |
177 |
+ HOSTCC="$(tc-getBUILD_CC)" |
178 |
+ HOSTLD="$(tc-getBUILD_LD)" |
179 |
+ KLIBCARCH="$(klibc_arch ${ARCH})" |
180 |
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})" |
181 |
+ libdir="$(get_libdir)" |
182 |
+ # This should be the defconfig corresponding to your userspace! |
183 |
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example. |
184 |
+ defconfig=$(kernel_defconfig ${ARCH}) |
185 |
+ unset ABI ARCH # Unset these, because they interfere |
186 |
+ unset KBUILD_OUTPUT # we are using a private copy |
187 |
+ |
188 |
+ cd "${KS}" |
189 |
+ emake ${defconfig} CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "No defconfig" |
190 |
+ if [[ "${KLIBCARCH/arm}" != "${KLIBCARCH}" ]] && \ |
191 |
+ [[ "${CHOST/eabi}" != "${CHOST}" ]]; then |
192 |
+ # The delete and insert are seperate statements |
193 |
+ # so that they are reliably used. |
194 |
+ sed -i \ |
195 |
+ -e '/CONFIG_AEABI/d' \ |
196 |
+ -e '1iCONFIG_AEABI=y' \ |
197 |
+ -e '/CONFIG_OABI_COMPAT/d' \ |
198 |
+ -e '1iCONFIG_OABI_COMPAT=y' \ |
199 |
+ -e '1iCONFIG_ARM_UNWIND=y' \ |
200 |
+ "${KS}"/.config \ |
201 |
+ "${S}"/defconfig |
202 |
+ fi |
203 |
+ emake prepare CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "Failed to prepare kernel sources for header usage" |
204 |
+ |
205 |
+ cd "${S}" |
206 |
+ |
207 |
+ use debug && myargs="${myargs} V=1" |
208 |
+ use test && myargs="${myargs} test" |
209 |
+ append-ldflags -z noexecstack |
210 |
+ append-flags -nostdlib |
211 |
+ |
212 |
+ emake \ |
213 |
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ |
214 |
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \ |
215 |
+ HOSTLDFLAGS="-z noexecstack" \ |
216 |
+ KLIBCOPTFLAGS='-nostdlib' \ |
217 |
+ HOSTCC="${HOSTCC}" CC="${CC}" \ |
218 |
+ HOSTLD="${HOSTLD}" LD="${LD}" \ |
219 |
+ INSTALLDIR="/usr/${libdir}/klibc" \ |
220 |
+ KLIBCARCH=${KLIBCARCH} \ |
221 |
+ KLIBCASMARCH=${KLIBCASMARCH} \ |
222 |
+ SHLIBDIR="/${libdir}" \ |
223 |
+ libdir="/usr/${libdir}" \ |
224 |
+ mandir="/usr/share/man" \ |
225 |
+ T="${T}" \ |
226 |
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \ |
227 |
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \ |
228 |
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \ |
229 |
+ ${myargs} || die "Compile failed!" |
230 |
+ |
231 |
+ #SHLIBDIR="/${libdir}" \ |
232 |
+ |
233 |
+ ARCH="${myARCH}" ABI="${myABI}" |
234 |
+} |
235 |
+ |
236 |
+src_install() { |
237 |
+ local myargs |
238 |
+ local myARCH="${ARCH}" myABI="${ABI}" |
239 |
+ # TODO: For cross-compiling |
240 |
+ # You should set ARCH and ABI here |
241 |
+ CC="$(tc-getCC)" |
242 |
+ HOSTCC="$(tc-getBUILD_CC)" |
243 |
+ KLIBCARCH="$(klibc_arch ${ARCH})" |
244 |
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})" |
245 |
+ libdir="$(get_libdir)" |
246 |
+ # This should be the defconfig corresponding to your userspace! |
247 |
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example. |
248 |
+ defconfig=$(kernel_defconfig ${ARCH}) |
249 |
+ |
250 |
+ use debug && myargs="${myargs} V=1" |
251 |
+ |
252 |
+ local klibc_prefix |
253 |
+ if tc-is-cross-compiler ; then |
254 |
+ klibc_prefix=$("${S}/klcc/${KLIBCARCH}-klcc" -print-klibc-prefix) |
255 |
+ else |
256 |
+ klibc_prefix=$("${S}/klcc/klcc" -print-klibc-prefix) |
257 |
+ fi |
258 |
+ |
259 |
+ unset ABI ARCH # Unset these, because they interfere |
260 |
+ unset KBUILD_OUTPUT # we are using a private copy |
261 |
+ |
262 |
+ emake \ |
263 |
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ |
264 |
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \ |
265 |
+ HOSTLDFLAGS="-z noexecstack" \ |
266 |
+ KLIBCOPTFLAGS='-nostdlib' \ |
267 |
+ HOSTCC="${HOSTCC}" CC="${CC}" \ |
268 |
+ HOSTLD="${HOSTLD}" LD="${LD}" \ |
269 |
+ INSTALLDIR="/usr/${libdir}/klibc" \ |
270 |
+ INSTALLROOT="${D}" \ |
271 |
+ KLIBCARCH=${KLIBCARCH} \ |
272 |
+ KLIBCASMARCH=${KLIBCASMARCH} \ |
273 |
+ SHLIBDIR="/${libdir}" \ |
274 |
+ libdir="/usr/${libdir}" \ |
275 |
+ mandir="/usr/share/man" \ |
276 |
+ T="${T}" \ |
277 |
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \ |
278 |
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \ |
279 |
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \ |
280 |
+ ${myargs} \ |
281 |
+ install || die "Install failed!" |
282 |
+ |
283 |
+ #SHLIBDIR="/${libdir}" \ |
284 |
+ |
285 |
+ # klibc doesn't support prelinking, so we need to mask it |
286 |
+ cat > "${T}/70klibc" <<-EOF |
287 |
+ PRELINK_PATH_MASK="/usr/${libdir}/klibc" |
288 |
+ EOF |
289 |
+ |
290 |
+ doenvd "${T}"/70klibc |
291 |
+ |
292 |
+ # Fix the permissions (bug #178053) on /usr/${libdir}/klibc/include |
293 |
+ # Actually I have no idea, why the includes have those weird-ass permissions |
294 |
+ # on a particular system, might be due to inherited permissions from parent |
295 |
+ # directory |
296 |
+ # NOTE: This totally violates sandbox <asturm@g.o> |
297 |
+ # find "${D}"/usr/${libdir}/klibc/include | xargs chmod o+rX |
298 |
+ find "${D}"/usr/${libdir}/klibc/include -type f \ |
299 |
+ \( -name '.install' -o -name '..install.cmd' \) -delete || die |
300 |
+ |
301 |
+ # Hardlinks becoming copies |
302 |
+ for x in gunzip zcat ; do |
303 |
+ rm -f "${D}/${klibc_prefix}/bin/${x}" |
304 |
+ dosym gzip "${klibc_prefix}/bin/${x}" |
305 |
+ done |
306 |
+ |
307 |
+ # Restore now, so we can use the tc- functions |
308 |
+ ARCH="${myARCH}" ABI="${myABI}" |
309 |
+ if ! tc-is-cross-compiler ; then |
310 |
+ cd "${S}" |
311 |
+ insinto /usr/share/aclocal |
312 |
+ doins contrib/klibc.m4 |
313 |
+ |
314 |
+ dodoc README usr/klibc/CAVEATS |
315 |
+ docinto gzip; dodoc usr/gzip/README |
316 |
+ fi |
317 |
+ |
318 |
+ # Fix up the symlink |
319 |
+ # Mainly for merged arches |
320 |
+ linkname="${D}/usr/${libdir}/klibc/include/asm" |
321 |
+ if [ -L "${linkname}" ] && [ ! -e "${linkname}" ] ; then |
322 |
+ ln -snf asm-${KLIBCASMARCH} "${linkname}" |
323 |
+ fi |
324 |
+} |
325 |
+ |
326 |
+src_test() { |
327 |
+ if ! tc-is-cross-compiler ; then |
328 |
+ cd "${S}"/usr/klibc/tests |
329 |
+ ALL_TESTS="$(ls *.c |sed 's,\.c$,,g')" |
330 |
+ BROKEN_TESTS="fcntl fnmatch testrand48" |
331 |
+ failed=0 |
332 |
+ for t in $ALL_TESTS ; do |
333 |
+ if has $t $BROKEN_TESTS ; then |
334 |
+ echo "=== $t SKIP" |
335 |
+ else |
336 |
+ echo -n "=== $t " |
337 |
+ ./$t </dev/null >/dev/null |
338 |
+ rc=$? |
339 |
+ if [ $rc -eq 0 ]; then |
340 |
+ echo PASS |
341 |
+ else |
342 |
+ echo FAIL |
343 |
+ failed=1 |
344 |
+ fi |
345 |
+ fi |
346 |
+ done |
347 |
+ [ $failed -ne 0 ] && die "Some tests failed." |
348 |
+ fi |
349 |
+} |