summaryrefslogtreecommitdiff
path: root/dev-libs/klibc
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
committerV3n3RiX <venerix@redcorelinux.org>2018-07-14 21:03:06 +0100
commit8376ef56580626e9c0f796d5b85b53a0a1c7d5f5 (patch)
tree7681bbd4e8b05407772df40a4bf04cbbc8afc3fa /dev-libs/klibc
parent30a9caf154332f12ca60756e1b75d2f0e3e1822d (diff)
gentoo resync : 14.07.2018
Diffstat (limited to 'dev-libs/klibc')
-rw-r--r--dev-libs/klibc/Manifest12
-rw-r--r--dev-libs/klibc/files/klibc-1.4.11-interp-flags.patch13
-rw-r--r--dev-libs/klibc/files/klibc-1.5.7-strip-fix-dash-s.patch12
-rw-r--r--dev-libs/klibc/files/klibc-2.0.2-mkfifo.patch15
-rw-r--r--dev-libs/klibc/files/klibc-2.0.3-kernel-uapi.patch88
-rw-r--r--dev-libs/klibc/files/klibc.m494
-rw-r--r--dev-libs/klibc/klibc-2.0.4-r2.ebuild318
-rw-r--r--dev-libs/klibc/klibc-2.0.4-r3.ebuild319
-rw-r--r--dev-libs/klibc/metadata.xml5
9 files changed, 876 insertions, 0 deletions
diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest
new file mode 100644
index 000000000000..36461badb27b
--- /dev/null
+++ b/dev-libs/klibc/Manifest
@@ -0,0 +1,12 @@
+AUX klibc-1.4.11-interp-flags.patch 494 BLAKE2B 855857ee581560a01a07dbf78d6a7ed281a6e8b44522c365fcd5acc3af0c00bb754b161246e77de919d1559aa3f04498c29492efb3f13efabbd9b439814f263b SHA512 64242223dee668467b52092dba81a3ab29137d3611cf11f331aae1fa9eb8a3ae19b3847128bd693cd2c835c7e2ff1e247cae821561ca7c039bb4a212c8726a42
+AUX klibc-1.5.7-strip-fix-dash-s.patch 420 BLAKE2B 44ae1a131348421d17b855f6b83c1d7286b3fb6c543eaa9aceb133b4948df791bf77712baefc84f3595b1f24453264670fa6db461d90a161c723f3b0f158ea8d SHA512 c1c70c86d34ac1ea716fe5f2caeb3005db6d060ed0c5dabe94a44f0317725c7775a9da8e463b71b8533f0315d6e0cd861c8684ddf1f426586296dc69d88ac438
+AUX klibc-2.0.2-mkfifo.patch 488 BLAKE2B 71662521449be96fa059f2ea3bc3c371e8065a7d209b919ff142526deecce21317c7d952642b74572c452ee2cdfe967fe14668f7aaa60ebe311a14621d63dbdf SHA512 9e72e10eae1639da2821ac14767ae7f8df1b7dcb2f559a47d8e6ac7f6ffa865a13f93c9824b8051cc2d0d23cac2c228274cfc3dabfac060eb32275d2eca100ac
+AUX klibc-2.0.3-kernel-uapi.patch 4584 BLAKE2B cb8a9344eaed0ab8fe2d87934f64d6239cecb7ea66842fdebe469b779fc3ea5d4fa3c5f014acdc6cdff04bf7e74219251a310952cd4fdec416891ec05fa4a065 SHA512 c0ed840875da65a185915a9ba1df335ec05bebfbb30f6be1bdf97fd94e45fdbd63c34ee70abb18cf71039876b71929ffa42fca6767c2ed8326e24454763761c5
+AUX klibc.m4 3619 BLAKE2B b0895e5d775b2edc497514ce5adffa3824730cebd1b0c9f166a6ca84fed7880d5bfc13409835eb07d515307e5a83e2459665fa45987ee182619458f80b49defb SHA512 42cf4add07031105689d7438838e0306d32a637e8a4719afc11722fd8f1ac040e6bb92cc7ba3536b83a6de8907a91bc5ad11036f22810443f4cd24161950cc6b
+DIST klibc-2.0.4.tar.xz 469348 BLAKE2B 5975e3d25f72b70c4cbaa56ea5363417407e8dace1e02e2da0b835bbb2cad56648b0084e5404528206ef3facf4ffd3611e8bd729eadd80b00e30d1a70b3057cf SHA512 7a01d1744b49f3de64111fefc522b1d63f054199acf671254bc046d6f1d0b6ca68e050c99025bf8303751c2466a5e034677555649ae5909c40997858d393db8d
+DIST klibc_2.0.4-9.debian.tar.xz 28628 BLAKE2B aaad6fafb7372152987eebda5951b9f3de2e33da583e0ea7597f666461977f461303566f9e363e9c96994c7b0eb6213c6a17b2fab72df7460db3cfbc0c2e1cf8 SHA512 0fe9a6642be962fa631919850d7eeed5a87c10682766ee10fe31dec2b19a6179e0067602acb26bdc2aa8ceecfd39b1dc95a76f3b0a9bc813b172c0ffe9f0ff53
+DIST linux-4.14.tar.xz 100770500 BLAKE2B 85dc4aa953fe65e273a24473d8de98e4f204f97c43be9fc87cf5be01f796f94cfde5c8f9c84619751f1cac51f83ce0b4681fb19c5f2965a72d4a94fe5577846a SHA512 77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8
+DIST linux-4.4.tar.xz 87295988 BLAKE2B f260f1858994f5d481fd078c86e51bddbc958f7c5d1586f60dced772e1b1107ecf3aae0558c3e6f39c36f7d3aa1e6cd1e5c64ec9d6f2218f47b98413da6466fb SHA512 13c8459933a8b80608e226a1398e3d1848352ace84bcfb7e6a4a33cb230bbe1ab719d4b58e067283df91ce5311be6d2d595fc8c19e2ae6ecc652499415614b3e
+EBUILD klibc-2.0.4-r2.ebuild 9409 BLAKE2B ac24b2f2d5e02dc5f380821980bf54df969a622e8d69ccbc4e56e21ed7ad17591771a7c20ead1a3f8558697e6859d2808c47e04867e0f16a524991f363f1883c SHA512 5afdef79995ef8ce6e4cc1e5bb87fc1d9f5af4ccc33b646a3c27c86b9d2b281e258f521a713c67a4f8da7772a6e7172544eade8e8c82d66b893f405ed9d60371
+EBUILD klibc-2.0.4-r3.ebuild 9500 BLAKE2B 14170140e1cf7c59d1665cae4e2f11aa23e4664fd46b4527dd0c3c09ef2ce434595fae9881b3f4fcc6d072c69e1b2c5f1704c7016c2e3e2ba0012894f343d6a6 SHA512 eea7a3ee293015f7f2bc063f1dd204db3b19a410e6ea11b20e7b545daaf187326c9ca9c9ca9b9a47d20da14109f3d3e2436715bc73710c13901b962e57142730
+MISC metadata.xml 166 BLAKE2B c254f1fb642881aba57637be14fb0a89b10384f91a128feaec3a8c870d76efc2cbacb92caccc0dee2dd19a5ac5eaf8643080dafa05c4e2ac96a68568927e5afd SHA512 a56648c974a1d14dd4c18237532773c72057a13ab90c58b5da04f185e3c12a8bd8d5c21fb06053507f31766291a82dc7d87b34cd65fd94cfe2af7295c813ef84
diff --git a/dev-libs/klibc/files/klibc-1.4.11-interp-flags.patch b/dev-libs/klibc/files/klibc-1.4.11-interp-flags.patch
new file mode 100644
index 000000000000..a5bb91765287
--- /dev/null
+++ b/dev-libs/klibc/files/klibc-1.4.11-interp-flags.patch
@@ -0,0 +1,13 @@
+diff --git a/usr/klibc/Kbuild b/usr/klibc/Kbuild
+index c2bfd2f..8066bda 100644
+--- a/usr/klibc/Kbuild
++++ b/usr/klibc/Kbuild
+@@ -152,7 +152,7 @@ # build interp.o
+ targets += interp.o
+
+ quiet_cmd_interp = BUILD $@
+- cmd_interp = $(KLIBCCC) $(klibccflags) -D__ASSEMBLY__ \
++ cmd_interp = $(KLIBCCC) $(klibccflags) $(EXTRA_KLIBCAFLAGS) -D__ASSEMBLY__ \
+ -DLIBDIR=\"$(SHLIBDIR)\" \
+ -DSOHASH=\"$(SOLIBHASH)\" \
+ -c -o $@ $<
diff --git a/dev-libs/klibc/files/klibc-1.5.7-strip-fix-dash-s.patch b/dev-libs/klibc/files/klibc-1.5.7-strip-fix-dash-s.patch
new file mode 100644
index 000000000000..94a0caee2526
--- /dev/null
+++ b/dev-libs/klibc/files/klibc-1.5.7-strip-fix-dash-s.patch
@@ -0,0 +1,12 @@
+diff -Naurp klibc-1.5.7-orig/klcc/klcc.in klibc-1.5.7/klcc/klcc.in
+--- klibc-1.5.7-orig/klcc/klcc.in 2007-12-03 01:17:26.000000000 +0100
++++ klibc-1.5.7/klcc/klcc.in 2007-12-03 01:18:39.000000000 +0100
+@@ -259,7 +259,7 @@ if ( $operation ne '' ) {
+ unlink(@rmobjs);
+
+ if ( $strip && !$rv ) {
+- $rv = mysystem($STRIP, @STRIPFLAGS, $output);
++ $rv = mysystem($STRIP, @STRIPFLAGS, $output || 'a.out');
+ }
+ }
+
diff --git a/dev-libs/klibc/files/klibc-2.0.2-mkfifo.patch b/dev-libs/klibc/files/klibc-2.0.2-mkfifo.patch
new file mode 100644
index 000000000000..3ddf834d46da
--- /dev/null
+++ b/dev-libs/klibc/files/klibc-2.0.2-mkfifo.patch
@@ -0,0 +1,15 @@
+diff -Nuar --exclude '*.g' --exclude '*.cmd' klibc-2.0.2-r1/work/klibc-2.0.2/usr/utils/mkfifo.c klibc-2.0.2.orig/work/klibc-2.0.2/usr/utils/mkfifo.c
+--- a/usr/utils/mkfifo.c 2012-10-03 09:41:43.000000000 -0700
++++ b/usr/utils/mkfifo.c 2013-12-26 13:19:34.270949780 -0800
+@@ -13,6 +13,11 @@
+
+ char *progname;
+
++int mkfifo (const char *__p, mode_t __m)
++{
++ return mknod(__p, (__m & ~S_IFMT) | S_IFIFO, (dev_t) 0);
++}
++
+ static int make_fifo(char *dir)
+ {
+ if (mkfifo(dir, leaf_mode)) {
diff --git a/dev-libs/klibc/files/klibc-2.0.3-kernel-uapi.patch b/dev-libs/klibc/files/klibc-2.0.3-kernel-uapi.patch
new file mode 100644
index 000000000000..7d253977e998
--- /dev/null
+++ b/dev-libs/klibc/files/klibc-2.0.3-kernel-uapi.patch
@@ -0,0 +1,88 @@
+Update header locations for uapi & generated
+
+In the v3.6 kernel, many of the headers were split out into a uapi variant.
+klibc should be using those variants to compile.
+
+There is also a generated subdir, to seperate out generated headers.
+
+The old kernel header location needs to be included as well, because
+linux/compiler.h is available only in the base include directory.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar klibc-2.0.3.orig/scripts/Kbuild.klibc klibc-2.0.3/scripts/Kbuild.klibc
+--- klibc-2.0.3.orig/scripts/Kbuild.klibc 2013-12-03 10:53:46.000000000 -0800
++++ klibc-2.0.3/scripts/Kbuild.klibc 2013-12-26 14:39:07.113906101 -0800
+@@ -77,7 +77,10 @@
+ KLIBCCFLAGS :=
+
+ # Defaults for arch to override
+-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include
++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/generated/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include/generated \
++ -I$(KLIBCKERNELOBJ)/arch/$(KLIBCARCH)/include
+
+ # Arch specific definitions for klibc
+ include $(srctree)/$(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG
+@@ -116,6 +119,9 @@
+-KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include \
++KLIBCCPPFLAGS += -I$(KLIBCKERNELSRC)/include/uapi \
++ -I$(KLIBCKERNELSRC)/include/generated/uapi \
++ -I$(KLIBCKERNELSRC)/include/generated \
++ -I$(KLIBCKERNELSRC)/include \
+ $(if $(KBUILD_SRC),-I$(KLIBCKERNELOBJ)/include2 \
+ -I$(KLIBCKERNELOBJ)/include -I$(srctree)/include) \
+ $(KLIBCARCHINCFLAGS)
+
+ # klibc definitions
+diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/i386/MCONFIG klibc-2.0.3/usr/klibc/arch/i386/MCONFIG
+--- klibc-2.0.3.orig/usr/klibc/arch/i386/MCONFIG 2013-12-03 10:53:46.000000000 -0800
++++ klibc-2.0.3/usr/klibc/arch/i386/MCONFIG 2013-12-26 14:44:56.349161344 -0800
+@@ -34,3 +34,6 @@
+
+ # Asm includes for i386 are in the merged x86 tree
+-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include
++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include
+diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/ppc/MCONFIG klibc-2.0.3/usr/klibc/arch/ppc/MCONFIG
+--- klibc-2.0.3.orig/usr/klibc/arch/ppc/MCONFIG 2013-12-03 10:53:46.000000000 -0800
++++ klibc-2.0.3/usr/klibc/arch/ppc/MCONFIG 2013-12-26 14:44:56.350161362 -0800
+@@ -24,6 +24,9 @@
+
+ # The kernel so far has both asm-ppc* and asm-powerpc.
+-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include
++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include
+
+ # The asm include files live in asm-powerpc
+ KLIBCASMARCH = powerpc
+diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/ppc64/MCONFIG klibc-2.0.3/usr/klibc/arch/ppc64/MCONFIG
+--- klibc-2.0.3.orig/usr/klibc/arch/ppc64/MCONFIG 2013-12-03 10:53:46.000000000 -0800
++++ klibc-2.0.3/usr/klibc/arch/ppc64/MCONFIG 2013-12-26 14:44:56.350161362 -0800
+@@ -22,6 +22,9 @@
+
+ # The kernel so far has both asm-ppc* and asm-powerpc.
+-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include
++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/powerpc/include/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include/generated \
++ -I$(KLIBCKERNELOBJ)/arch/powerpc/include
+
+ # The asm include files live in asm-powerpc
+ KLIBCASMARCH = powerpc
+diff -Nuar klibc-2.0.3.orig/usr/klibc/arch/x86_64/MCONFIG klibc-2.0.3/usr/klibc/arch/x86_64/MCONFIG
+--- klibc-2.0.3.orig/usr/klibc/arch/x86_64/MCONFIG 2013-12-03 10:53:46.000000000 -0800
++++ klibc-2.0.3/usr/klibc/arch/x86_64/MCONFIG 2013-12-26 14:44:54.522128579 -0800
+@@ -37,3 +37,6 @@
+
+ # Asm includes for x86_64 are in the merged x86 tree
+-KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include
++KLIBCARCHINCFLAGS = -I$(KLIBCKERNELOBJ)/arch/x86/include/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated/uapi \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include/generated \
++ -I$(KLIBCKERNELOBJ)/arch/x86/include
diff --git a/dev-libs/klibc/files/klibc.m4 b/dev-libs/klibc/files/klibc.m4
new file mode 100644
index 000000000000..389226974506
--- /dev/null
+++ b/dev-libs/klibc/files/klibc.m4
@@ -0,0 +1,94 @@
+# klibc.m4 serial 99
+## Copyright (C) 1995-2003 Free Software Foundation, Inc.
+## This file is free software, distributed under the terms of the GNU
+## General Public License. As a special exception to the GNU General
+## Public License, this file may be distributed as part of a program
+## that contains a configuration script generated by Autoconf, under
+## the same distribution terms as the rest of that program.
+##
+## This file can can be used in projects which are not available under
+## the GNU General Public License or the GNU Library General Public
+## License but which still want to provide support for the GNU gettext
+## functionality.
+## Please note that the actual code of the KLIBC Library is partly covered
+## by the GNU Library General Public License, and party copyrighted by the
+## Regents of The University of California, and the rest is covered by a
+## MIT style license.
+
+# Authors:
+# Martin Schlemmer <azarah@nosferatu.za.org>, 2005.
+
+
+# AC_CHECK_KLIBC
+# --------------
+# Check if the user wants KLIBC support enabled. If so, set KLIBC=yes and
+# fill in KLIBC_PREFIX, KLIBC_BINDIR, KLIBC_SBINDIR, KLIBC_LIBDIR and
+# KLIBC_INCLUDEDIR. CC is also set to the proper klcc executable.
+# NOTE: This should be called before AC_PROG_CC, and before header, function
+# or type checks.
+AC_DEFUN([AC_CHECK_KLIBC],
+[AC_BEFORE([$0], [AC_PROG_CC])
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_ARG_ENABLE([klibc],
+ [AS_HELP_STRING([--enable-klibc],
+ [Enable linking to klibc [no]. You need at
+ least klibc-1.0 or later for this. Set KLCC
+ to the absolute file name of klcc if not in
+ the PATH])],
+ [KLIBC=$enableval], [KLIBC=no])
+AC_ARG_ENABLE([klibc-layout],
+ [AS_HELP_STRING([--enable-klibc-layout],
+ [Enable installing binaries, libraries and
+ headers into the klibc prefix [yes] ])],
+ [if test "X$KLIBC" != Xno; then
+ KLIBC_LAYOUT=$enableval
+ else
+ KLIBC_LAYOUT=no
+ fi],
+ [if test "X$KLIBC" != Xno; then
+ KLIBC_LAYOUT=yes
+ else
+ KLIBC_LAYOUT=no
+ fi])
+
+if test "X$KLIBC" != Xno; then
+ # Basic cross compiling support. I do not think it is wise to use
+ # AC_CHECK_TOOL, because if we are cross compiling, we do not want
+ # just 'klcc' to be returned ...
+ if test "${host_alias}" != "${build_alias}"; then
+ AC_CHECK_PROGS([KLCC], [${host_alias}-klcc], [no])
+ else
+ AC_CHECK_PROGS([KLCC], [klcc], [no])
+ fi
+ if test "X$KLCC" = Xno; then
+ AC_MSG_ERROR([cannot find klibc frontend 'klcc'!])
+ fi
+
+ CC="$KLCC"
+ CFLAGS="-Os"
+
+ KLIBC_KCROSS="$($KLCC -print-klibc-kcross 2>/dev/null)"
+ KLIBC_PREFIX="$($KLCC -print-klibc-prefix 2>/dev/null)"
+ KLIBC_BIN_DIR="$($KLCC -print-klibc-bindir 2>/dev/null)"
+ KLIBC_SBIN_DIR="${KLIBC_PREFIX}/${KLIBC_KCROSS}sbin"
+ KLIBC_LIB_DIR="$($KLCC -print-klibc-libdir 2>/dev/null)"
+ KLIBC_INCLUDE_DIR="$($KLCC -print-klibc-includedir 2>/dev/null)"
+
+ if test "X$KLIBC_LAYOUT" != Xno; then
+ prefix="$KLIBC_PREFIX"
+ bindir="$KLIBC_BIN_DIR"
+ sbindir="$KLIBC_SBIN_DIR"
+ libdir="$KLIBC_LIB_DIR"
+ includedir="$KLIBC_INCLUDE_DIR"
+ fi
+
+ # At least KLIBC_LIB_DIR should be valid, else klibc is too old or
+ # something went wrong
+ if test ! -d "$KLIBC_LIB_DIR"; then
+ AC_MSG_ERROR([your klibc installation is too old or not functional!])
+ fi
+fi
+
+AC_SUBST(KLIBC)
+])# AC_CHECK_KLIBC
+
diff --git a/dev-libs/klibc/klibc-2.0.4-r2.ebuild b/dev-libs/klibc/klibc-2.0.4-r2.ebuild
new file mode 100644
index 000000000000..f9435d7ad819
--- /dev/null
+++ b/dev-libs/klibc/klibc-2.0.4-r2.ebuild
@@ -0,0 +1,318 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Robin H. Johnson <robbat2@gentoo.org>, 12 Nov 2007:
+# This still needs major work.
+# But it is significently better than the previous version.
+# In that it will now build on biarch systems, such as ppc64-32ul.
+
+# NOTES:
+# ======
+# We need to bring in the kernel sources seperately
+# Because they have to be configured in a way that differs from the copy in
+# /usr/src/. The sys-kernel/linux-headers are too stripped down to use
+# unfortunately.
+# This will be able to go away once the klibc author updates his code
+# to build again the headers provided by the kernel's 'headers_install' target.
+
+EAPI=6
+K_TARBALL_SUFFIX="xz"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="A minimal libc subset for use with initramfs"
+HOMEPAGE="https://www.zytor.com/mailman/listinfo/klibc/ https://www.kernel.org/pub/linux/libs/klibc/"
+KV_MAJOR="4" KV_MINOR="x" KV_SUB="4"
+PKV_EXTRA=""
+if [[ ${PKV_EXTRA} ]]; then
+ if [[ ${KV_MAJOR} == 2 ]]; then
+ PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-${PKV_EXTRA}"
+ else
+ PKV="${KV_MAJOR}.$((${KV_SUB}+1))-${PKV_EXTRA}"
+ fi
+ PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.${K_TARBALL_SUFFIX}"
+fi
+if [[ ${KV_MAJOR} == 2 ]]; then
+ OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}"
+else
+ OKV="${KV_MAJOR}.${KV_SUB}"
+fi
+KERNEL_URI="
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.${K_TARBALL_SUFFIX}
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.${K_TARBALL_SUFFIX}"
+DEBIAN_PV=2.0.4
+DEBIAN_PR=9
+DEBIAN_A="${PN}_${DEBIAN_PV}-${DEBIAN_PR}.debian.tar.xz"
+SRC_URI="
+ mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX}
+ mirror://debian/pool/main/k/klibc/${DEBIAN_A}
+ ${PATCH_URI}
+ ${KERNEL_URI}"
+
+LICENSE="|| ( GPL-2 LGPL-2 )"
+KEYWORDS="~alpha amd64 ~arm ia64 -mips ~ppc ~ppc64 ~sparc x86"
+SLOT="0"
+IUSE="debug test custom-cflags"
+
+RDEPEND="dev-lang/perl"
+DEPEND="${RDEPEND}
+ sys-devel/bc"
+
+KS="${WORKDIR}/linux-${OKV}"
+
+# Klibc has no PT_GNU_STACK support, so scanning for execstacks is moot
+QA_EXECSTACK="*"
+# Do not strip
+RESTRICT="strip"
+
+kernel_asm_arch() {
+ a="${1:${ARCH}}"
+ case ${a} in
+ # Merged arches
+ x86) echo i386 ;; # for build on x86 userspace & 64bit kernel
+ amd64) echo x86 ;;
+ ppc*) echo powerpc ;;
+ # Non-merged
+ alpha|arm|arm64|ia64|m68k|mips|sh|sparc*) echo ${1} ;;
+ *) die "TODO: Update the code for your asm-ARCH symlink" ;;
+ esac
+}
+
+# For a given Gentoo ARCH,
+# specify the kernel defconfig most relevant
+kernel_defconfig() {
+ a="${1:${ARCH}}"
+ # most, but not all arches have a sanely named defconfig
+ case ${a} in
+ ppc64) echo ppc64_defconfig ;;
+ ppc) echo pmac32_defconfig ;;
+ sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;;
+ *) echo defconfig ;;
+ esac
+}
+
+src_unpack() {
+ unpack linux-${OKV}.tar.${K_TARBALL_SUFFIX} ${P}.tar.${K_TARBALL_SUFFIX} ${DEBIAN_A}
+}
+
+PATCHES=(
+ # Build interp.o with EXTRA_KLIBCAFLAGS (.S source)
+ "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch
+ # Fix usage of -s, bug #201006
+ "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch
+ # The inline definition from sys/stat.h does not seem to get used
+ # So just copy it to make this compile for now
+ "${FILESDIR}"/klibc-2.0.2-mkfifo.patch
+ # Newer kernels have some headers in the uapi dir
+ "${FILESDIR}"/klibc-2.0.3-kernel-uapi.patch
+)
+
+src_prepare() {
+ [[ ${PKV} ]] && eapply "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX}
+
+ # Symlink /usr/src/linux to ${S}/linux
+ ln -snf "${KS}" linux
+ #ln -snf "/usr" linux
+
+ # Borrow the debian fixes too
+ for p in $(<"${WORKDIR}"/debian/patches/series) ; do
+ PATCHES+=( "${WORKDIR}/debian/patches/${p}" )
+ done
+
+ default
+}
+
+# klibc has it's own ideas of arches
+# They reflect userspace strictly.
+# This functions maps from a Gentoo ARCH, to an arch that klibc expects
+# Look at klibc-${S}/usr/klibc/arch for a list of these arches
+klibc_arch() {
+ a="${1:${ARCH}}"
+ case ${a} in
+ amd64) echo x86_64;;
+ mips) die 'TODO: Use the $ABI' ;;
+ x86) echo i386;;
+ *) echo ${a} ;;
+ esac
+}
+
+src_compile() {
+ local myargs="all"
+ local myARCH="${ARCH}" myABI="${ABI}"
+ # TODO: For cross-compiling
+ # You should set ARCH and ABI here
+ CC="$(tc-getCC)"
+ LD="$(tc-getLD)"
+ HOSTCC="$(tc-getBUILD_CC)"
+ HOSTLD="$(tc-getBUILD_LD)"
+ KLIBCARCH="$(klibc_arch ${ARCH})"
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
+ libdir="$(get_libdir)"
+ # This should be the defconfig corresponding to your userspace!
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
+ defconfig=$(kernel_defconfig ${ARCH})
+ unset ABI ARCH # Unset these, because they interfere
+ unset KBUILD_OUTPUT # we are using a private copy
+
+ cd "${KS}"
+ emake ${defconfig} CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "No defconfig"
+ if [[ "${KLIBCARCH/arm}" != "${KLIBCARCH}" ]] && \
+ [[ "${CHOST/eabi}" != "${CHOST}" ]]; then
+ # The delete and insert are seperate statements
+ # so that they are reliably used.
+ sed -i \
+ -e '/CONFIG_AEABI/d' \
+ -e '1iCONFIG_AEABI=y' \
+ -e '/CONFIG_OABI_COMPAT/d' \
+ -e '1iCONFIG_OABI_COMPAT=y' \
+ -e '1iCONFIG_ARM_UNWIND=y' \
+ "${KS}"/.config \
+ "${S}"/defconfig
+ fi
+ emake prepare CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "Failed to prepare kernel sources for header usage"
+
+ cd "${S}"
+
+ use debug && myargs="${myargs} V=1"
+ use test && myargs="${myargs} test"
+ append-ldflags -z noexecstack
+ append-flags -nostdlib
+
+ emake \
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \
+ HOSTLDFLAGS="-z noexecstack" \
+ KLIBCOPTFLAGS='-nostdlib' \
+ HOSTCC="${HOSTCC}" CC="${CC}" \
+ HOSTLD="${HOSTLD}" LD="${LD}" \
+ INSTALLDIR="/usr/${libdir}/klibc" \
+ KLIBCARCH=${KLIBCARCH} \
+ KLIBCASMARCH=${KLIBCASMARCH} \
+ SHLIBDIR="/${libdir}" \
+ libdir="/usr/${libdir}" \
+ mandir="/usr/share/man" \
+ T="${T}" \
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \
+ ${myargs} || die "Compile failed!"
+
+ #SHLIBDIR="/${libdir}" \
+
+ ARCH="${myARCH}" ABI="${myABI}"
+}
+
+src_install() {
+ local myargs
+ local myARCH="${ARCH}" myABI="${ABI}"
+ # TODO: For cross-compiling
+ # You should set ARCH and ABI here
+ CC="$(tc-getCC)"
+ HOSTCC="$(tc-getBUILD_CC)"
+ KLIBCARCH="$(klibc_arch ${ARCH})"
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
+ libdir="$(get_libdir)"
+ # This should be the defconfig corresponding to your userspace!
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
+ defconfig=$(kernel_defconfig ${ARCH})
+
+ use debug && myargs="${myargs} V=1"
+
+ local klibc_prefix
+ if tc-is-cross-compiler ; then
+ klibc_prefix=$("${S}/klcc/${KLIBCARCH}-klcc" -print-klibc-prefix)
+ else
+ klibc_prefix=$("${S}/klcc/klcc" -print-klibc-prefix)
+ fi
+
+ unset ABI ARCH # Unset these, because they interfere
+ unset KBUILD_OUTPUT # we are using a private copy
+
+ emake \
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \
+ HOSTLDFLAGS="-z noexecstack" \
+ KLIBCOPTFLAGS='-nostdlib' \
+ HOSTCC="${HOSTCC}" CC="${CC}" \
+ HOSTLD="${HOSTLD}" LD="${LD}" \
+ INSTALLDIR="/usr/${libdir}/klibc" \
+ INSTALLROOT="${D}" \
+ KLIBCARCH=${KLIBCARCH} \
+ KLIBCASMARCH=${KLIBCASMARCH} \
+ SHLIBDIR="/${libdir}" \
+ libdir="/usr/${libdir}" \
+ mandir="/usr/share/man" \
+ T="${T}" \
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \
+ ${myargs} \
+ install || die "Install failed!"
+
+ #SHLIBDIR="/${libdir}" \
+
+ # klibc doesn't support prelinking, so we need to mask it
+ cat > "${T}/70klibc" <<-EOF
+ PRELINK_PATH_MASK="/usr/${libdir}/klibc"
+ EOF
+
+ doenvd "${T}"/70klibc
+
+ # Fix the permissions (bug #178053) on /usr/${libdir}/klibc/include
+ # Actually I have no idea, why the includes have those weird-ass permissions
+ # on a particular system, might be due to inherited permissions from parent
+ # directory
+ # NOTE: This totally violates sandbox <asturm@gentoo.org>
+ # find "${D}"/usr/${libdir}/klibc/include | xargs chmod o+rX
+ find "${D}"/usr/${libdir}/klibc/include -type f \
+ \( -name '.install' -o -name '..install.cmd' \) -delete || die
+
+ # Hardlinks becoming copies
+ for x in gunzip zcat ; do
+ rm -f "${D}/${klibc_prefix}/bin/${x}"
+ dosym gzip "${klibc_prefix}/bin/${x}"
+ done
+
+ # Restore now, so we can use the tc- functions
+ ARCH="${myARCH}" ABI="${myABI}"
+ if ! tc-is-cross-compiler ; then
+ cd "${S}"
+ insinto /usr/share/aclocal
+ doins contrib/klibc.m4
+
+ dodoc README usr/klibc/CAVEATS
+ docinto gzip; dodoc usr/gzip/README
+ fi
+
+ # Fix up the symlink
+ # Mainly for merged arches
+ linkname="${D}/usr/${libdir}/klibc/include/asm"
+ if [ -L "${linkname}" ] && [ ! -e "${linkname}" ] ; then
+ ln -snf asm-${KLIBCASMARCH} "${linkname}"
+ fi
+}
+
+src_test() {
+ if ! tc-is-cross-compiler ; then
+ cd "${S}"/usr/klibc/tests
+ ALL_TESTS="$(ls *.c |sed 's,\.c$,,g')"
+ BROKEN_TESTS="fcntl fnmatch testrand48"
+ failed=0
+ for t in $ALL_TESTS ; do
+ if has $t $BROKEN_TESTS ; then
+ echo "=== $t SKIP"
+ else
+ echo -n "=== $t "
+ ./$t </dev/null >/dev/null
+ rc=$?
+ if [ $rc -eq 0 ]; then
+ echo PASS
+ else
+ echo FAIL
+ failed=1
+ fi
+ fi
+ done
+ [ $failed -ne 0 ] && die "Some tests failed."
+ fi
+}
diff --git a/dev-libs/klibc/klibc-2.0.4-r3.ebuild b/dev-libs/klibc/klibc-2.0.4-r3.ebuild
new file mode 100644
index 000000000000..9e4d06a4c598
--- /dev/null
+++ b/dev-libs/klibc/klibc-2.0.4-r3.ebuild
@@ -0,0 +1,319 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# Robin H. Johnson <robbat2@gentoo.org>, 12 Nov 2007:
+# This still needs major work.
+# But it is significently better than the previous version.
+# In that it will now build on biarch systems, such as ppc64-32ul.
+
+# NOTES:
+# ======
+# We need to bring in the kernel sources seperately
+# Because they have to be configured in a way that differs from the copy in
+# /usr/src/. The sys-kernel/linux-headers are too stripped down to use
+# unfortunately.
+# This will be able to go away once the klibc author updates his code
+# to build again the headers provided by the kernel's 'headers_install' target.
+
+EAPI=6
+K_TARBALL_SUFFIX="xz"
+
+inherit eutils toolchain-funcs flag-o-matic
+
+DESCRIPTION="A minimal libc subset for use with initramfs"
+HOMEPAGE="https://www.zytor.com/mailman/listinfo/klibc/ https://www.kernel.org/pub/linux/libs/klibc/"
+KV_MAJOR="4" KV_MINOR="x" KV_SUB="14"
+PKV_EXTRA=""
+if [[ ${PKV_EXTRA} ]]; then
+ if [[ ${KV_MAJOR} == 2 ]]; then
+ PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-${PKV_EXTRA}"
+ else
+ PKV="${KV_MAJOR}.$((${KV_SUB}+1))-${PKV_EXTRA}"
+ fi
+ PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.${K_TARBALL_SUFFIX}"
+fi
+if [[ ${KV_MAJOR} == 2 ]]; then
+ OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}"
+else
+ OKV="${KV_MAJOR}.${KV_SUB}"
+fi
+KERNEL_URI="
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.${K_TARBALL_SUFFIX}
+ mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.${K_TARBALL_SUFFIX}"
+DEBIAN_PV=2.0.4
+DEBIAN_PR=9
+DEBIAN_A="${PN}_${DEBIAN_PV}-${DEBIAN_PR}.debian.tar.xz"
+SRC_URI="
+ mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX}
+ mirror://debian/pool/main/k/klibc/${DEBIAN_A}
+ ${PATCH_URI}
+ ${KERNEL_URI}"
+
+LICENSE="|| ( GPL-2 LGPL-2 )"
+KEYWORDS="~alpha amd64 ~arm ia64 -mips ~ppc ~ppc64 ~sparc x86"
+SLOT="0"
+IUSE="debug test custom-cflags"
+
+RDEPEND="dev-lang/perl"
+DEPEND="${RDEPEND}
+ sys-devel/bc"
+
+KS="${WORKDIR}/linux-${OKV}"
+
+# Klibc has no PT_GNU_STACK support, so scanning for execstacks is moot
+QA_EXECSTACK="*"
+# Do not strip
+RESTRICT="strip"
+
+kernel_asm_arch() {
+ a="${1:${ARCH}}"
+ case ${a} in
+ # Merged arches
+ x86) echo i386 ;; # for build on x86 userspace & 64bit kernel
+ amd64) echo x86 ;;
+ ppc*) echo powerpc ;;
+ # Non-merged
+ alpha|arm|arm64|ia64|m68k|mips|sh|sparc*) echo ${1} ;;
+ *) die "TODO: Update the code for your asm-ARCH symlink" ;;
+ esac
+}
+
+# For a given Gentoo ARCH,
+# specify the kernel defconfig most relevant
+kernel_defconfig() {
+ a="${1:${ARCH}}"
+ # most, but not all arches have a sanely named defconfig
+ case ${a} in
+ ppc64) echo ppc64_defconfig ;;
+ ppc) echo pmac32_defconfig ;;
+ sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;;
+ *) echo defconfig ;;
+ esac
+}
+
+src_unpack() {
+ unpack linux-${OKV}.tar.${K_TARBALL_SUFFIX} ${P}.tar.${K_TARBALL_SUFFIX} ${DEBIAN_A}
+}
+
+PATCHES=(
+ # Build interp.o with EXTRA_KLIBCAFLAGS (.S source)
+ "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch
+ # Fix usage of -s, bug #201006
+ "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch
+ # The inline definition from sys/stat.h does not seem to get used
+ # So just copy it to make this compile for now
+ "${FILESDIR}"/klibc-2.0.2-mkfifo.patch
+ # Newer kernels have some headers in the uapi dir
+ "${FILESDIR}"/klibc-2.0.3-kernel-uapi.patch
+)
+
+src_prepare() {
+ [[ ${PKV} ]] && eapply "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX}
+
+ # Symlink /usr/src/linux to ${S}/linux
+ ln -snf "${KS}" linux
+ #ln -snf "/usr" linux
+
+ # Borrow the debian fixes too
+ for p in $(<"${WORKDIR}"/debian/patches/series) ; do
+ PATCHES+=( "${WORKDIR}/debian/patches/${p}" )
+ done
+
+ default
+}
+
+# klibc has it's own ideas of arches
+# They reflect userspace strictly.
+# This functions maps from a Gentoo ARCH, to an arch that klibc expects
+# Look at klibc-${S}/usr/klibc/arch for a list of these arches
+klibc_arch() {
+ a="${1:${ARCH}}"
+ case ${a} in
+ amd64) echo x86_64;;
+ mips) die 'TODO: Use the $ABI' ;;
+ x86) echo i386;;
+ *) echo ${a} ;;
+ esac
+}
+
+src_compile() {
+ local myargs="all"
+ local myARCH="${ARCH}" myABI="${ABI}"
+ # TODO: For cross-compiling
+ # You should set ARCH and ABI here
+ CC="$(tc-getCC)"
+ LD="$(tc-getLD)"
+ HOSTCC="$(tc-getBUILD_CC)"
+ HOSTLD="$(tc-getBUILD_LD)"
+ KLIBCARCH="$(klibc_arch ${ARCH})"
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
+ libdir="$(get_libdir)"
+ # This should be the defconfig corresponding to your userspace!
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
+ defconfig=$(kernel_defconfig ${ARCH})
+ unset ABI ARCH # Unset these, because they interfere
+ unset KBUILD_OUTPUT # we are using a private copy
+
+ cd "${KS}"
+ emake ${defconfig} CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "No defconfig"
+ if [[ "${KLIBCARCH/arm}" != "${KLIBCARCH}" ]] && \
+ [[ "${CHOST/eabi}" != "${CHOST}" ]]; then
+ # The delete and insert are seperate statements
+ # so that they are reliably used.
+ sed -i \
+ -e '/CONFIG_AEABI/d' \
+ -e '1iCONFIG_AEABI=y' \
+ -e '/CONFIG_OABI_COMPAT/d' \
+ -e '1iCONFIG_OABI_COMPAT=y' \
+ -e '1iCONFIG_ARM_UNWIND=y' \
+ "${KS}"/.config \
+ "${S}"/defconfig
+ fi
+ emake prepare CC="${CC}" HOSTCC="${HOSTCC}" ARCH="${KLIBCASMARCH}" || die "Failed to prepare kernel sources for header usage"
+
+ cd "${S}"
+
+ use debug && myargs="${myargs} V=1"
+ use test && myargs="${myargs} test"
+ append-ldflags -z noexecstack
+ append-flags -nostdlib
+
+ # Parallel build intermittantly fails when doing `LIST usr/klibc/syscalls/klib.list'
+ emake -j1 \
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \
+ HOSTLDFLAGS="-z noexecstack" \
+ KLIBCOPTFLAGS='-nostdlib' \
+ HOSTCC="${HOSTCC}" CC="${CC}" \
+ HOSTLD="${HOSTLD}" LD="${LD}" \
+ INSTALLDIR="/usr/${libdir}/klibc" \
+ KLIBCARCH=${KLIBCARCH} \
+ KLIBCASMARCH=${KLIBCASMARCH} \
+ SHLIBDIR="/${libdir}" \
+ libdir="/usr/${libdir}" \
+ mandir="/usr/share/man" \
+ T="${T}" \
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \
+ ${myargs} || die "Compile failed!"
+
+ #SHLIBDIR="/${libdir}" \
+
+ ARCH="${myARCH}" ABI="${myABI}"
+}
+
+src_install() {
+ local myargs
+ local myARCH="${ARCH}" myABI="${ABI}"
+ # TODO: For cross-compiling
+ # You should set ARCH and ABI here
+ CC="$(tc-getCC)"
+ HOSTCC="$(tc-getBUILD_CC)"
+ KLIBCARCH="$(klibc_arch ${ARCH})"
+ KLIBCASMARCH="$(kernel_asm_arch ${ARCH})"
+ libdir="$(get_libdir)"
+ # This should be the defconfig corresponding to your userspace!
+ # NOT your kernel. PPC64-32ul would choose 'ppc' for example.
+ defconfig=$(kernel_defconfig ${ARCH})
+
+ use debug && myargs="${myargs} V=1"
+
+ local klibc_prefix
+ if tc-is-cross-compiler ; then
+ klibc_prefix=$("${S}/klcc/${KLIBCARCH}-klcc" -print-klibc-prefix)
+ else
+ klibc_prefix=$("${S}/klcc/klcc" -print-klibc-prefix)
+ fi
+
+ unset ABI ARCH # Unset these, because they interfere
+ unset KBUILD_OUTPUT # we are using a private copy
+
+ emake \
+ EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \
+ EXTRA_KLIBCLDFLAGS="-z noexecstack" \
+ HOSTLDFLAGS="-z noexecstack" \
+ KLIBCOPTFLAGS='-nostdlib' \
+ HOSTCC="${HOSTCC}" CC="${CC}" \
+ HOSTLD="${HOSTLD}" LD="${LD}" \
+ INSTALLDIR="/usr/${libdir}/klibc" \
+ INSTALLROOT="${D}" \
+ KLIBCARCH=${KLIBCARCH} \
+ KLIBCASMARCH=${KLIBCASMARCH} \
+ SHLIBDIR="/${libdir}" \
+ libdir="/usr/${libdir}" \
+ mandir="/usr/share/man" \
+ T="${T}" \
+ $(use custom-cflags || echo SKIP_)HOSTCFLAGS="${CFLAGS}" \
+ $(use custom-cflags || echo SKIP_)HOSTLDFLAGS="${LDFLAGS}" \
+ $(use custom-cflags || echo SKIP_)KLIBCOPTFLAGS="${CFLAGS}" \
+ ${myargs} \
+ install || die "Install failed!"
+
+ #SHLIBDIR="/${libdir}" \
+
+ # klibc doesn't support prelinking, so we need to mask it
+ cat > "${T}/70klibc" <<-EOF
+ PRELINK_PATH_MASK="/usr/${libdir}/klibc"
+ EOF
+
+ doenvd "${T}"/70klibc
+
+ # Fix the permissions (bug #178053) on /usr/${libdir}/klibc/include
+ # Actually I have no idea, why the includes have those weird-ass permissions
+ # on a particular system, might be due to inherited permissions from parent
+ # directory
+ # NOTE: This totally violates sandbox <asturm@gentoo.org>
+ # find "${D}"/usr/${libdir}/klibc/include | xargs chmod o+rX
+ find "${D}"/usr/${libdir}/klibc/include -type f \
+ \( -name '.install' -o -name '..install.cmd' \) -delete || die
+
+ # Hardlinks becoming copies
+ for x in gunzip zcat ; do
+ rm -f "${D}/${klibc_prefix}/bin/${x}"
+ dosym gzip "${klibc_prefix}/bin/${x}"
+ done
+
+ # Restore now, so we can use the tc- functions
+ ARCH="${myARCH}" ABI="${myABI}"
+ if ! tc-is-cross-compiler ; then
+ cd "${S}"
+ insinto /usr/share/aclocal
+ doins contrib/klibc.m4
+
+ dodoc README usr/klibc/CAVEATS
+ docinto gzip; dodoc usr/gzip/README
+ fi
+
+ # Fix up the symlink
+ # Mainly for merged arches
+ linkname="${D}/usr/${libdir}/klibc/include/asm"
+ if [ -L "${linkname}" ] && [ ! -e "${linkname}" ] ; then
+ ln -snf asm-${KLIBCASMARCH} "${linkname}"
+ fi
+}
+
+src_test() {
+ if ! tc-is-cross-compiler ; then
+ cd "${S}"/usr/klibc/tests
+ ALL_TESTS="$(ls *.c |sed 's,\.c$,,g')"
+ BROKEN_TESTS="fcntl fnmatch testrand48"
+ failed=0
+ for t in $ALL_TESTS ; do
+ if has $t $BROKEN_TESTS ; then
+ echo "=== $t SKIP"
+ else
+ echo -n "=== $t "
+ ./$t </dev/null >/dev/null
+ rc=$?
+ if [ $rc -eq 0 ]; then
+ echo PASS
+ else
+ echo FAIL
+ failed=1
+ fi
+ fi
+ done
+ [ $failed -ne 0 ] && die "Some tests failed."
+ fi
+}
diff --git a/dev-libs/klibc/metadata.xml b/dev-libs/klibc/metadata.xml
new file mode 100644
index 000000000000..6f49eba8f496
--- /dev/null
+++ b/dev-libs/klibc/metadata.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<!-- maintainer-needed -->
+</pkgmetadata>