diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 13:49:04 -0700 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2015-08-08 17:38:18 -0700 |
commit | 56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch) | |
tree | 3f91093cdb475e565ae857f1c5a7fd339e2d781e /dev-libs/klibc | |
download | gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2 gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip |
proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.
This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.
Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
Diffstat (limited to 'dev-libs/klibc')
21 files changed, 2188 insertions, 0 deletions
diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest new file mode 100644 index 000000000000..df9bca8f52a2 --- /dev/null +++ b/dev-libs/klibc/Manifest @@ -0,0 +1,8 @@ +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.4.tar.xz 469348 SHA256 7f9a0850586def7cf4faeeb75e5d0f66e613674c524f6e77b0f4d93a26c801cb SHA512 7a01d1744b49f3de64111fefc522b1d63f054199acf671254bc046d6f1d0b6ca68e050c99025bf8303751c2466a5e034677555649ae5909c40997858d393db8d WHIRLPOOL f5dc71b48f118155df512d8ac839b66d361b22ff4e040e49a562722d82f18ac83a8c682bf0b4c59a9b108473f74bebc673d38456cf0ab5b1051071ca3fa9b78e +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 diff --git a/dev-libs/klibc/files/klibc-1.1-mips32.patch b/dev-libs/klibc/files/klibc-1.1-mips32.patch new file mode 100644 index 000000000000..8eaf5d136801 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.1-mips32.patch @@ -0,0 +1,12 @@ +diff -Naurp klibc-1.1.orig/MCONFIG klibc-1.1/MCONFIG +--- klibc-1.1.orig/MCONFIG 2005-09-20 02:16:17 -0400 ++++ klibc-1.1/MCONFIG 2005-09-20 02:16:57 -0400 +@@ -33,7 +33,7 @@ KRNLOBJ = $(SRCROOT)/linux + KLIBCVER = -D__KLIBC__=$(shell cut -d. -f1 < $(SRCROOT)/version) \ + -D__KLIBC_MINOR__=$(shell cut -d. -f2 < $(SRCROOT)/version) + +-ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/parisc.*/parisc/) ++ARCH = $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/parisc.*/parisc/ -e s/mips64/mips/) + CC = $(CROSS)gcc + LD = $(CROSS)ld + KLIBSRC = $(SRCROOT)/klibc 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-klibcasmarch.patch b/dev-libs/klibc/files/klibc-1.5-klibcasmarch.patch new file mode 100644 index 000000000000..854d5337057d --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5-klibcasmarch.patch @@ -0,0 +1,25 @@ +--- a/scripts/Kbuild.install 2007-03-04 02:52:10.000000000 +0100 ++++ b/scripts/Kbuild.install 2007-11-04 15:43:28.000000000 +0100 +@@ -84,6 +84,13 @@ + # 1) Create directories, install headers and man pages + # 2) Tell that we now install binaries + # 3) Install binaries by descending ++ ++# Arch specific definitions for klibc ++include $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG ++ ++# include/asm-* architecture ++KLIBCASMARCH ?= $(KLIBCARCH) ++ + .PHONY: header footer descend + header: + $(Q)echo " INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)" +@@ -95,7 +102,7 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)set -e ; for d in linux scsi asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ ++ $(Q)set -e ; for d in linux scsi asm-$(KLIBCASMARCH) asm-generic $(ASMKLIBCARCH); do \ + mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KLIBCCROSS)include/$$d ; \ + for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \ + $(KLIBCKERNELOBJ)/include2 ; do \ diff --git a/dev-libs/klibc/files/klibc-1.5-sigaction.patch b/dev-libs/klibc/files/klibc-1.5-sigaction.patch new file mode 100644 index 000000000000..59f422048de1 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5-sigaction.patch @@ -0,0 +1,37 @@ +--- + usr/include/arch/ppc/klibc/archsignal.h | 6 ++++++ + usr/include/arch/sparc/klibc/archsignal.h | 7 ------- + 2 files changed, 6 insertions(+), 7 deletions(-) + +--- a/usr/include/arch/ppc/klibc/archsignal.h ++++ b/usr/include/arch/ppc/klibc/archsignal.h +@@ -8,7 +8,13 @@ + #ifndef _KLIBC_ARCHSIGNAL_H + #define _KLIBC_ARCHSIGNAL_H + ++#ifdef _SIGNAL_H ++#undef _SIGNAL_H + #include <asm/signal.h> ++#define _SIGNAL_H ++#else ++#include <asm/signal.h> ++#endif + /* No special stuff for this architecture */ + + #endif +--- a/usr/include/arch/sparc/klibc/archsignal.h ++++ b/usr/include/arch/sparc/klibc/archsignal.h +@@ -11,13 +11,6 @@ + #define __WANT_POSIX1B_SIGNALS__ + #include <asm/signal.h> + +-struct sigaction { +- __sighandler_t sa_handler; +- unsigned long sa_flags; +- void (*sa_restorer)(void); /* Not used by Linux/SPARC */ +- sigset_t sa_mask; +-}; +- + /* Not actually used by the kernel... */ + #define SA_RESTORER 0x80000000 + diff --git a/dev-libs/klibc/files/klibc-1.5.11-klibcasmarch.patch b/dev-libs/klibc/files/klibc-1.5.11-klibcasmarch.patch new file mode 100644 index 000000000000..0404a66a1ef1 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5.11-klibcasmarch.patch @@ -0,0 +1,26 @@ +diff -Nuar --exclude '*.orig' --exclude '*.rej' klibc-1.5.11.orig/scripts/Kbuild.install klibc-1.5.11/scripts/Kbuild.install +--- klibc-1.5.11.orig/scripts/Kbuild.install 2008-06-15 17:28:23.000000000 -0700 ++++ klibc-1.5.11/scripts/Kbuild.install 2008-06-26 10:14:05.365949576 -0700 +@@ -84,6 +84,13 @@ + # 1) Create directories, install headers and man pages + # 2) Tell that we now install binaries + # 3) Install binaries by descending ++ ++# Arch specific definitions for klibc ++include $(KLIBCSRC)/arch/$(KLIBCARCHDIR)/MCONFIG ++ ++# include/asm-* architecture ++KLIBCASMARCH ?= $(KLIBCARCH) ++ + .PHONY: header footer descend + header: + $(Q)echo " INSTALL headers + man pages to $(INSTALLROOT)$(INSTALLDIR)" +@@ -95,7 +102,7 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)set -e ; for d in linux asm asm-$(KLIBCARCH) asm-generic $(ASMKLIBCARCH); do \ ++ $(Q)set -e ; for d in linux scsi asm-$(KLIBCASMARCH) asm-generic $(ASMKLIBCARCH); do \ + for r in $(KLIBCKERNELSRC)/include $(KLIBCKERNELOBJ)/include \ + $(KLIBCKERNELOBJ)/include2 ; do \ + [ ! -d $$r/$$d ] && continue; \ diff --git a/dev-libs/klibc/files/klibc-1.5.11-x86_64-io.h-return.diff b/dev-libs/klibc/files/klibc-1.5.11-x86_64-io.h-return.diff new file mode 100644 index 000000000000..8ed2fa044cc9 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5.11-x86_64-io.h-return.diff @@ -0,0 +1,28 @@ +diff -Naur klibc-1.5.8.orig/usr/include/arch/x86_64/sys/io.h klibc-1.5.8/usr/include/arch/x86_64/sys/io.h +--- klibc-1.5.8.orig/usr/include/arch/x86_64/sys/io.h 2007-12-11 18:20:29.000000000 +0100 ++++ klibc-1.5.8/usr/include/arch/x86_64/sys/io.h 2008-06-26 12:04:22.760046895 +0200 +@@ -60,21 +60,21 @@ + { + unsigned char __v; + asm volatile ("inb %1,%0" : "=a" (__v) : "dN"(__p)); +- return v; ++ return __v; + } + + static __inline__ unsigned short inw(unsigned short __p) + { + unsigned short __v; + asm volatile ("inw %1,%0" : "=a" (__v) : "dN"(__p)); +- return v; ++ return __v; + } + + static __inline__ unsigned int inl(unsigned short __p) + { + unsigned int __v; + asm volatile ("inl %1,%0" : "=a" (__v) : "dN"(__p)); +- return v; ++ return __v; + } + + /* String I/O macros */ diff --git a/dev-libs/klibc/files/klibc-1.5.20-kbuild.patch b/dev-libs/klibc/files/klibc-1.5.20-kbuild.patch new file mode 100644 index 000000000000..b47131bfc445 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5.20-kbuild.patch @@ -0,0 +1,20 @@ +diff -urN klibc-1.5.20.orig/usr/klibc/socketcalls/Kbuild klibc-1.5.20/usr/klibc/socketcalls/Kbuild +--- klibc-1.5.20.orig/usr/klibc/socketcalls/Kbuild 2010-08-25 14:40:28.000000000 -0400 ++++ klibc-1.5.20/usr/klibc/socketcalls/Kbuild 2010-11-23 15:40:25.000000000 -0500 +@@ -48,3 +48,6 @@ + $(obj)/SOCKETCALLS.i \ + $(src)/socketcommon.h + $(call cmd,socketcalls) ++ ++PHONY += FORCE ++ +diff -urN klibc-1.5.20.orig/usr/klibc/syscalls/Kbuild klibc-1.5.20/usr/klibc/syscalls/Kbuild +--- klibc-1.5.20.orig/usr/klibc/syscalls/Kbuild 2010-08-25 14:40:28.000000000 -0400 ++++ klibc-1.5.20/usr/klibc/syscalls/Kbuild 2010-11-23 15:40:49.000000000 -0500 +@@ -95,3 +95,6 @@ + $(src)/syscommon.h $(obj)/syscalls.nrs \ + $(obj)/typesize.bin FORCE + $(call if_changed,syscalls) ++ ++PHONY += FORCE ++ diff --git a/dev-libs/klibc/files/klibc-1.5.20-parallel-make.patch b/dev-libs/klibc/files/klibc-1.5.20-parallel-make.patch new file mode 100644 index 000000000000..8afa2b6b5af6 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5.20-parallel-make.patch @@ -0,0 +1,11 @@ +--- scripts/Kbuild.install.orig 2013-03-14 09:33:32.429919267 -0400 ++++ scripts/Kbuild.install 2013-03-14 09:33:55.443820061 -0400 +@@ -95,7 +95,7 @@ header: + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)make -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install ++ $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir) diff --git a/dev-libs/klibc/files/klibc-1.5.23-parallel-make.patch b/dev-libs/klibc/files/klibc-1.5.23-parallel-make.patch new file mode 100644 index 000000000000..f3c98e32aa70 --- /dev/null +++ b/dev-libs/klibc/files/klibc-1.5.23-parallel-make.patch @@ -0,0 +1,11 @@ +--- klibc-1.5.23/scripts/Kbuild.install.orig ++++ klibc-1.5.23/scripts/Kbuild.install +@@ -95,7 +95,7 @@ + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)lib + $(Q)mkdir -p $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)bin +- $(Q)make -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install ++ $(Q)$(MAKE) -C $(KLIBCKERNELSRC) ARCH=$(KLIBCARCH) INSTALL_HDR_PATH=$(INSTALLROOT)$(INSTALLDIR)/$(KCROSS) headers_install + $(Q)cp -rf usr/include/. $(INSTALLROOT)$(INSTALLDIR)/$(KCROSS)include/. + $(Q)$(install-data) $(srctree)/klcc/klcc.1 $(INSTALLROOT)$(mandir)/man1/$(KCROSS)klcc.1 + $(Q)$(install-bin) $(objtree)/klcc/$(KCROSS)klcc $(INSTALLROOT)$(bindir) 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..cfbc5f63655f --- /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 +--- klibc-2.0.2-r1/work/klibc-2.0.2/usr/utils/mkfifo.c 2012-10-03 09:41:43.000000000 -0700 ++++ klibc-2.0.2.orig/work/klibc-2.0.2/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-1.5.25.ebuild b/dev-libs/klibc/klibc-1.5.25.ebuild new file mode 100644 index 000000000000..2c131f6e47f7 --- /dev/null +++ b/dev-libs/klibc/klibc-1.5.25.ebuild @@ -0,0 +1,266 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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. + +inherit eutils multilib toolchain-funcs + +DESCRIPTION="A minimal libc subset for use with initramfs" +HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc" +KV_MAJOR="2" KV_MINOR="6" KV_SUB="39" +PKV_EXTRA="" +if [ -n "${PKV_EXTRA}" ]; then + PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-${PKV_EXTRA}" + PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.bz2" +fi +OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}" +KERNEL_URI=" + mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/linux-${OKV}.tar.bz2 + mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.bz2" +SRC_URI=" + mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.bz2 + ${PATCH_URI} + ${KERNEL_URI}" + +LICENSE="|| ( GPL-2 LGPL-2 )" +KEYWORDS="~alpha amd64 ~arm ia64 -mips ~ppc ~ppc64 ~sparc x86" +SLOT="0" +IUSE="debug" + +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|amd64) echo x86 ;; + ppc*) echo powerpc ;; + # Non-merged + alpha|arm|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.bz2 ${P}.tar.bz2 + [ -n "${PKV}" ] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.bz2 + 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 +} + +# 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)" + 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}) + 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}" || 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}" || die "Failed to prepare kernel sources for header usage" + + cd "${S}" + + use debug && myargs="${myargs} V=1" + use test && myargs="${myargs} test" + + emake \ + EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ + EXTRA_KLIBCLDFLAGS="-z noexecstack" \ + HOSTCC="${HOSTCC}" CC="${CC}" \ + INSTALLDIR="/usr/${libdir}/klibc" \ + KLIBCARCH=${KLIBCARCH} \ + KLIBCASMARCH=${KLIBCASMARCH} \ + SHLIBDIR="/${libdir}" \ + libdir="/usr/${libdir}" \ + mandir="/usr/share/man" \ + T="${T}" \ + ${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" \ + HOSTCC="${HOSTCC}" CC="${CC}" \ + INSTALLDIR="/usr/${libdir}/klibc" \ + INSTALLROOT="${D}" \ + KLIBCARCH=${KLIBCARCH} \ + KLIBCASMARCH=${KLIBCASMARCH} \ + SHLIBDIR="/${libdir}" \ + libdir="/usr/${libdir}" \ + mandir="/usr/share/man" \ + ${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 + + # 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.2-r1.ebuild b/dev-libs/klibc/klibc-2.0.2-r1.ebuild new file mode 100644 index 000000000000..52fdcb50b857 --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.2-r1.ebuild @@ -0,0 +1,295 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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="2" +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}" +SRC_URI=" + mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX} + ${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|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} +} + +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 +} + +# 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 + + emake \ + EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ + EXTRA_KLIBCLDFLAGS="-z noexecstack" \ + HOSTLDFLAGS="-z noexecstack" \ + 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}" \ + ${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" \ + 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}" \ + ${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 +} diff --git a/dev-libs/klibc/klibc-2.0.2.ebuild b/dev-libs/klibc/klibc-2.0.2.ebuild new file mode 100644 index 000000000000..af0158ba64f7 --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.2.ebuild @@ -0,0 +1,286 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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 + +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="2" +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}" +SRC_URI=" + mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX} + ${PATCH_URI} + ${KERNEL_URI}" + +LICENSE="|| ( GPL-2 LGPL-2 )" +KEYWORDS="~alpha ~amd64 ~arm ~ia64 -mips ~ppc ~ppc64 ~sparc ~x86" +SLOT="0" +IUSE="debug test" + +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|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} +} + +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 +} + +# 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" + + emake \ + EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ + EXTRA_KLIBCLDFLAGS="-z noexecstack" \ + 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}" \ + ${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" \ + HOSTCC="${HOSTCC}" CC="${CC}" \ + INSTALLDIR="/usr/${libdir}/klibc" \ + INSTALLROOT="${D}" \ + KLIBCARCH=${KLIBCARCH} \ + KLIBCASMARCH=${KLIBCASMARCH} \ + SHLIBDIR="/${libdir}" \ + libdir="/usr/${libdir}" \ + mandir="/usr/share/man" \ + ${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 +} 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..81969b9a7a4d --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.3-r1.ebuild @@ -0,0 +1,316 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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/ https://www.kernel.org/pub/linux/libs/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 +} diff --git a/dev-libs/klibc/klibc-2.0.3.ebuild b/dev-libs/klibc/klibc-2.0.3.ebuild new file mode 100644 index 000000000000..6a9b53ca8d10 --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.3.ebuild @@ -0,0 +1,304 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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="2" +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}" +SRC_URI=" + mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX} + ${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} +} + +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 +} + +# 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 +} diff --git a/dev-libs/klibc/klibc-2.0.4.ebuild b/dev-libs/klibc/klibc-2.0.4.ebuild new file mode 100644 index 000000000000..81969b9a7a4d --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.4.ebuild @@ -0,0 +1,316 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# 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/ https://www.kernel.org/pub/linux/libs/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 +} diff --git a/dev-libs/klibc/metadata.xml b/dev-libs/klibc/metadata.xml new file mode 100644 index 000000000000..74d25af22b2e --- /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> +<herd>kernel-misc</herd> +</pkgmetadata> |