diff options
author | Chris PeBenito <pebenito@gentoo.org> | 2004-02-01 06:55:03 +0000 |
---|---|---|
committer | Chris PeBenito <pebenito@gentoo.org> | 2004-02-01 06:55:03 +0000 |
commit | 71f67c7b0946580898f81e68e0d01d770abb0700 (patch) | |
tree | a1f585679ac0d9524cd638844b8e045fc8af6527 /sys-devel | |
parent | rename local.use.flag etdyn to pie (diff) | |
download | historical-71f67c7b0946580898f81e68e0d01d770abb0700.tar.gz historical-71f67c7b0946580898f81e68e0d01d770abb0700.tar.bz2 historical-71f67c7b0946580898f81e68e0d01d770abb0700.zip |
initial commit
Diffstat (limited to 'sys-devel')
7 files changed, 596 insertions, 0 deletions
diff --git a/sys-devel/uclibc-buildroot/ChangeLog b/sys-devel/uclibc-buildroot/ChangeLog new file mode 100644 index 000000000000..85d845573be3 --- /dev/null +++ b/sys-devel/uclibc-buildroot/ChangeLog @@ -0,0 +1,11 @@ +# ChangeLog for sys-devel/uclibc-buildroot +# Copyright 2000-2004 Gentoo Technologies, Inc.; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/uclibc-buildroot/ChangeLog,v 1.1 2004/02/01 06:55:03 pebenito Exp $ + +*uclibc-buildroot-20040131 (01 Feb 2004) + + 01 Feb 2004; Chris PeBenito <pebenito@gentoo.org> + uclibc-buildroot-20040131.ebuild, files/uClibc-0.9.26-Makefile.patch, + files/uClibc-0.9.26-pie-option.patch: + Initial commit. EXPERIMENTAL Work in progress. + diff --git a/sys-devel/uclibc-buildroot/Manifest b/sys-devel/uclibc-buildroot/Manifest new file mode 100644 index 000000000000..fa8ee36098d4 --- /dev/null +++ b/sys-devel/uclibc-buildroot/Manifest @@ -0,0 +1,6 @@ +MD5 55f09ff1ce85c19ef29f92dbcbfa009d ChangeLog 493 +MD5 bebf5ce8bd6516ef42239ea5b8de3e0b metadata.xml 262 +MD5 ec6957e1263b08c93ad9ca507d4bcd12 uclibc-buildroot-20040131.ebuild 15403 +MD5 fed0ccb5a3b2aefd4671c2e470dadeeb files/uClibc-0.9.26-Makefile.patch 1764 +MD5 4f9f87ac7690d24d225c32d6804894a8 files/uClibc-0.9.26-pie-option.patch 863 +MD5 47e5b508e1686ea3bf55be56d92254d7 files/digest-uclibc-buildroot-20040131 766 diff --git a/sys-devel/uclibc-buildroot/files/digest-uclibc-buildroot-20040131 b/sys-devel/uclibc-buildroot/files/digest-uclibc-buildroot-20040131 new file mode 100644 index 000000000000..b53563c0ec4b --- /dev/null +++ b/sys-devel/uclibc-buildroot/files/digest-uclibc-buildroot-20040131 @@ -0,0 +1,11 @@ +MD5 011b436330f6e1760fe91a9058b0c377 gcc-3.3.2.tar.bz2 23554800 +MD5 8f6c56a3239051e68be5469412b43f32 buildroot-20040131.tar.bz2 446486 +MD5 71b99dba3045a359dc314dbebedcf502 binutils-2.14.90.0.6.tar.bz2 10399066 +MD5 164372c3b7c1d43f00a0c66d893a2a10 kernel-headers-2.4.21.tar.bz2 3776596 +MD5 7212713c432dd0de6ec2140c2a6212e4 uClibc-0.9.26.tar.bz2 1604543 +MD5 d75b2239b4e27c3c9cbed1c8f6eabba6 uClibc-locale-030818.tgz 236073 +MD5 a18c8048786b88fc042f92823c6a1cd1 elf2flt-20030620.tar.bz2 51298 +MD5 64e3de00bd6bb9a6689afe208bd8a636 busybox-1.00-pre6.tar.bz2 1103543 +MD5 44da0ff2b727455669890b24305e351d tinylogin-1.4.tar.bz2 98502 +MD5 3501a47b14e92be3b1de2a90eb5f10cc libfloat_990616.orig.tar.gz 1475698 +MD5 a51efc8a3b3619b0b7ed084efa812474 libfloat_990616-3.diff.gz 2985 diff --git a/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-Makefile.patch b/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-Makefile.patch new file mode 100644 index 000000000000..9da8d79ee6d2 --- /dev/null +++ b/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-Makefile.patch @@ -0,0 +1,45 @@ +--- extra/scripts/fix_includes.sh.orig 2004-01-15 17:50:48.474188032 +0930 ++++ extra/scripts/fix_includes.sh 2004-01-15 18:45:51.451059224 +0930 +@@ -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 ""; +@@ -79,12 +79,26 @@ + fi; + + # set current VERSION, PATCHLEVEL, SUBLEVEL, EXTERVERSION +-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` ++ ++if [ -f "$KERNEL_SOURCE/Makefile" ] ; then ++ 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" +- echo -e "\tprovided in directory $KERNEL_SOURCE" +- exit 1 ++ exit 1; + fi + + echo "Current kernel version is $VERSION.$PATCHLEVEL.$SUBLEVEL${EXTRAVERSION}" diff --git a/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-pie-option.patch b/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-pie-option.patch new file mode 100644 index 000000000000..ff539bc0ffb4 --- /dev/null +++ b/sys-devel/uclibc-buildroot/files/uClibc-0.9.26-pie-option.patch @@ -0,0 +1,18 @@ +--- extra/Configs/Config.in.orig 2004-01-03 09:04:12.000000000 +0930 ++++ extra/Configs/Config.in 2004-01-16 02:17:58.226162576 +0930 +@@ -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/sys-devel/uclibc-buildroot/metadata.xml b/sys-devel/uclibc-buildroot/metadata.xml new file mode 100644 index 000000000000..0548674d6b4e --- /dev/null +++ b/sys-devel/uclibc-buildroot/metadata.xml @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<herd>embedded</herd> +<maintainer> + <email>dragonheart@gentoo.org</email> + <name>Primary Maintainer</name> +</maintainer> +</pkgmetadata> diff --git a/sys-devel/uclibc-buildroot/uclibc-buildroot-20040131.ebuild b/sys-devel/uclibc-buildroot/uclibc-buildroot-20040131.ebuild new file mode 100644 index 000000000000..6d2c745f83f7 --- /dev/null +++ b/sys-devel/uclibc-buildroot/uclibc-buildroot-20040131.ebuild @@ -0,0 +1,496 @@ +# Copyright 1999-2004 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-devel/uclibc-buildroot/uclibc-buildroot-20040131.ebuild,v 1.1 2004/02/01 06:55:03 pebenito Exp $ + +inherit eutils crosscompile + +# Derived from gcc-3_3.mk and binutils.mk +GCCVER=3.3.2 +BINUTILSVER=2.14.90.0.6 +UCLIBCVER=0.9.26 +BUSYBOXVER=1.00-pre6 +TINYLOGINVER=1.4 + +DESCRIPTION="Embedded root file system" +HOMEPAGE="http://www.uclibc.org/" +SRC_URI="mirror://gnu/gcc/releases/gcc/gcc-${GCCVER}/gcc-${GCCVER}.tar.bz2 + http://dev.gentoo.org/~dragonheart/buildroot-${PV}.tar.bz2 + mirror://kernel/linux/devel/binutils/binutils-${BINUTILSVER}.tar.bz2 + mirror://kernel/linux/libs/uclibc/toolchain/kernel-headers-2.4.21.tar.bz2 + mirror://kernel/linux/libs/uclibc/uClibc-${UCLIBCVER}.tar.bz2 + nls? ( mirror://kernel/linux/libs/uclibc/uClibc-locale-030818.tgz ) + nommu? ( mirror://kernel/linux/libs/uclibc/toolchain/elf2flt-20030620.tar.bz2 ) + debug? ( http://www.busybox.net/downloads/busybox-${BUSYBOXVER}.tar.bz2 ) + debug? ( http://tinylogin.busybox.net/downloads/tinylogin-${TINYLOGINVER}.tar.bz2 ) + softfloat? ( mirror://debian/pool/main/libf/libfloat/libfloat_990616.orig.tar.gz ) + softfloat? ( mirror://debian/pool/main/libf/libfloat/libfloat_990616-3.diff.gz )" + +# TODO pregen local is only x86 +#nls? ( x86? ( mirror://kernel/linux/libs/uclibc/uClibc-locale-030818.tgz ) ) +# +# nested SRC_URI are not supported until portage-2.0.50pre19 bug #16159 + +# Note: buildroot doesn't exist on mirror://gentoo yet - have to download the cvs and self pack + +# for testing only +RESTRICT="nomirror" + +LICENSE="LGPL-2" + +# +# Since cross compilers require different slots +# +# NOTE - cross-setslot is for applications not compilers +# +# "crosstarget" from crosscompile.eclass is equal to below +if [ -n "${CCHOST}" ] && [ "${CHOST}" != "${CCHOST}" ]; +then + if [ -n "${TARGET_ARCH}" ] + then + SLOT="${TARGET_ARCH}-${CCHOST}" + else + SLOT="${CCHOST}" + fi +else + if [ -n "${TARGET_ARCH}" ] + then + SLOT="${TARGET_ARCH}" + else + SLOT="0" + fi +fi + +IUSE="nls ipv6 debug nommu fullrpc pie softfloat" + +# Local use flags +# nommu = No memory management unit on target architecture +# fullrpc = defines xdr functions and some lesser used rpc stuff. Required for NFS +# pie = enforce no text relocation support in uClibc (x86 only) +# softfloat = software floating point calculations + + +# There was some comment some that alpha may be broken although I don't know. +# TODO check these: ~ppc ~mips ~arm ~alpha +KEYWORDS="~x86" + +# TODO maybe a few more... +DEPEND="dev-lang/perl + sys-devel/gcc + sys-libs/glibc + >=sys-apps/sed-4 + sys-apps/grep + sys-apps/findutils + app-arch/tar + app-arch/gzip + sys-apps/coreutils + sys-devel/patch + sys-devel/gettext" + +# no I haven't checked every virtual/glibc instead of sys-libs/glibc - will check it on itself if +# time/curiosity permits. + +RDEPEND="" + +PROVIDE="virtual/glibc" + +S=${WORKDIR}/buildroot + + +# MAKEOPTS="${MAKEOPTS} -j1" + +uclibc_var_setup() { + + einfo "You can set the TARGET_ARCH env varible to secify" + einfo "the target architecture for the uclibc (cross-)compiler" + einfo "" + einfo "Examples: i386,arm,mips,mipsel" + + TARGETARCH=${TARGET_ARCH} + + if [ -z "${TARGETARCH}" ]; then + # extract out of /etc/embedded/uClibc.conf if exists + if [ -f /etc/embedded/uClibc.conf ]; then + # TODO replace with sed to elminate quotes + local ARCHCOM=$(grep '^TARGET_ARCH=' /etc/embedded/uClibc.conf) + TARGETARCH=${ARCHCOM:12} + else + TARGETARCH=$(extract-arch `/bin/uname -m`) + fi + else + TARGETARCH=$(extract-arch ${TARGETARCH}) + fi + + # The crosscompile.eclass isn't the definitive + # authority on what uclibc can compile to. + + if [ "${TARGETARCH}" != "unknown" ]; then + einfo "" + einfo "Architecture for ${TARGETARCH}" + else + ewarn "Bad architecture <${TARGET_ARCH}>??? attempting anyway" + # Do anyway?? + TARGETARCH=${TARGET_ARCH} + fi + UCLIBCDIR=${S}/build_${TARGETARCH}/uClibc-${UCLIBCVER} +} + +uclibc_config_option() { + #[ "$2" = "" ] && return 1 + #case $1 in + # y) /bin/sed -i -e "s:.*$2.*:$2=y:g" .config;; + # n) /bin/sed -i -e "s:.*$2.*:$2=n:g" .config;; + # *) return 1;; + #esac + /bin/sed -i -e "s:#.* $2 .*:$2=$1:g" \ + -e "s:^$2=.*:$2=$1:g" .config + + # TODO line below should be unnecessary + #echo $2=$1 >> .config + + conf=`grep -E ^$2= .config` + if [ -z "${conf}" ]; then + echo $2=$1 >> .config + einfo $2=$1 + else + einfo $conf + fi +} + + +src_unpack() { + uclibc_var_setup + unpack buildroot-${PV}.tar.bz2 + + cd ${S} + + [ `use pie` && TARGETARCH!="i386" ] && die "pie use flag can only be used on i386 architectures" + + sed -i -e "s/^ARCH:=\(.*\)/#ARCH:=\1/g" Makefile + sed -i -e "s/^#ARCH:=\(i386\)/ARCH:=${TARGETARCH}\n#ARCH:=\1/1" Makefile + + sed -i \ + -e "s#^USE_UCLIBC_SNAPSHOT:=.*#USE_UCLIBC_SNAPSHOT:=false#" \ + -e "s#^USE_BUSYBOX_SNAPSHOT:=.*#USE_BUSYBOX_SNAPSHOT:=false#" \ + -e "s#^DL_DIR:=.*#DL_DIR:=${DISTDIR}#" \ + -e "s#^WGET:=.*#WGET:=/bin/true#" \ + -e 's#tar #tar --no-same-owner #' \ + -e "s#^STAGING_DIR=.*#STAGING_DIR=${S}/staging_dir#" \ + -e "s/^#JLEVEL=.*/JLEVEL=${MAKEOPTS}/" \ + -e 's#^TARGETS+=.*root##' \ + -e 's#TARGETS+=busybox.*##' \ + -e 's#INSTALL_LIBSTDCPP:=.*#INSTALL_LIBSTDCPP:=false#' \ + Makefile + +# INSTALL_LIBSTDCPP disabled for testing only + + + use softfloat && sed -i -e "s/^SOFT_FLOAT:=.*/SOFT_FLOAT:=true/" Makefile \ + || sed -i -e "s/^SOFT_FLOAT:=.*/SOFT_FLOAT:=false/" Makefile + + + #Version fix for busybox + # + #sed -i -e "s#^BUSYBOX_DIR:=\(.*\)/busybox.*#BUSYBOX_DIR:=\1/busybox-${BUSYBOXVER}#" \ + # -e "s#^BUSYBOX_SOURCE:=busybox-.*#BUSYBOX_SOURCE:=busybox-${BUSYBOXVER}.tar.gz#" \ + # -e "s#^BUSYBOX_UNZIP.*#BUSYBOX_UNZIP:=gzcat#" make/busybox.mk + + + # Tinylogin fix. + sed -i -e "s#^USE_TINYLOGIN_SNAPSHOT=.*#USE_TINYLOGIN_SNAPSHOT=false#" make/tinylogin.mk + +# TODO (maybe?) fix HOSTARCH:= in Makefile + + cat << EOF >> Makefile + +# ADDED BY the uClibc-buildroot - ebuild. + +patched: \$(LINUX_DIR)/.unpacked \$(BUILD_DIR) \ + \$(STAGING_DIR) \$(TARGET_DIR) \$(TOOL_BUILD_DIR) \ + \$(GCC_DIR)/.patched \$(BINUTILS_DIR)/.patched \ + \$(UCLIBC_DIR)/.unpacked + +# \$(TOOL_BUILD_DIR) \ +# +#busybox-defconf: +# \$(MAKE) CC=\$(TARGET_CC) CROSS="\$(TARGET_CROSS)" -C \$(BUSYBOX_DIR) defconfig +# touch \$(BUSYBOX_DIR)/.configured + +#busybox-oldconf: +# cp \$(BUSYBOX_CONFIG) \$(BUSYBOX_DIR)/Config.h +# \$(MAKE) CC=\$(TARGET_CC) CROSS="\$(TARGET_CROSS)" -C \$(BUSYBOX_DIR) oldconfig +# touch \$(BUSYBOX_DIR)/.configured + +uclibc-defconfig: + touch \$(UCLIBC_DIR)/.configured + +# \$(MAKE) -C \$(UCLIBC_DIR) HAVE_DOT_CONFIG=y headers shared + +gcchacks: \$(GCC_DIR)/.gcc3_3_build_hacks + + +#TO FINISH + +all-compile: uclibc-defconfig \$(BINUTILS_DIR1)/binutils/objdump \ + \$(GCC_BUILD_DIR1)/.compiled + +extras-compile: \$(TINYLOGIN_DIR)/tinylogin + \$(MAKE) CC=\$(TARGET_CC) CROSS="\$(TARGET_CROSS)" PREFIX="\$(TARGET_DIR)" \ + -C \$(BUSYBOX_DIR) + +all-install: \$(STAGING_DIR) \$(TARGET_DIR) \ + \$(STAGING_DIR)/lib/libc.a \$(STAGING_DIR)/bin/\$(ARCH)-linux-gcc + \$(MAKE) -C \$(UCLIBC_DIR) PREFIX=\$(STAGING_DIR) install_dev + +extras-install: \$(TARGET_DIR)/bin/busybox \$(TARGET_DIR)/bin/tinylogin + + +EOF + + # "cp -a" implies --preserve=ownership which is blocked by sandbox + + sed -i -e 's#tar #tar --no-same-owner #' \ + -e 's#cp -a#cp --preserve=mode -dPR#g' \ + make/*.mk + + # Stop uclib.mk clobbering our config + sed -i -e 's#cp.*config#/bin/true#g' make/uclibc.mk + + emake SED="/bin/sed -i -e" patched || die "failed to patch uclibc buildroot" + + # these hacks affect the search path of the uclibc-toolchain to prevent + # leakage of gcclibs into the target + +# sed -i -e \ +#"/DIR2)\/\.configured/,/DIR2)\/.configured/ s/--\(.*\)=\$(STAGING_DIR)/--\1=\/usr\/${TARGETARCH}-uclibc/g" \ +#-e "/DIR2)\/\.installed:/,/\.installed/ s/\$(MAKE)/\$(MAKE) DESTDIR=\$(STAGING_DIR)/" \ +#-e 's#\$(STAGING_DIR)/lib/\(libstdc++.*\)# $(GCC_BUILD_DIR2)/$(ARCH)-linux/libstdc++-v3/src/.libs/\1#' \ +# make/gcc-uclibc-3.3.mk + + #emake SED="/bin/sed -i -e" STAGING_DIR=/usr/${TARGETARCH}-uclibc-linux gcchacks + + sed -i -e 's#cp -fa#cp --preserve=mode -dPRf#g' ${UCLIBCDIR}/Makefile + + cd ${UCLIBCDIR} + local patches="uClibc-0.9.26-Makefile.patch uClibc-${PV}-pie-option.patch" + + for patch in ${patches} ; do + [ -f ${FILESDIR}/${UCLIBCVER}/${patch} ] && epatch ${FILESDIR}/${UCLIBCVER}/${patch} + done + + sed -i -e "s#^LOCALE_DATA_FILENAME:=#LOCALE_DATA_FILENAME:=${DISTDIR}/#" \ + -e "s#^WGET:=.*#WGET:=/bin/true#" Makefile +} + +src_compile() { + uclibc_var_setup + export SED="/bin/sed -i -e" + emake CROSS= host-sed || die "host-sed make failed" + + use nls && sed -i -e "s/^ENABLE_LOCALE.*/ENABLE_LOCALE:=true/" Makefile \ + || sed -i -e "s/^ENABLE_LOCALE.*/ENABLE_LOCALE:=false/" Makefile + + local uconfig; + use nls && uconfig="sources/uClibc.config-locale" || uconfig="sources/uClibc.config" + + cd ${UCLIBCDIR} + + + # restore last config + if [ -f /etc/embedded/uClibc.config ]; then + cp /etc/embedded/uClibc.config ${uconfig} + else + # or make the default with a few changes + emake defconfig || die "Could not make uclibc default config" + + uclibc_config_option n MALLOC_GLIBC_COMPAT + uclibc_config_option y DO_C99_MATH + uclibc_config_option y UCLIBC_HAS_RPC + uclibc_config_option n UCLIBC_HAS_CTYPE_UNSAFE + uclibc_config_option y UCLIBC_HAS_CTYPE_CHECKED + uclibc_config_option y UCLIBC_HAS_WCHAR + uclibc_config_option y UCLIBC_HAS_HEXADECIMAL_FLOATS + uclibc_config_option y UCLIBC_HAS_GLIBC_CUSTOM_PRINTF + uclibc_config_option y UCLIBC_HAS_FOPEN_EXCLUSIVE_MODE + uclibc_config_option y UCLIBC_HAS_GLIBC_CUSTOM_STREAMS + uclibc_config_option y UCLIBC_HAS_PRINTF_M_SPEC + uclibc_config_option y UCLIBC_HAS_FTW + uclibc_config_option y UNIX98PTY_ONLY + uclibc_config_option n UCLIBC_HAS_TZ_FILE_READ_MANY + uclibc_config_option y UCLIBC_HAS_LFS + fi + + /bin/sed -i -e 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(TARGETARCH)=y,g' \ + -e 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(TARGETARCH)\",g' \ + -e "s,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"${WORKDIR}/linux\"," \ + -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \ + -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \ + -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \ + -e 's,^.*UCLIBC_HAS_LFS.*,UCLIBC_HAS_LFS=y,g' .config + + if [ `use debug` ]; then + uclibc_config_option y DODEBUG + uclibc_config_option y PTHREADS_DEBUG_SUPPORT + # Other possibe options for debug use flag + # DOASSERTS + # SUPPORT_LD_DEBUG + # SUPPORT_LD_DEBUG_EARLY + # PTHREADS_DEBUG_SUPPORT + else + uclibc_config_option n DODEBUG + uclibc_config_option n PTHREADS_DEBUG_SUPPORT + fi + + [ `use ipv6` ] && uclibc_config_option y UCLIBC_HAS_IPV6 || \ + uclibc_config_option n UCLIBC_HAS_IPV6 + + [ `use fullrpc` ] && uclibc_config_option y UCLIBC_HAS_FULL_RPC || \ + uclibc_config_option n UCLIBC_HAS_FULL_RPC + + [ `use nommu` ] && uclibc_config_option n UCLIBC_HAS_MMU || \ + uclibc_config_option n UCLIBC_HAS_MMU + + + # Thanks peter for pointing this one out. + #[ `use etdyn` ] && uclibc_config_option n CONFIG_PROFILING + + if [ `use pie` ]; then + uclibc_config_option y UCLIBC_PIE_SUPPORT + uclibc_config_option y UCLIBC_COMPLETELY_PIC + else + uclibc_config_option n UCLIBC_PIE_SUPPORT + uclibc_config_option n UCLIBC_COMPLETELY_PIC + fi + + [ `use propolice` ] && uclibc_config_option y UCLIBC_PROPOLICE || \ + uclibc_config_option n UCLIBC_PROPOLICE + + if [ `use softfloat` ]; then + uclibc_config_option n HAS_FPU + uclibc_config_option y UCLIBC_HAS_FLOATS + uclibc_config_option y UCLIBC_HAS_SOFT_FLOAT + #else + #TODO for completeness + fi + + + uclibc_config_option n UCLIBC_PREGENERATED_LOCALE_DATA + uclibc_config_option n UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA + + if [ `use nls` ]; then + uclibc_config_option y UCLIBC_HAS_LOCALE + + #pregen is for i386 architectures only + if [ ${TARGETARCH}=="i386" ]; then + uclibc_config_option y UCLIBC_PREGENERATED_LOCALE_DATA + uclibc_config_option y UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA + cp ${DISTDIR}/uClibc-locale-030818.tgz ${UCLIBCDIR}/extra/locale + else + uclibc_config_option n UCLIBC_PREGENERATED_LOCALE_DATA + uclibc_config_option n UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA + pushd extra/locale + find charmaps -name "*.pairs" > codesets.txt + emake clean all || die "Could not generate codepages" + popd + fi + uclibc_config_option y UCLIBC_HAS_XLOCALE + uclibc_config_option y UCLIBC_HAS_HEXADECIMAL_FLOATS + uclibc_config_option y UCLIBC_HAS_GLIBC_DIGIT_GROUPING + uclibc_config_option y UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING + uclibc_config_option y UCLIBC_HAS_GETTEXT_AWARENESS + # lots of stuff from uclibc.spec - TODO LATER + else + uclibc_config_option n UCLIBC_HAS_LOCALE + uclibc_config_option n UCLIBC_PREGENERATED_LOCALE_DATA + uclibc_config_option n UCLIBC_DOWNLOAD_PREGENERATED_LOCALE_DATA + uclibc_config_option n UCLIBC_HAS_XLOCALE + uclibc_config_option n UCLIBC_HAS_HEXADECIMAL_FLOATS + uclibc_config_option n UCLIBC_HAS_GLIBC_DIGIT_GROUPING + uclibc_config_option n UCLIBC_HAS_SCANF_LENIENT_DIGIT_GROUPING + uclibc_config_option n UCLIBC_HAS_GETTEXT_AWARENESS + fi + + + cd ${S} + emake -j1 || die "Could not make uclibc-buildroot" + + if [ -n "`use debug`" ]; then + if [ -f /etc/embedded/busybox.config ]; then + emake BUSYBOX_CONFIG=/etc/embedded/busybox.config busybox- \ + || "Error making busybox old config" + else + emake busybox || "Error making busybox default config" + fi + + [ -f /etc/embedded/tinylogin.config ] && \ + cp /etc/embedded/tinylogin.config build_${TARGETARCH}/tinylogin-${TINYLOGINVER}/Config.h + + emake extras-compile + fi + cd ${UCLIBCDIR} + local patches="uClibc-${PV}-pie-option.patch" + + for patch in ${patches} ; do + [ -f ${FILESDIR}/${UCLIBCVER}/${patch} ] && epatch ${FILESDIR}/${UCLIBCVER}/${patch} + done +} + +src_install() { + uclibc_var_setup + # later once compile/install separation is done + #emake all-installed + + use debug && emake extras-installed + + local BINPREFIX=${TARGETARCH}-linux-uclibc + + #rm -rf ${S}staging_dir/usr/include ${S}staging_dir/usr/lib + rm -f ${S}/staging_dir/bin/sed + + dodir /usr/${BINPREFIX} + + cd staging_dir + + # there's probably a better way to do this but it was giving me the + # sh?ts trying to find it. usr/bin got mapped to bin in most cases. + mv info share + + tar -cf - lib/ usr/bin/ bin/ ${BINPREFIX} ${TARGETARCH}-linux \ + include/ | \ + tar --no-same-owner -C ${D}/usr/${BINPREFIX} -xf - + + tar -cf - usr/${BINPREFIX} | \ + tar --no-same-owner -C ${D} -xf - + + doman `find man -type f -name "*.[0-9]"` + + # gcc-config stuff + local gccconfigfile=${D}/etc/env.d/gcc/${ARCH}-uclibc-${UCLIBCVER} + + dodir /etc/env.d/gcc + echo "PATH=\"/usr/${BINPREFIX}/usr/bin\"" > ${gccconfigfile} + echo "ROOTPATH=\"/usr/${BINPREFIX}/usr/bin\"" >> ${gccconfigfile} + echo "LDPATH=\"/usr/${BINPREFIX}/lib\"" >> ${gccconfigfile} + echo 'CC="gcc"' >> ${gccconfigfile} + echo 'CXX="g++"' >> ${gccconfigfile} + + # warning- consistancy with Makefile uncertian. + #use softfloat && ARCH="${TARGETARCH}_nofpu" + + # rootfs (tempory for testing purposes) + dodir /var/lib/rootfs_${TARGETARCH} + + cp --preserve=mode -dPRf ${S}/build_${TARGETARCH}/root/* ${D}/var/lib/rootfs_${TARGETARCH} + + # Save uclibc/busybox/tinylogin config + + dodir /etc/embedded + cp ${S}/.config ${D}/etc/embedded/uClibc.config + + [ -f ${S}/build_${ARCH}/busybox-${BUSYBOXVER}/Config.h ] && \ + cp ${S}/build_${ARCH}/busybox-${BUSYBOXVER}/Config.h ${D}/etc/embedded/busybox.config + + [ -f ${S}/build_${ARCH}/tinylogin-${TINYLOGINVER}/Config.h ] && \ + cp ${S}/build_${ARCH}/tinylogin-${TINYLOGINVER}/Config.h ${D}/etc/embedded/tinylogin.config + + +} |