diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-26 23:15:57 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-26 23:15:57 +0000 |
commit | 9dc2748c3fb2cdeb5865ebabac12e0cccb265ec5 (patch) | |
tree | c65075c30e5311464f3c66943d0295517c292a03 /dev-libs/klibc | |
parent | Remove vulnerable version, bug #492688 (diff) | |
download | historical-9dc2748c3fb2cdeb5865ebabac12e0cccb265ec5.tar.gz historical-9dc2748c3fb2cdeb5865ebabac12e0cccb265ec5.tar.bz2 historical-9dc2748c3fb2cdeb5865ebabac12e0cccb265ec5.zip |
Make it possible to build klibc with much newer kernels.
Package-Manager: portage-2.2.7/cvs/Linux x86_64
Diffstat (limited to 'dev-libs/klibc')
-rw-r--r-- | dev-libs/klibc/ChangeLog | 8 | ||||
-rw-r--r-- | dev-libs/klibc/Manifest | 6 | ||||
-rw-r--r-- | dev-libs/klibc/files/klibc-2.0.3-kernel-uapi.patch | 88 | ||||
-rw-r--r-- | dev-libs/klibc/klibc-2.0.3-r1.ebuild | 316 |
4 files changed, 416 insertions, 2 deletions
diff --git a/dev-libs/klibc/ChangeLog b/dev-libs/klibc/ChangeLog index ac225e939bd8..7b99dce72f9b 100644 --- a/dev-libs/klibc/ChangeLog +++ b/dev-libs/klibc/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-libs/klibc # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.97 2013/12/26 21:52:39 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.98 2013/12/26 23:15:50 robbat2 Exp $ + +*klibc-2.0.3-r1 (26 Dec 2013) + + 26 Dec 2013; Robin H. Johnson <robbat2@gentoo.org> + +files/klibc-2.0.3-kernel-uapi.patch, +klibc-2.0.3-r1.ebuild: + Make it possible to build klibc with much newer kernels. *klibc-2.0.3 (26 Dec 2013) diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest index f01ce1acd9b2..485c607eee3a 100644 --- a/dev-libs/klibc/Manifest +++ b/dev-libs/klibc/Manifest @@ -9,15 +9,19 @@ AUX klibc-1.5.20-parallel-make.patch 813 SHA256 0350a1bfbbf5b71ba79f2ceda94ea9c7 AUX klibc-1.5.23-parallel-make.patch 759 SHA256 4934bff9ec96bef18e1177485c50b70c886fc33a0d527a27feeaa717e25fd70f SHA512 effe06ac0e7e3fba04d4efb75f307e0ba125ea4ab4f28f3a19d4be5714a587a5dd4f80108c4207b40fbfd69b99bb8d3ffc78dd75a4e2bc998cfa1a6b10121d18 WHIRLPOOL 171c240d384a63085259f651e8e061ea4d7f205bb5b0808434d0f64c9687139d2f2e060f5fd5233b4129236e00e645e9f7bfd61cd4bfedcbf8f91480d332a60d AUX klibc-1.5.7-strip-fix-dash-s.patch 420 SHA256 971cadc28aa362ff76ebfee8187bb6986afb4f3425b70b7200d1aa1c6fd746e7 SHA512 c1c70c86d34ac1ea716fe5f2caeb3005db6d060ed0c5dabe94a44f0317725c7775a9da8e463b71b8533f0315d6e0cd861c8684ddf1f426586296dc69d88ac438 WHIRLPOOL 38622e4a1a00cd418f39e5b23e90f83486c0c6d3421fc3b900a039739294552ab5f080de8f17c17c39efc0038451ba0345d3f3ffebbe77fb3f63d111873881de AUX klibc-2.0.2-mkfifo.patch 550 SHA256 982328f70450bb313ef25c4d54e10fa8752beb0442cbe69f6028f7ac46dee85d SHA512 078284b7c683b2cb1753d954955ecd9bc990712752b99c13f5bd433739621879a0da83d73ed8e4491cf4c07c93bf7eb132b7d39d55e98ea39be5f4fa383859df WHIRLPOOL 24def1262596812813b9016de119708098506a87bec587fac8bf49bf1f5cbf8b8bfc87da8a8d7d7db2112ace088bd5b7e05097a7bf9fee5afecc49d71cccbb63 +AUX klibc-2.0.3-kernel-uapi.patch 4584 SHA256 bd36198544896ec1af275f4d7a79940ffb4bb862b513371b83397aca5d09f14e SHA512 c0ed840875da65a185915a9ba1df335ec05bebfbb30f6be1bdf97fd94e45fdbd63c34ee70abb18cf71039876b71929ffa42fca6767c2ed8326e24454763761c5 WHIRLPOOL e6e25bc01da75157c18510105a9295dd7bbacdb69081e594bff586da2b2859d34460fa87a037075753ed301d6fcc556301abeaaee954451c61d870c1a20a7962 AUX klibc.m4 3619 SHA256 02901ef2ca8b320d77b03fab4fa9bef809c11e2e418e7da00aa2c13c4a84dd44 SHA512 42cf4add07031105689d7438838e0306d32a637e8a4719afc11722fd8f1ac040e6bb92cc7ba3536b83a6de8907a91bc5ad11036f22810443f4cd24161950cc6b WHIRLPOOL 798f1af18939edb2c48aacf34cf4ef107468eeb47679d2695350c873bf19121ecdecb797b3a825675bee32b04f057211b2402b2a86d138a203c14f699da45c28 DIST klibc-1.5.25.tar.bz2 510064 SHA256 0b910ec0b2a97d4c775ed06e44ad7bca7be150efdf2a77a19253a573e16367d3 SHA512 e550afb319cd995fb9c7fb086bc8ede550e5e4a48856ff5856e2296f691ba643c9fcc314c5e973f4d5b4f33b543ef4bc10d29b389f83e5418ec860a80e7cac45 WHIRLPOOL d986dcdcc95e2c7846d2eda9338519d5d84f50e94f82f1eee0234a17504ae10abaa75b6c89e9cf4c228690c0cc489d4323d98e5e62cde10cf7a04581026309f3 DIST klibc-2.0.2.tar.xz 466696 SHA256 1e9d4ba6fe2aeea0bd27d14a9a674c29fb7cf766ff021e9c5f99256cb409474e SHA512 14c862ac58da37db98b40cc03a216643a4d2c424ea1b988f6ea274c999515c6661f711adcf5aac8ed10c7668e05004b8844b0a862c2f32fa28c240dd37003722 WHIRLPOOL 6fea496b32e08e8fd0c54b60997da70db2d6216a8f4a2c6d56ce83485f41c82cce291344ecffac0a38cfa88308033fe768e9b50d2102d803f7b8ff18412100a0 DIST klibc-2.0.3.tar.xz 468920 SHA256 02035f2b230020de569d40605485121e0fe481ed33a93bdb8bf8c6ee2695fffa SHA512 47a27496d8fa7c57279f9215367369dc9bae496f04b023a2e506813efca7db5de766ddcdb227804123a2fff7f6691dbf01cfaaed3396ce149e6b091f356fa233 WHIRLPOOL bba62fc57372053fdf78dac234f5210ce196723a27499da0fbcf4de05d06eee3ad1963ee5919680c3dcea3941c597a035e7110ad87545585b7430abb6d0d4c6b +DIST klibc_2.0.2-1.debian.tar.gz 21305 SHA256 93f4b9be5a3c725a38b7ac137850311e3cf8d8094874006c7dce793d2b71e469 SHA512 9cbcc39396a49bc37ace79eaefad6e704ddc9f30aba1b39f40dd2888dad06eeeb7b9c1a387cee60a95cf5641f50bd7f225cf8209547c75a8bae8af4285152d91 WHIRLPOOL a42e148550a27426e8f38b54cb4f3b1f355759d573ab27c0ecadb0c68d0afd54a5950471628ec4e2e27ac9c8b9d841940d6b0f2c0a873d4feab7af37e7989a52 DIST linux-2.6.39.tar.bz2 76096559 SHA256 584d17f2a3ee18a9501d7ff36907639e538cfdba4529978b8550c461d45c61f6 SHA512 06cb5aba7c53c68d43afcebbbb9507d8b398b3e994d8a237c66a49374ca569237f074adaa3fccba7f908eab4f51f99bae40656793eab5c2f5ce03cd3a65fa02c WHIRLPOOL 2f2c833ab1d8ddbe3e0b862b71a38d47fd3fc5688ea81cdd818369b09e72fa50481bf84533ddcea992af1130b2ceec10b6ff5eaff393a14ee70639293a555912 +DIST linux-3.12.tar.xz 76384600 SHA256 2e120ec7fde19fa51dc6b6cc11c81860a0775defcad5a5bf910ed9a50e845a02 SHA512 4ba5797e0772726d05c9f2eee66dc6dc2a5033c749ef44764c805a83da739ed5d0c6443b76785e38fe1ef74cc7ade787e48144faed0cfcb6f124f05248c700ff WHIRLPOOL a40195f6b53ba3440cf90a44495f6a59670f750851d1518e2bdfe3b949f0e898d1df5d37e271c31c555087026ddb6cc2c9109b22b9639e3222735e6f650a1417 DIST linux-3.2.tar.xz 65065516 SHA256 dd96ed02b53fb5d57762e4b1f573460909de472ca588f81ec6660e4a172e7ba7 SHA512 77e9a52d78d6c8e951df1e166023eebe5defc5ef3c45d3ac84b613137b3c2e55cee5693d828ebd06c5034bd89ea2a5f862f55824f2b7839c9ad7212c81e3ecb0 WHIRLPOOL 7cc68baac4441740e2171fbbc4195ee6c0351de099aadaee8cb3487f6d1f8b7e1d3144ee54ba38dbd24d6be431a1ea3b921ffce82ff84df21a98da7bc61c1d17 EBUILD klibc-1.5.25.ebuild 7605 SHA256 48b2924efd4cece6a3c6d100ebd6cf40402fcedbe766297faa825ed7a1d69712 SHA512 98804fad0d8652da84db78ceb2c3c210bd39798b2a2e8416507d898e228439ed2aff8f99cab3ad1c26b1aa9736d71285b44740e6437c5d753f3909222436ad4a WHIRLPOOL c8b1ccf03928d07e2555f00149c07328cf33aba3ca2d5d723ec97389e51f711fb4ddbb451721e674ff4210586b29cb6facb0e332d5baa8f99092cfe3cdd762aa EBUILD klibc-2.0.2-r1.ebuild 8657 SHA256 b8dee77f3b5d28c347b65871d98f8c6846db8c5076b0f2139f8d4c11ad9a695b SHA512 2ac2fad49b22d43668e700006360ddf42ebe6492acf250a8f9b6b62167ffd359eb402c8793629793fc6c27650ce2fb40aac8e02b17b373afc335da4357e1808a WHIRLPOOL 45c5921ad89e98dcaf29dcba96bb5195be4321acf078bf28c8b216b5603c0234b7964d3a04eb792c39ad3599381dd02261ab137497addecf7365c42e0a91b84c EBUILD klibc-2.0.2.ebuild 8235 SHA256 734d88ab2557ee157f32c4306ea37a53e2a910ab5057b85b3c3671f092b6ebed SHA512 35cb2d4e8bd3139ed8a459eb5c87b040b9b0a84a7f194f0a85aa86bc74fe25a1665279ab64684eff46e7187e8287f2ab40269bcce82741633449bd6d6e05f496 WHIRLPOOL 34a72c50de855ffa3f36d6c7f793f6ceb2c54714c5d1dc9c2642e024a401e6f20d593be585fcd87466025a6e09d46128cb48a5fddc2f5c812043ffe240b4a607 +EBUILD klibc-2.0.3-r1.ebuild 9411 SHA256 133c646dc89bebbac86c68e2935a2d31e52b27db1078a9ee59b378bc6ede0c4a SHA512 6e588c1051e0f9c1ada6496ce5d383947209dcc44a87cccdc367553b0dc214ad0359808c6e91a65f5139ac457e30758c951a4d90fa808dd5f12e7d6e2deeff10 WHIRLPOOL 1d52050d3f86b5fbd0c981268d86dd9324413aaf89afc182686c9eb428aac53094bb1fcace213c9c8cddf2679498b4299a7aa997935bdcef4c0392389b325d78 EBUILD klibc-2.0.3.ebuild 9036 SHA256 540617c4841216db6dcd22639cd5d06d24965b8ecd28afd4fed167e54d7bd712 SHA512 4bce429124ddb4b7fc6828db0331058c2183636f5a063982bb04be3c806a8decbeee1890cfe1d7536e1bfb29ff61fa7094bd28bafb9468046448c2045880d5fc WHIRLPOOL 952231e5c59350cefc20664cfd27df29f47bae29d0df8da736dd8439c380424f0babf9f3b4cf916c7db138621b313233a41d41f51f635e55cf2ab646d437fcf8 -MISC ChangeLog 16148 SHA256 2b6ae58e69ab917b6252c92ceb4efc18593e16467e0dd07fdb7b4118f0da9df2 SHA512 a613d0358098463c3f3e272ecbe2f1fbba54628a433187b80cb85ea017e6cd49af1f39905eee3df03cff87e88e8f0734d17a0eddd37940db38b283b883c9c6ca WHIRLPOOL 50aed94f4f875dcff04e1369436707425d46084f3cc1493c90fc27fded8910a60df2f866ce5b9af5ec9392b056571a18c47a947e5eda8327c38a6ba5010e45f3 +MISC ChangeLog 16356 SHA256 895c96a35b892ab46bd32535cf68e7dd76a43d2eb91d7e11abd0f3dc18f0cc33 SHA512 81c1a72f53ba1feeacaf041bb46676c451625f50f43036f9a7483b9973e1a7456637bda32d2a4c7919f53ad88b1c6192b335a30d5d4bfbb55dd23eb526bad153 WHIRLPOOL 6b715d084b12e4121e3164190b64d7fc519d3dfa8d92aef2ab5062b1751b08bc9e9315ece38d69802195d0a255e2a2b7518e1ffc41d0af012195e42f6c4fbdee MISC metadata.xml 164 SHA256 3b1b59f5a5a6e3a377f6124aa855936c20e9b883f7bbbef0210fdef022da34f3 SHA512 84cc2f3f5b3ece35f020ba9a4b29f5ea9082ee201bc21b5a386c5f8a44a685967a27e2af96e3f6addc19ee0b6ee80e116f2afab770ec4e57b994f97c3d1161ea WHIRLPOOL 9b0f6952edfd4458f8d8f2186f89ae04ecc2b8de5eb819626c8da501dbac0ab3bcf8606b10a896582b2c5ab9de015f174ca4962f98fd4772759046213767e13e 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/klibc-2.0.3-r1.ebuild b/dev-libs/klibc/klibc-2.0.3-r1.ebuild new file mode 100644 index 000000000000..d05646f0a5f6 --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.3-r1.ebuild @@ -0,0 +1,316 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-2.0.3-r1.ebuild,v 1.1 2013/12/26 23:15:50 robbat2 Exp $ + +# 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 +# unfortunetly. +# 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=5 +K_TARBALL_SUFFIX="xz" + +inherit eutils multilib toolchain-funcs flag-o-matic + +DESCRIPTION="A minimal libc subset for use with initramfs." +HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc" +KV_MAJOR="3" KV_MINOR="x" KV_SUB="12" +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.2 +DEBIAN_PR=1 +DEBIAN_A="${PN}_${DEBIAN_PV}-${DEBIAN_PR}.debian.tar.gz" +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" + +DEPEND="dev-lang/perl" +RDEPEND="${DEPEND}" + +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} +} + +src_prepare() { + [[ ${PKV} ]] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX} + cd "${S}" + + # Symlink /usr/src/linux to ${S}/linux + ln -snf "${KS}" linux + #ln -snf "/usr" linux + + # Build interp.o with EXTRA_KLIBCAFLAGS (.S source) + epatch "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch + + # Fix usage of -s, bug #201006 + epatch "${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 + epatch "${FILESDIR}"/klibc-2.0.2-mkfifo.patch + + # Newer kernels have some headers in the uapi dir + epatch "${FILESDIR}"/klibc-2.0.3-kernel-uapi.patch + + # Borrow the debian fixes too + for p in $(<"${S}"/debian/patches/series) ; do + epatch "${S}/debian/patches/${p}" + done +} + +# 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' \ + "${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 + 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 +} |