diff options
author | Mike Frysinger <vapier@gentoo.org> | 2004-08-25 22:47:31 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2004-08-25 22:47:31 +0000 |
commit | d77e2525127d431e6b051a2b54667a97d60d2cbb (patch) | |
tree | f5f5f9ad23565f853254f1b3c976dfbdb65d9a12 /dev-libs | |
parent | Added the /proc/cmdline patch to 2.4.27 as well since the issue also applies ... (diff) | |
download | gentoo-2-d77e2525127d431e6b051a2b54667a97d60d2cbb.tar.gz gentoo-2-d77e2525127d431e6b051a2b54667a97d60d2cbb.tar.bz2 gentoo-2-d77e2525127d431e6b051a2b54667a97d60d2cbb.zip |
CVS ebuild to make our (well mine at least) lives easier.
Diffstat (limited to 'dev-libs')
15 files changed, 464 insertions, 1 deletions
diff --git a/dev-libs/uclibc/ChangeLog b/dev-libs/uclibc/ChangeLog index df23a96bc10a..e293ff8abf12 100644 --- a/dev-libs/uclibc/ChangeLog +++ b/dev-libs/uclibc/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-libs/uclibc # Copyright 2002-2004 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/ChangeLog,v 1.34 2004/08/19 19:36:21 solar Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/ChangeLog,v 1.35 2004/08/25 22:47:31 vapier Exp $ + +*uclibc-9999 (25 Aug 2004) + + 25 Aug 2004; Mike Frysinger <vapier@gentoo.org> + +uclibc-9999.ebuild: + CVS ebuild to make our (well mine at least) lives easier. 19 Aug 2004; <solar@gentoo.org> uclibc-0.9.26-r1.ebuild, uclibc-0.9.26-r2.ebuild, uclibc-0.9.26-r3.ebuild, uclibc-0.9.26-r4.ebuild, diff --git a/dev-libs/uclibc/files/cvs/01_all_uClibc-pie-option.patch b/dev-libs/uclibc/files/cvs/01_all_uClibc-pie-option.patch new file mode 100644 index 000000000000..41beaea78abc --- /dev/null +++ b/dev-libs/uclibc/files/cvs/01_all_uClibc-pie-option.patch @@ -0,0 +1,18 @@ +--- extra/Configs/Config.in.mps 2004-01-05 11:07:27.000000000 +0100 ++++ extra/Configs/Config.in 2004-01-05 11:10:58.000000000 +0100 +@@ -180,13 +180,14 @@ + config UCLIBC_PIE_SUPPORT + bool "Support ET_DYN in shared library loader" + select FORCE_SHAREABLE_TEXT_SEGMENTS ++ select UCLIBC_COMPLETELY_PIC + default n + help + If you answer Y here, the uClibc native shared library loader will + support ET_DYN/PIE executables. + It requires binutils-2.14.90.0.6 or later and the usage of the + -pie option. +- More about ET_DYN/PIE binaries on <http://pageexec.virtualave.net/> . ++ More about ET_DYN/PIE binaries on <http://pax.grsecurity.net/> . + WARNING: This option also enables FORCE_SHAREABLE_TEXT_SEGMENTS, so all + libraries have to be built with -fPIC or -fpic, and all assembler + functions must be written as position independent code (PIC). diff --git a/dev-libs/uclibc/files/cvs/02_all_uClibc-Makefile.patch b/dev-libs/uclibc/files/cvs/02_all_uClibc-Makefile.patch new file mode 100644 index 000000000000..965ace9c0cb3 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/02_all_uClibc-Makefile.patch @@ -0,0 +1,38 @@ +--- extra/scripts/fix_includes.sh.mps 2004-01-05 11:14:05.000000000 +0100 ++++ extra/scripts/fix_includes.sh 2004-01-05 12:25:11.000000000 +0100 +@@ -59,10 +59,10 @@ + esac; + done; + +-if [ ! -f "$KERNEL_SOURCE/Makefile" ]; then ++if [ ! -f "$KERNEL_SOURCE/Makefile" -a ! -f "$KERNEL_SOURCE/include/linux/version.h" ]; then + echo ""; + echo ""; +- echo "The file $KERNEL_SOURCE/Makefile is missing!"; ++ echo "The file $KERNEL_SOURCE/Makefile or $KERNEL_SOURCE/include/linux/version.h is missing!"; + echo "Perhaps your kernel source is broken?" + echo ""; + echo ""; +@@ -78,8 +78,21 @@ + exit 1; + fi; + +-# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION ++if [ -f "$KERNEL_SOURCE/Makefile" ] ; then ++# set current VERSION, PATCHLEVEL, SUBLEVEL, EXTRAVERSION + eval `sed -n -e 's/^\([A-Z]*\) = \([0-9]*\)$/\1=\2/p' -e 's/^\([A-Z]*\) = \(-[-a-z0-9]*\)$/\1=\2/p' $KERNEL_SOURCE/Makefile` ++else ++ver=`grep UTS_RELEASE $KERNEL_SOURCE/include/linux/version.h | cut -d '"' -f 2` ++VERSION=`echo "$ver" | cut -d '.' -f 1` ++PATCHLEVEL=`echo "$ver" | cut -d '.' -f 2` ++if echo "$ver" | grep -q '-' ; then ++SUBLEVEL=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.//" | cut -d '-' -f 1` ++EXTRAVERSION=`echo "$ver" | sed "s/${VERSION}.${PATCHLEVEL}.${SUBLEVEL}-//"` ++else ++SUBLEVEL=`echo "$ver" | cut -d '.' -f 3` ++#EXTRAVERSION= ++fi ++fi + if [ -z "$VERSION" -o -z "$PATCHLEVEL" -o -z "$SUBLEVEL" ] + then + echo "Unable to determine version for kernel headers" diff --git a/dev-libs/uclibc/files/cvs/03_all_uClibc-ssp-sigtype.patch b/dev-libs/uclibc/files/cvs/03_all_uClibc-ssp-sigtype.patch new file mode 100644 index 000000000000..7a4811021460 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/03_all_uClibc-ssp-sigtype.patch @@ -0,0 +1,37 @@ +--- extra/Configs/Config.in.ssp 2004-02-01 16:49:31.000000000 +0100 ++++ extra/Configs/Config.in 2004-02-01 16:51:59.000000000 +0100 +@@ -231,6 +231,34 @@ + gcc version, were __guard and __stack_smash_handler are removed from libgcc. + Most people will answer N. + ++choice ++ prompt "Propolice protection blocking signal" ++ depends on UCLIBC_PROPOLICE ++ default PROPOLICE_BLOCK_ABRT if ! DODEBUG ++ default PROPOLICE_BLOCK_SEGV if DODEBUG ++ help ++ "abort" use SIGABRT to block offending programs. ++ This is the default implementation. ++ ++ "segfault" use SIGSEGV to block offending programs. ++ Use this for debugging. ++ ++ "kill" use SIGKILL to block offending programs. ++ Perhaps the best for security. ++ ++ If unsure, answer "abort". ++ ++config PROPOLICE_BLOCK_ABRT ++ bool "abort" ++ ++config PROPOLICE_BLOCK_SEGV ++ bool "segfault" ++ ++config PROPOLICE_BLOCK_KILL ++ bool "kill" ++ ++endchoice ++ + config HAS_NO_THREADS + bool + default y diff --git a/dev-libs/uclibc/files/cvs/07_all_uClibc-owl-erik-malloc-unlink-sanity-check.patch b/dev-libs/uclibc/files/cvs/07_all_uClibc-owl-erik-malloc-unlink-sanity-check.patch new file mode 100644 index 000000000000..c18f946c4c24 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/07_all_uClibc-owl-erik-malloc-unlink-sanity-check.patch @@ -0,0 +1,19 @@ +--- libc/stdlib/malloc-standard/malloc.h.mps Sat Jan 31 11:26:14 2004 ++++ libc/stdlib/malloc-standard/malloc.h Sat Jan 31 11:28:29 2004 +@@ -20,6 +20,7 @@ + #include <errno.h> + #include <string.h> + #include <malloc.h> ++#include <stdlib.h> + + + #ifdef __UCLIBC_HAS_THREADS__ +@@ -636,6 +637,8 @@ + #define unlink(P, BK, FD) { \ + FD = P->fd; \ + BK = P->bk; \ ++ if (FD->bk != P || BK->fd != P) \ ++ abort(); \ + FD->bk = BK; \ + BK->fd = FD; \ + } diff --git a/dev-libs/uclibc/files/cvs/08_all_uClibc-pt_pax.patch b/dev-libs/uclibc/files/cvs/08_all_uClibc-pt_pax.patch new file mode 100644 index 000000000000..7b66ab9acc00 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/08_all_uClibc-pt_pax.patch @@ -0,0 +1,29 @@ +--- include/elf.h.mps 2004-05-08 13:51:59.000000000 +0200 ++++ include/elf.h 2004-05-08 13:52:38.000000000 +0200 +@@ -567,6 +567,7 @@ typedef struct + #define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */ + #define PT_GNU_STACK 0x6474e551 /* Indicates stack executability */ + #define PT_GNU_RELRO 0x6474e552 /* Read-only after relocation */ ++#define PT_PAX_FLAGS 0x65041580 /* Indicates PaX flag markings */ + #define PT_LOSUNW 0x6ffffffa + #define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */ + #define PT_SUNWSTACK 0x6ffffffb /* Stack segment */ +@@ -580,6 +581,18 @@ typedef struct + #define PF_X (1 << 0) /* Segment is executable */ + #define PF_W (1 << 1) /* Segment is writable */ + #define PF_R (1 << 2) /* Segment is readable */ ++#define PF_PAGEEXEC (1 << 4) /* Enable PAGEEXEC */ ++#define PF_NOPAGEEXEC (1 << 5) /* Disable PAGEEXEC */ ++#define PF_SEGMEXEC (1 << 6) /* Enable SEGMEXEC */ ++#define PF_NOSEGMEXEC (1 << 7) /* Disable SEGMEXEC */ ++#define PF_MPROTECT (1 << 8) /* Enable MPROTECT */ ++#define PF_NOMPROTECT (1 << 9) /* Disable MPROTECT */ ++#define PF_RANDEXEC (1 << 10) /* Enable RANDEXEC */ ++#define PF_NORANDEXEC (1 << 11) /* Disable RANDEXEC */ ++#define PF_EMUTRAMP (1 << 12) /* Enable EMUTRAMP */ ++#define PF_NOEMUTRAMP (1 << 13) /* Disable EMUTRAMP */ ++#define PF_RANDMMAP (1 << 14) /* Enable RANDMMAP */ ++#define PF_NORANDMMAP (1 << 15) /* Disable RANDMMAP */ + #define PF_MASKOS 0x0ff00000 /* OS-specific */ + #define PF_MASKPROC 0xf0000000 /* Processor-specific */ + diff --git a/dev-libs/uclibc/files/cvs/09_all_uClibc-test-make.patch b/dev-libs/uclibc/files/cvs/09_all_uClibc-test-make.patch new file mode 100644 index 000000000000..1f19428d2ab3 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/09_all_uClibc-test-make.patch @@ -0,0 +1,37 @@ +--- test/Makefile.mps 2003-10-18 11:20:27.000000000 +0100 ++++ test/Makefile 2004-02-02 13:55:45.000000000 +0100 +@@ -22,19 +22,19 @@ + .EXPORT_ALL_VARIABLES: + + +-ALL_SUBDIRS = args assert ctype dlopen pwd_grp signal silly stdlib string unistd crypt #misc ++ALL_SUBDIRS = args assert ctype pwd_grp signal silly stdlib string unistd crypt #misc + DIRS = $(ALL_SUBDIRS) + #ifeq ($(TARGET_ARCH), $(HOST_ARCH)) + # DIRS = $(ALL_SUBDIRS) + #else + # DIRS = + #endif +-ifeq ($(strip $(HAVE_SHARED)),true) +- ifeq ($(strip $(DODYNAMIC)),true) ++ifeq ($(HAVE_SHARED),y) ++ ifeq ($(BUILD_UCLIBC_LDSO),y) + DIRS += dlopen + endif + endif +-ifeq ($(strip $(INCLUDE_THREADS)),true) ++ifeq ($(UCLIBC_HAS_THREADS),y) + DIRS += pthread + endif + +--- test/Rules.mak.mps 2004-01-03 00:10:37.000000000 +0100 ++++ test/Rules.mak 2004-02-02 13:54:59.000000000 +0100 +@@ -44,7 +44,7 @@ + CROSS= + CC= $(CROSS)gcc + STRIPTOOL=strip +-LDD=../$(TESTDIR)ldso/util/ldd ++LDD=../$(TOPDIR)/utils/ldd + + RM= rm -f + diff --git a/dev-libs/uclibc/files/cvs/10_all_uClibc-ldso-ssp.patch b/dev-libs/uclibc/files/cvs/10_all_uClibc-ldso-ssp.patch new file mode 100644 index 000000000000..978925d4cb13 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/10_all_uClibc-ldso-ssp.patch @@ -0,0 +1,13 @@ +--- ldso/ldso/Makefile.orig 2004-08-25 22:29:27 +0000 ++++ ldso/ldso/Makefile 2004-08-25 22:29:45 +0000 +@@ -21,7 +21,9 @@ + include $(TOPDIR)Rules.mak + LDSO_FULLNAME=ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so + +-XXFLAGS=$(XWARNINGS) $(LIBRARY_CACHE) ++SSPFLAGS=$(call check_gcc,-fno-stack-protector,) ++ ++XXFLAGS=$(XWARNINGS) $(LIBRARY_CACHE) $(SSPFLAGS) + ifeq ($(DODEBUG),y) + # Not really much point in including debugging info, since gdb + # can't really debug ldso, since gdb requires help from ldso to diff --git a/dev-libs/uclibc/files/cvs/12_all_uClibc-libc-ssp.patch b/dev-libs/uclibc/files/cvs/12_all_uClibc-libc-ssp.patch new file mode 100644 index 000000000000..cb2e9de6dd99 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/12_all_uClibc-libc-ssp.patch @@ -0,0 +1,16 @@ +--- uClibc-0.9.26/Rules.mak.mps 2004-05-17 15:10:52.000000000 +0200 ++++ uClibc-0.9.26/Rules.mak 2004-05-17 15:23:24.000000000 +0200 +@@ -208,8 +208,12 @@ ifeq ($(strip $(TARGET_ARCH)),arm) + endif + endif + ++ifeq ($(SSP_CFLAGS),) ++SSP_CFLAGS=$(call check_gcc,-fno-stack-protector-all,) ++endif ++ + # Some nice CFLAGS to work with +-CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) \ ++CFLAGS=$(XWARNINGS) $(OPTIMIZATION) $(XARCH_CFLAGS) $(CPU_CFLAGS) $(SSP_CFLAGS) \ + -fno-builtin -nostdinc -D_LIBC -I$(TOPDIR)include -I. + + ifeq ($(DODEBUG),y) diff --git a/dev-libs/uclibc/files/cvs/13_all_uClibc-enable-ssp.patch b/dev-libs/uclibc/files/cvs/13_all_uClibc-enable-ssp.patch new file mode 100644 index 000000000000..13f7d0cc07c5 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/13_all_uClibc-enable-ssp.patch @@ -0,0 +1,10 @@ +--- uClibc-0.9.26/Rules.mak.mps 2004-05-17 17:58:55.000000000 +0200 ++++ uClibc-0.9.26/Rules.mak 2004-05-17 17:59:37.000000000 +0200 +@@ -210,6 +210,7 @@ endif + + ifeq ($(SSP_CFLAGS),) + SSP_CFLAGS=$(call check_gcc,-fno-stack-protector-all,) ++SSP_CFLAGS+=$(call check_gcc,-fstack-protector,) + endif + + # Some nice CFLAGS to work with diff --git a/dev-libs/uclibc/files/cvs/21_all_uClibc-ld-relro.patch b/dev-libs/uclibc/files/cvs/21_all_uClibc-ld-relro.patch new file mode 100644 index 000000000000..188529f87b1a --- /dev/null +++ b/dev-libs/uclibc/files/cvs/21_all_uClibc-ld-relro.patch @@ -0,0 +1,22 @@ +--- ./ldso/ldso/Makefile.mps 2004-04-23 09:11:48.000000000 +0200 ++++ ./ldso/ldso/Makefile 2004-04-23 09:19:21.000000000 +0200 +@@ -43,7 +43,7 @@ + + XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp") + LDFLAGS=$(CPU_LDFLAGS-y) -shared --warn-common --export-dynamic --sort-common \ +- -z combreloc --discard-locals --discard-all --no-undefined ++ -z combreloc --discard-locals --discard-all --no-undefined -z relro + + CSRC= ldso.c dl-startup.c + COBJS=$(patsubst %.c,%.o, $(CSRC)) +--- ./Rules.mak.mps 2004-04-23 09:02:37.000000000 +0200 ++++ ./Rules.mak 2004-04-23 09:18:49.000000000 +0200 +@@ -218,7 +218,7 @@ + LDFLAGS:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc + STRIPTOOL:= true -Since_we_are_debugging + else +- LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc ++ LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc -z relro + endif + + # Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include' diff --git a/dev-libs/uclibc/files/cvs/22_all_uClibc-ld-now.patch b/dev-libs/uclibc/files/cvs/22_all_uClibc-ld-now.patch new file mode 100644 index 000000000000..29deb7743f19 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/22_all_uClibc-ld-now.patch @@ -0,0 +1,22 @@ +--- ./ldso/ldso/Makefile.mps 2004-04-23 09:11:48.000000000 +0200 ++++ ./ldso/ldso/Makefile 2004-04-23 09:19:21.000000000 +0200 +@@ -43,7 +43,7 @@ + + XXFLAGS+=$(shell $(CC) -print-search-dirs | sed -ne "s/install: *\(.*\)/-I\1include/gp") + LDFLAGS=$(CPU_LDFLAGS-y) -shared --warn-common --export-dynamic --sort-common \ +- -z combreloc --discard-locals --discard-all --no-undefined -z relro ++ -z combreloc --discard-locals --discard-all --no-undefined -z relro -z now + + CSRC= ldso.c dl-startup.c + COBJS=$(patsubst %.c,%.o, $(CSRC)) +--- ./Rules.mak.mps 2004-04-23 09:02:37.000000000 +0200 ++++ ./Rules.mak 2004-04-23 09:18:49.000000000 +0200 +@@ -218,7 +218,7 @@ + LDFLAGS:= $(CPU_LDFLAGS-y) -shared --warn-common --warn-once -z combreloc + STRIPTOOL:= true -Since_we_are_debugging + else +- LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc -z relro ++ LDFLAGS := $(CPU_LDFLAGS-y) -s -shared --warn-common --warn-once -z combreloc -z relro -z now + endif + + # Sigh, some stupid versions of gcc can't seem to cope with '-iwithprefix include' diff --git a/dev-libs/uclibc/files/cvs/30_all_uClibc-arm-ucontext.patch b/dev-libs/uclibc/files/cvs/30_all_uClibc-arm-ucontext.patch new file mode 100644 index 000000000000..78b8d4cc04e4 --- /dev/null +++ b/dev-libs/uclibc/files/cvs/30_all_uClibc-arm-ucontext.patch @@ -0,0 +1,10 @@ +--- libc/sysdeps/linux/arm/sys/ucontext.h.orig 2004-08-06 12:08:48.234295048 -0400 ++++ libc/sysdeps/linux/arm/sys/ucontext.h 2004-08-06 12:09:11.123815312 -0400 +@@ -24,6 +24,7 @@ + #include <features.h> + #include <signal.h> + #include <sys/procfs.h> ++#include <bits/sigcontext.h> + + typedef int greg_t; + diff --git a/dev-libs/uclibc/files/digest-uclibc-9999 b/dev-libs/uclibc/files/digest-uclibc-9999 new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/dev-libs/uclibc/files/digest-uclibc-9999 diff --git a/dev-libs/uclibc/uclibc-9999.ebuild b/dev-libs/uclibc/uclibc-9999.ebuild new file mode 100644 index 000000000000..d5a809d78d33 --- /dev/null +++ b/dev-libs/uclibc/uclibc-9999.ebuild @@ -0,0 +1,186 @@ +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/uclibc/uclibc-9999.ebuild,v 1.1 2004/08/25 22:47:31 vapier Exp $ + +ECVS_SERVER="uclibc.org:/var/cvs" +ECVS_MODULE="uClibc" +inherit eutils flag-o-matic gcc cvs + +MY_PN="${PN/ucl/uCl}" +DESCRIPTION="C library for developing embedded Linux systems" +HOMEPAGE="http://www.uclibc.org/" +SRC_URI="" + +LICENSE="LGPL-2" +SLOT="0" +KEYWORDS="-*" +IUSE="build hardened ipv6 static debug" # nls is not supported yet +RESTRICT="nostrip" + +DEPEND="sys-devel/gcc" +RDEPEND="" +PROVIDE="virtual/glibc virtual/libc" + +S=${WORKDIR}/${ECVS_MODULE} + +src_unpack() { +ECVS_SERVER="offline" cvs_src_unpack + unpack ${A} + cd ${S} + + cp ${FILESDIR}/0.9.26/ssp.c ${S}/libc/sysdeps/linux/common/ \ + || die "failed to copy ssp.c to ${S}/libc/sysdeps/linux/common/" + # gcc 3.4 nukes ssp without this patch + if [ "`gcc-major-version`" -eq "3" -a "`gcc-minor-version`" -ge "4" ] + then + epatch ${FILESDIR}/0.9.26/uclibc-0.9.26-ssp-gcc34-after-frandom.patch + fi + + cp -rf ${FILESDIR}/cvs ${S}/patch + # for now we remove relro/now, no support for relro in ldso + rm -f ${S}/patch/*relro* + rm -f ${S}/patch/*now* + # remove default ssp build + use hardened || rm -f ${S}/patch/*enable-ssp* + EPATCH_SUFFIX="patch" epatch ${S}/patch/ + +# epatch ${FILESDIR}/${MY_PV}/uclibc-0.9.26-arm-dl-sysdep.patch + + # build all .S files w/ -Wa,--noexecstack + einfo "Skipping noexecstack patch. (need update)" +# epatch ${FILESDIR}/${MY_PV}/${PN}-${MY_PV}-noexecstack.patch + + local target="" + if [ "${ARCH}" == "x86" ] ; then + target="i386" + elif [ "${ARCH}" == "ppc" ] ; then + target="powerpc" + else + # sparc|mips|alpha|arm|sh + target="${ARCH}" + fi + sed -i \ + -e "s:default TARGET_i386:default TARGET_${target}:" \ + extra/Configs/Config.in + sed -i \ + -e "s:default CONFIG_GENERIC_386:default CONFIG_${UCLIBC_CPU:-GENERIC_386}:" \ + extra/Configs/Config.${target} + + make defconfig >/dev/null || die "could not config" + + for def in UCLIBC_PROFILING DO{DEBUG,ASSERTS} SUPPORT_LD_DEBUG{,_EARLY} ; do + sed -i -e "s:${def}=y:# ${def} is not set:" .config + done + if use debug ; then + echo "SUPPORT_LD_DEBUG=y" >> .config + echo "DODEBUG=y" >> .config + fi + + for def in DO_C99_MATH UCLIBC_HAS_{RPC,CTYPE_CHECKED,WCHAR,HEXADECIMAL_FLOATS,GLIBC_CUSTOM_PRINTF,FOPEN_EXCLUSIVE_MODE,GLIBC_CUSTOM_STREAMS,PRINTF_M_SPEC,FTW} ; do + sed -i -e "s:# ${def} is not set:${def}=y:" .config + done + echo "UCLIBC_HAS_FULL_RPC=y" >> .config + echo "PTHREADS_DEBUG_SUPPORT=y" >> .config + + #if use nls + #then + # sed -i -e "s:# UCLIBC_HAS_LOCALE is not set:UCLIBC_HAS_LOCALE=y:" .config + # echo "UCLIBC_HAS_XLOCALE=n" >> .config + # echo "UCLIBC_HAS_GLIBC_DIGIT_GROUPING=y" >> .config + # echo "UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING=y" >> .config + # echo "UCLIBC_HAS_GETTEXT_AWARENESS=y" >> .config + # # on pax enabled kernels the locale files can't be built + # echo "UCLIBC_PREGENERATED_LOCALE_DATA=n" >> .config + #fi + # we disable LOCALE for any case, gettext has to be used + echo "UCLIBC_HAS_LOCALE=n" >> .config + + use ipv6 && sed -i -e "s:# UCLIBC_HAS_IPV6 is not set:UCLIBC_HAS_IPV6=y:" .config + + if use hardened + then + if use x86 + then + einfo "Enable Position Independent Executable support in ${P}" + sed -i -e "s:# UCLIBC_PIE_SUPPORT.*:UCLIBC_PIE_SUPPORT=y:" .config + fi + + einfo "Enable Stack Smashing Protections support in ${P}" + sed -i -e "s:# UCLIBC_PROPOLICE.*:UCLIBC_PROPOLICE=y:" .config + echo "PROPOLICE_BLOCK_ABRT=n" >> .config + echo "PROPOLICE_BLOCK_SEGV=n" >> .config + echo "PROPOLICE_BLOCK_KILL=y" >> .config + fi + + # we are building against system installed kernel headers + sed -i -e 's:KERNEL_SOURCE.*:KERNEL_SOURCE="/usr":' .config + + if [ "${PORTAGE_LIBC}" = "uClibc" ] ; then + sed -i \ + -e 's:SHARED_LIB_LOADER_PREFIX=.*:SHARED_LIB_LOADER_PREFIX="/lib":' \ + -e 's:DEVEL_PREFIX=.*:DEVEL_PREFIX="/usr":' \ + -e 's:RUNTIME_PREFIX=.*:RUNTIME_PREFIX="/":' \ + .config + sed -i '/LIBRARY_CACHE:=/s:#::' Rules.mak + fi + + make -s oldconfig > /dev/null || die "could not make oldconfig" + + chmod +x extra/scripts/relative_path.sh + + cp .config myconfig + + emake clean >/dev/null || die "could not clean" + +# sed -i 's:\$(R_PREFIX):\\"$(RUNTIME_PREFIX)\\" $(LIBRARY_CACHE):' utils/Makefile +} + +src_compile() { + mv myconfig .config + + #if use nls + #then + # # these can be built only if the build system supports locales (as of 0.9.26) + # emake -j1 headers + # cd extra/locale + # make clean + # find ./charmaps -name "*.pairs" > codesets.txt + # cp LOCALES locales.txt + # emake -j1 || die "could not make locales" + # cd ../.. + #fi + + emake -j1 || die "could not make" + if [ "${PORTAGE_LIBC}" = "uClibc" ] + then + emake -j1 utils || die "could not make utils" + fi +} + +src_install() { + emake PREFIX=${D} install || die "install failed" + + # remove files coming from kernel-headers + # scsi is uclibc's own directory since cvs 20040212 + if [ "${PORTAGE_LIBC}" = "uClibc" ] + then + rm -rf ${D}/usr/include/{asm,linux} + rm -f ${D}/usr/lib/lib*_pic.a + ! use static && use build && rm -f ${D}/usr/lib/lib*.a + + emake PREFIX=${D} install_utils || die "install-utils failed" + dodir /usr/bin + exeinto /usr/bin + doexe ${FILESDIR}/getent + fi + + # shameless plug for mjn3 who gives us so much... + # please give back if you can. -solar + f=DEDICATION.mjn3 ; [ -e "$f" ] && ( cat $f ; sleep 2s ) + + if ! use build + then + dodoc Changelog* README TODO docs/*.txt DEDICATION.mjn3 + doman debian/*.1 + fi +} |