ChangeLog

# ChangeLog for dev-libs/klibc
# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.59 2008/06/26 18:23:46 robbat2 Exp $

26 Jun 2008; Robin H. Johnson
-files/klibc-1.2.1-nostdinc-flags.patch, -files/klibc-1.2.4-kbuild.patch,
-files/klibc-1.4.7-nostdinc-flags.patch, -files/klibc-1.4.9-mips32.patch,
-files/klibc-1.4.13-resumelib.patch, -files/klibc-1.4.13-types.h.patch,
-klibc-1.2.1-r1.ebuild, -klibc-1.2.1-r2.ebuild, -klibc-1.4.12.ebuild,
-klibc-1.4.13.ebuild, -klibc-1.5.ebuild, -klibc-1.5.7.ebuild,
-klibc-1.5.7-r1.ebuild, -klibc-1.5.7-r2.ebuild:
Trim old ebuilds and patches.

*klibc-1.5.11 (26 Jun 2008)

26 Jun 2008; Robin H. Johnson
+files/klibc-1.5.11-klibcasmarch.patch,
+files/klibc-1.5.11-x86_64-io.h-return.diff, +klibc-1.5.11.ebuild:
Version bump per bug #217738, and also fix x86_64 io.h header per bug
#229525.

10 Mar 2008; Steve Dibb klibc-1.5.8.ebuild:
amd64 stable, bug 208131

14 Feb 2008; nixnut klibc-1.5.8.ebuild:
Stable on ppc wrt bug 208131

13 Feb 2008; Dawid Węgliński klibc-1.5.8.ebuild:
Stable on x86 (bug #208131)

*klibc-1.5.8 (15 Jan 2008)

15 Jan 2008; Robin H. Johnson
+files/klibc-1.5.7-strip-fix-dash-s.patch, +klibc-1.5.8.ebuild:
Version bump, and fix bug 201006.

21 Dec 2007; nixnut klibc-1.5.7-r2.ebuild:
Stable on ppc wrt bug 195443

*klibc-1.5.7-r2 (14 Nov 2007)

14 Nov 2007; Robin H. Johnson +klibc-1.5.7-r2.ebuild:
This revision fixes compiling of v86d (bug 198937) due to a missing patch,
and splashutils due to a broken asm symlink that was installed.

14 Nov 2007; Robin H. Johnson klibc-1.5.7-r1.ebuild:
Bug #199048, we need to ignore KBUILD_OUTPUT.

*klibc-1.5.7-r1 (12 Nov 2007)

12 Nov 2007; Robin H. Johnson
+files/klibc-1.5-klibcasmarch.patch, +klibc-1.5.7-r1.ebuild:
Bug #196521, some arches have a shared asm-ARCH directory in the kernel
sources, and klibc is not aware of this.

*klibc-1.5.7 (12 Nov 2007)

12 Nov 2007; Robin H. Johnson
+files/klibc-1.5-nostrip.patch, +files/klibc-1.5-sigaction.patch,
+klibc-1.5.7.ebuild:
Bug #190113, add biarch support for ppc64-32ul et al. Redo of a lot of the
handling.

04 Nov 2007; Christian Heim metadata.xml:
Removing myself as the maintainer.

21 Oct 2007; Steve Dibb klibc-1.5.ebuild:
amd64 stable

14 Oct 2007; Mike Frysinger klibc-1.5.ebuild:
Add back in RESTRICT=strip for az.

11 Oct 2007; Christian Faulhammer klibc-1.5.ebuild:
stable x86, bug 195443

02 Jul 2007; Piotr Jaroszyński klibc-1.1.ebuild,
klibc-1.2.1-r1.ebuild, klibc-1.2.1-r2.ebuild, klibc-1.4.12.ebuild,
klibc-1.4.13.ebuild:
(QA) RESTRICT clean up.

13 Jun 2007; Christian Heim klibc-1.5.ebuild:
Fixing cross compilation, thanks to Michal Januszewski in #181560.

*klibc-1.5 (17 May 2007)

17 May 2007; Christian Heim +klibc-1.5.ebuild:
Version bump, finally at klibc-1.5.

13 May 2007; Christian Heim klibc-1.4.13.ebuild:
Really fix the permission problem (#178053) and also fix the sandbox
violation (#178208 - thanks to Roland Tapken, note to self: always use ${D}
in src_install).

12 May 2007; Christian Heim klibc-1.4.13.ebuild:
Fixing the permissions bug (#178053 - thanks to Tobias Sager gmx.ch>), hopefully fixing any further issues.

12 May 2007; Daniel Drake metadata.xml:
Move from kernel to kernel-misc herd

07 May 2007; Chris Gianelloni klibc-1.4.13.ebuild:
Stable on amd64/ppc/x86 for splashutils.

10 Feb 2007; Christian Heim klibc-1.2.1-r2.ebuild:
Backporting the types.h fix from 1.4.33 to 1.2.1-r2, making current stable
work for kernel >=2.6.19. Quoting fixes. Backporting the QA_EXECSTACK stuff
from 1.4.33.

09 Feb 2007; Christian Heim
+files/klibc-1.4.13-types.h.patch, klibc-1.4.13.ebuild:
Quoting fixes, adding the -types.h patch suggested by Alon in #165472.

20 Jan 2007; Christian Heim
-files/klibc-1.1.16-mips-ldpaths.patch, -files/klibc-1.1.16-mips32.patch,
+files/klibc-1.4.13-resumelib.patch, metadata.xml,
-klibc-1.1.16-r1.ebuild, klibc-1.4.13.ebuild:
Remove klibc-1.1.16 (its slacking, no distfiles either upstream nor on
Gentoo mirrors), fixing compilation of 1.4.13 against 2.6.19 (#157618 -
thanks to Mike Benson and all the others), putting
dev-libs/klibc with the kernel herd.

03 Sep 2006; Michael Hanselmann klibc-1.2.1-r2.ebuild:
Stable on ppc.

*klibc-1.4.13 (27 Jul 2006)

27 Jul 2006; Martin Schlemmer +klibc-1.4.13.ebuild:
Update version.

*klibc-1.4.12 (25 Jul 2006)

25 Jul 2006; Martin Schlemmer +klibc-1.4.12.ebuild:
Update version.

*klibc-1.4.11 (19 Jul 2006)

19 Jul 2006; Martin Schlemmer
+files/klibc-1.4.11-interp-flags.patch, +klibc-1.4.11.ebuild:
New testing release.

18 Jul 2006; Chris Gianelloni klibc-1.2.1-r2.ebuild:
Stable on amd64 wrt bug #139330.

16 Jul 2006; Joshua Jackson klibc-1.2.1-r2.ebuild:
stable x86; bug #139330

12 Jul 2006; Martin Schlemmer klibc-1.4.9.ebuild:
Add debug USE flag to just enable verbose output during build.

09 Jul 2006; Martin Schlemmer klibc-1.2.1-r2.ebuild,
klibc-1.4.9.ebuild:
Fix build issues on ppc, bug #130175.

*klibc-1.4.9 (08 Jul 2006)

08 Jul 2006; Martin Schlemmer
+files/klibc-1.4.8-dash-flags.patch, +files/klibc-1.4.9-mips32.patch,
+klibc-1.4.9.ebuild:
Update version. Try to do something about executable stack. Add mips n32
patch again. Disable the stdinc patch as it seems to support
-fno-stack-protector.

*klibc-1.4.8 (07 Jul 2006)

07 Jul 2006; Martin Schlemmer
+files/klibc-1.4.7-nostdinc-flags.patch, +klibc-1.4.8.ebuild:
New release for testing.

*klibc-1.2.1-r2 (07 Jul 2006)

07 Jul 2006; Martin Schlemmer
+files/klibc-1.2.4-kbuild.patch, +klibc-1.2.1-r2.ebuild:
Fix building with KBUILD_OUTPUT set, bug #139330. Also fix manpage
installation path, bug #122173. Also multilib related fixes.

01 Jul 2006; Lars Weiler klibc-1.2.1-r1.ebuild:
Stable on ppc; bug #130175.

27 Apr 2006; Marien Zwart
files/digest-klibc-1.0.14-r1, files/digest-klibc-1.1,
files/digest-klibc-1.1.1, files/digest-klibc-1.1.16,
files/digest-klibc-1.1.16-r1, Manifest:
Fixing SHA256 digest, pass four

09 Feb 2006; Martin Schlemmer klibc-1.2.1-r1.ebuild:
Fix build logic for different KBUILD_OUT, bug #122173. Dash build still
fails with it set though, so need to wait for upstream to fix it.

*klibc-1.2.1-r1 (07 Feb 2006)

07 Feb 2006; Martin Schlemmer
+files/klibc-1.2.1-nostdinc-flags.patch, +klibc-1.2.1-r1.ebuild:
Export the NOSTDINC_FLAGS to ensure -nostdlib is passed, bug #120678.

*klibc-1.2.1 (04 Feb 2006)

04 Feb 2006; Martin Schlemmer +klibc-1.2.1.ebuild:
New release.

26 Jan 2006; Joshua Kinard
+files/klibc-1.1.16-mips-ldpaths.patch, +files/klibc-1.1.16-mips32.patch,
klibc-1.1.1.ebuild, klibc-1.1.16.ebuild, klibc-1.1.16-r1.ebuild:
Build fixes for mips - force 32bit build on mips64 systems if not using n32
and fix a linker path bug for mips.

*klibc-1.1.16-r1 (22 Jan 2006)

22 Jan 2006; Martin Schlemmer +klibc-1.1.16-r1.ebuild:
Fix broken symlink creation.

21 Jan 2006; Lars Weiler klibc-1.1.16.ebuild:
Stable on ppc; bug #112742.

*klibc-1.1.16 (20 Jan 2006)

20 Jan 2006; Martin Schlemmer +klibc-1.1.16.ebuild:
New version.

02 Jan 2006; Joshua Kinard klibc-1.1.ebuild:
Bump to stable for getdvhoff on mips.

*klibc-1.1.1 (10 Nov 2005)

10 Nov 2005; Martin Schlemmer +klibc-1.1.1.ebuild:
New release.

18 Sep 2005; Joshua Kinard +files/klibc-1.1-mips32.patch,
klibc-1.1.ebuild:
Added a patch to allow klibc to build properly on mips systems w/ 64bit
kernel/32bit userland, and marked 1.1 ~mips.

*klibc-1.1 (02 Sep 2005)

02 Sep 2005; Martin Schlemmer +klibc-1.1.ebuild:
New version.

*klibc-1.0.14-r1 (26 Aug 2005)

26 Aug 2005; Martin Schlemmer
+files/klibc-1.0.14-nostdlib.patch, +klibc-1.0.14-r1.ebuild:
Enable building on hardened systems, bug #103437.

29 Jun 2005; David Holm klibc-1.0.14.ebuild:
Added to ~ppc.

*klibc-1.0.14 (28 Jun 2005)

28 Jun 2005; Martin Schlemmer +klibc-1.0.14.ebuild:
Update version.

*klibc-1.0.8 (04 May 2005)

04 May 2005; Martin Schlemmer +klibc-1.0.8.ebuild:
Update version. Add KV_OUT_DIR support, bug #88072.

13 Mar 2005; Martin Schlemmer klibc-1.0.3.ebuild:
Add /usr/lib/klibc to PRELINK_PATH_MASK.

11 Mar 2005; Martin Schlemmer klibc-1.0.3.ebuild:
Fixup gunzip/zcat hardlinks of gzip becoming copies. Add perl to DEPEND and
RDEPEND, as its needed during build, and afterwards for klcc wrapper. Add
pkg_postinst() override for linux-mod eclass, as we do not install modules.

10 Mar 2005; Martin Schlemmer files/klibc.m4:
Update m4 macro.

*klibc-1.0.3 (10 Mar 2005)

10 Mar 2005; Martin Schlemmer +klibc-1.0.3.ebuild:
Update version.

10 Mar 2005; Martin Schlemmer
+files/klibc-1.0-makeklcc-empty-args.patch, klibc-1.0.ebuild:
Patch makeklcc.pl to not generate '' arrays if they are empty, else we get
the issue where '' is passed to ld, etc, and they fail with cannot find
file.

*klibc-1.0 (09 Mar 2005)

09 Mar 2005; Martin Schlemmer +metadata.xml,
+files/klibc.m4, +klibc-1.0.ebuild:
Initial version

Manifest

AUX klibc-1.1-mips32.patch 670 RMD160 ecab014d68b65837eb6088c21d95be0c23170cfc SHA1 68b24422a59e4479c636dfd4fcd56be06dc01db3 SHA256 42d127d2d5348b7856d33b7ffce986d49c7adbef82cf2bb34aa06a022fabad4c
AUX klibc-1.4.11-interp-flags.patch 494 RMD160 71081dc5eae8fff2adc43873f6b447f9b37a2432 SHA1 ecdea82ccbd77c63f8a65443fd64b65325869627 SHA256 ef8c05d059bc0185b8b68ea42e660fa13ddb55e9653b10fbfdabd77dea7abe2a
AUX klibc-1.5-klibcasmarch.patch 1109 RMD160 7c0b30335346b219db0f68427c76cf6113eabce2 SHA1 2524c67b74b42541a7c6f446ec5337768a292668 SHA256 7a84dacc12b93a58ac70dda11b977183c48ebc39fd101b0dbd0c16d3f0b5293e
AUX klibc-1.5-nostrip.patch 1 RMD160 c0da025038ed83c687ddc430da9846ecb97f3998 SHA1 adc83b19e793491b1c6ea0fd8b46cd9f32e592fc SHA256 01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b
AUX klibc-1.5-sigaction.patch 928 RMD160 00d04da5dfdf667d2ff46491212d98047adac925 SHA1 c996533744af2256c75fb7ab715a3942bf3c2768 SHA256 bd50f00b36fb4425c6921224bde5862c05fa6271c984bfadd94284cf3f5973e5
AUX klibc-1.5.11-klibcasmarch.patch 1225 RMD160 bc339eaa902dcdb30e5487c0c0dbd9e22c5637ec SHA1 80cf59dd4f58745694b5b3088c4d72a9450a7547 SHA256 62ef197d4ed18e64fd64bd228849f9f73d2a4f9593ca0378f86fdba8e66c31f4
AUX klibc-1.5.11-x86_64-io.h-return.diff 770 RMD160 cd44b54eabde1ff75967da37f2195875f7950c58 SHA1 ad20b47634e5069a599dff39e9ce1752537c2705 SHA256 f07c1d238626209693aea4e5fbb9accc5ae122ac603f4fb71fc4b58578d9cf8c
AUX klibc-1.5.7-strip-fix-dash-s.patch 420 RMD160 8dae7b8452fe5328c276fc192cad171d64cce245 SHA1 29acc727bd721259067e73399b6e6516ffdf95c0 SHA256 971cadc28aa362ff76ebfee8187bb6986afb4f3425b70b7200d1aa1c6fd746e7
AUX klibc.m4 3619 RMD160 aee79c8296f375e3614fcf5d97b21ed9e043c719 SHA1 ebe92893215e7d7ec2e44af846c6ce83e7ef7f4b SHA256 02901ef2ca8b320d77b03fab4fa9bef809c11e2e418e7da00aa2c13c4a84dd44
DIST klibc-1.1.tar.bz2 444770 RMD160 d25df89a8468f05e480ea7348c8cfa25aa4a061e SHA1 167832f15b48f0d7eda160eee4b05b9afa446a69 SHA256 42de47159a382d852750e38fe4877ee2f97f2ff4c47e27f3ce512193d31f63e7
DIST klibc-1.5.11.tar.bz2 492789 RMD160 3f32b9ee98dce354110a685c7178ba8fcc9f55f2 SHA1 a5d49f6476ae66b42e0d0ecd55dcb7c02eefc7e4 SHA256 8b38c69e5b851df0634122a3d0d1b8d34284f30d3bf3186c8fceab4d75ebeaef
DIST klibc-1.5.8.tar.bz2 490132 RMD160 870bf1df35c05c2fbac7b1623c2250bed1b39e92 SHA1 db0beb7bf00a97e2ab0ab48f13f1aaea3e402ffe SHA256 b010fd9ea4624f4abc62a0ec93cecae9e9f0a7f856dd678da3fc61cc1d59ca0d
DIST linux-2.6.23.tar.bz2 45488158 RMD160 755690e80751d5de86d260fe05c6eeadde116c4e SHA1 3a186adf13e44415796ab6381aa8979b16a5d5ca SHA256 d4e67c0935ffb2a4158234bff92cc791b83177866009fc9b2214104e0038dbdb
DIST patch-2.6.24-rc7.bz2 9658462 RMD160 18cba35c94c0923b71a64798ad06946b4afc23d2 SHA1 4edc59937ca4157c3ee542f6a0ff204acfa8e7d1 SHA256 dbd8403cc9ad11afb51b8050d6cbda97caec87d1b07c80266b1e4b1f437268a3
EBUILD klibc-1.1.ebuild 4163 RMD160 3bdee15ca33572451ff609634cf178ac3019f6e2 SHA1 7a63688d69a3802da9198c6d7821d0909cbaeb0a SHA256 d28076cc05974dc7c5ef32d9e771d1ce13c9dd7d6cfec98567e3d4724b8d8915
EBUILD klibc-1.5.11.ebuild 7057 RMD160 ae7d7d8cec09e9a1b787d2ea25b3501ebacd9d1e SHA1 f9d3f81fad94ba9f9ec6df2a02070f763b5cc314 SHA256 ca9c7f31dd9b9f13c57be6bdf1523cd8c626136d72bdfd5d3cb6550b427af314
EBUILD klibc-1.5.8.ebuild 6920 RMD160 de5ba665e0baaa105d386bfd3242ea4036569385 SHA1 dc95c9e02959be2b2700d02f35659c8af140d148 SHA256 13bf15851856be9cf1f9bcdbfd48f8daf98efc72aac25f44de3b7b636e0aaf34
MISC ChangeLog 10390 RMD160 24688671002d00a919a21dd9d1c4304c395cdd2c SHA1 4b263ea4f569fcd3e31fd87f75c9ef0274b9436a SHA256 d2ea97235a068fb05bfaaafcfe9ac2a54292701938a63d7b51d66e0f0b779796
MISC metadata.xml 166 RMD160 42fd2b8820fe5c74ccd8bda2141e90fa1b3802d8 SHA1 dd2e6ea8806cfa18885ac2f0dee3e6aceee06fd0 SHA256 8a8cfc597620bb23a385c7d463e7eeab947d58038f7739a58d24fb37fdd0a83f

files

klibc-1.1.ebuild

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-1.1.ebuild,v 1.4 2007/07/02 14:54:32 peper Exp $

inherit eutils linux-mod

export CTARGET=${CTARGET:-${CHOST}}
if [[ ${CTARGET} == ${CHOST} ]] ; then
if [[ ${CATEGORY/cross-} != ${CATEGORY} ]] ; then
export CTARGET=${CATEGORY/cross-}
fi
fi

DESCRIPTION="A minimal libc subset for use with initramfs."
HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc"
SRC_URI="ftp://ftp.kernel.org/pub/linux/libs/klibc/${P}.tar.bz2
ftp://ftp.kernel.org/pub/linux/libs/klibc/Stable/${P}.tar.bz2
ftp://ftp.kernel.org/pub/linux/libs/klibc/Testing/${P}.tar.bz2"
LICENSE="|| ( GPL-2 LGPL-2 )"
KEYWORDS="~amd64 mips ~ppc ~x86"
IUSE=""
RESTRICT="strip"

DEPEND="dev-lang/perl
virtual/linux-sources"
RDEPEND="dev-lang/perl"

if [[ ${CTARGET} != ${CHOST} ]] ; then
SLOT="${CTARGET}"
else
SLOT="0"
fi

is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; }

guess_arch() {
local x
local host=$(echo "${CTARGET%%-*}" | sed -e 's/i.86/i386/' \
-e 's/sun4u/sparc64/' \
-e 's/arm.*/arm/' \
-e 's/sa110/arm/' \
-e 's/powerpc/ppc/')

# Sort reverse so that we will get ppc64 before ppc, etc
for x in $(ls -1 "${S}/include/arch/" | sort -r) ; do
if [[ ${host} == "${x}" ]] ; then
echo "${x}"
return 0
fi
done

return 1
}

pkg_setup() {
# Make sure kernel sources are OK
# (Override for linux-mod eclass)
check_kernel_built
}

src_unpack() {
unpack ${A}

if [[ ! -d /usr/${CTARGET} ]] ; then
echo
eerror "It does not look like your cross-compiler is setup properly!"
die "It does not look like your cross-compiler is setup properly!"
fi

if ! guess_arch &>/dev/null ; then
echo
eerror "Could not guess klibc's ARCH from your CTARGET!"
die "Could not guess klibc's ARCH from your CTARGET!"
fi

kernel_arch=$(readlink "${KV_OUT_DIR}/include/asm" | sed -e 's:asm-::')
if [[ ${kernel_arch} != $(guess_arch) ]] ; then
echo
eerror "Your kernel sources are not configured for your chosen arch!"
eerror "(KERNEL_ARCH=\"${kernel_arch}\", ARCH=\"$(guess_arch)\")"
die "Your kernel sources are not configured for your chosen arch!"
fi

cd ${S}

# Add our linux source tree symlink
ln -snf ${KV_DIR} linux

# set the build directory
echo "KRNLOBJ = ${KV_OUT_DIR}" >> MCONFIG

# We do not want all the nice prelink warnings
# NOTE: for amd64, we might change below to '/usr/$(get_libdir)/klibc',
# but I do not do it right now, as the build system do not support
# the lib64 yet ....
cat > "${S}/70klibc" <<-EOF
PRELINK_PATH_MASK="/usr/lib/klibc"
EOF

# klibc detects mips64 systems as having 64bit userland
# Force them to 32bit userlands instead
epatch ${FILESDIR}/${P}-mips32.patch
}

src_compile() {
if is_cross ; then
einfo "ARCH = \"$(guess_arch)\""
einfo "CROSS = \"${CTARGET}-\""
emake ARCH=$(guess_arch) \
CROSS="${CTARGET}-" || die "Compile failed!"
else
env -u ARCH \
emake || die "Compile failed!"
fi
}

src_install() {
local klibc_prefix

if is_cross ; then
make INSTALLROOT=${D} \
ARCH=$(guess_arch) \
CROSS="${CTARGET}-" \
install || die "Install failed!"

klibc_prefix=$("${S}/${CTARGET}-klcc" -print-klibc-bindir)
else
env -u ARCH \
make INSTALLROOT=${D} install || die "Install failed!"

klibc_prefix=$("${S}/klcc" -print-klibc-bindir)
fi

# Hardlinks becoming copies
dosym gzip "${klibc_prefix}/gunzip"
dosym gzip "${klibc_prefix}/zcat"

if ! is_cross ; then
insinto /usr/share/aclocal
doins ${FILESDIR}/klibc.m4

doenvd ${S}/70klibc

dodoc ${S}/README ${S}/klibc/{LICENSE,CAVEATS}
newdoc ${S}/klibc/README README.klibc
newdoc ${S}/klibc/arch/README README.klibc.arch
docinto ash; newdoc ${S}/ash/README.klibc README
docinto gzip; dodoc ${S}/gzip/{COPYING,README}
docinto ipconfig; dodoc ${S}/ipconfig/README
docinto kinit; dodoc ${S}/kinit/README
fi
}

pkg_postinst() {
# Override for linux-mod eclass
return 0
}

klibc-1.5.11.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-1.5.11.ebuild,v 1.1 2008/06/26 18:18:09 robbat2 Exp $

# Robin H. Johnson , 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="23"
OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}"
PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-rc7"
PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.bz2"
KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.bz2"
SRC_URI="
mirror://kernel/linux/libs/klibc/${P}.tar.bz2
mirror://kernel/linux/libs/klibc/Testing/${P}.tar.bz2
${PATCH_URI}
${KERNEL_URI}"

LICENSE="|| ( GPL-2 LGPL-2 )"
KEYWORDS="~amd64 -mips ~ppc ~sparc ~x86"
SLOT="0"
IUSE="debug n32"

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"

src_unpack() {
unpack linux-${OKV}.tar.bz2 ${P}.tar.bz2
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

# Fixes for sparc and ppc
epatch "${FILESDIR}"/${PN}-1.5-sigaction.patch

# Prevent klibc from prestripping stuff
# epatch "${FILESDIR}"/${P}-nostrip.patch

# Fix the asm-ppc vs. asm-powerpc issue, bug #196521
epatch "${FILESDIR}"/${PN}-1.5.11-klibcasmarch.patch

# Fix usage of -s, bug #201006
epatch "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch

# bug 229525, usr/include/arch/x86_64/sys/io.h has undefined variables
epatch "${FILESDIR}"/${PN}-1.5.11-x86_64-io.h-return.diff
}

# 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 ;;
arm*|sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;;
*) echo defconfig ;;
esac
}

# 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
}

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
}

src_compile() {
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})
unset ABI ARCH # Unset these, because they interfere
unset KBUILD_OUTPUT # we are using a private copy

cd "${KS}"
emake ${defconfig} || die "No defconfig"
emake prepare || die "Failed to prepare kernel sources for header usage"

cd "${S}"

use debug && myargs="${myargs} V=1"

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" \
${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 usr/klibc/README
newdoc usr/klibc/arch/README README.klibc.arch
docinto dash; newdoc usr/dash/README.klibc README
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
}

klibc-1.5.8.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-1.5.8.ebuild,v 1.4 2008/03/10 14:16:00 beandog Exp $

# Robin H. Johnson , 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="23"
OKV="${KV_MAJOR}.${KV_MINOR}.${KV_SUB}"
PKV="${KV_MAJOR}.${KV_MINOR}.$((${KV_SUB}+1))-rc7"
PATCH_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/patch-${PKV}.bz2"
KERNEL_URI="mirror://kernel/linux/kernel/v${KV_MAJOR}.${KV_MINOR}/testing/linux-${OKV}.tar.bz2"
SRC_URI="
mirror://kernel/linux/libs/klibc/${P}.tar.bz2
mirror://kernel/linux/libs/klibc/Testing/${P}.tar.bz2
${PATCH_URI}
${KERNEL_URI}"

LICENSE="|| ( GPL-2 LGPL-2 )"
KEYWORDS="amd64 -mips ppc ~sparc x86"
SLOT="0"
IUSE="debug n32"

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"

src_unpack() {
unpack linux-${OKV}.tar.bz2 ${P}.tar.bz2
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

# Fixes for sparc and ppc
epatch "${FILESDIR}"/${PN}-1.5-sigaction.patch

# Prevent klibc from prestripping stuff
# epatch "${FILESDIR}"/${P}-nostrip.patch

# Fix the asm-ppc vs. asm-powerpc issue, bug #196521
epatch "${FILESDIR}"/${PN}-1.5-klibcasmarch.patch

# Fix usage of -s, bug #201006
epatch "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch
}

# 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 ;;
arm*|sh*) die "TODO: Your arch is not supported by the klibc ebuild. Please suggest a defconfig in a bug." ;;
*) echo defconfig ;;
esac
}

# 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
}

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
}

src_compile() {
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})
unset ABI ARCH # Unset these, because they interfere
unset KBUILD_OUTPUT # we are using a private copy

cd "${KS}"
emake ${defconfig} || die "No defconfig"
emake prepare || die "Failed to prepare kernel sources for header usage"

cd "${S}"

use debug && myargs="${myargs} V=1"

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" \
${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 usr/klibc/README
newdoc usr/klibc/arch/README README.klibc.arch
docinto dash; newdoc usr/dash/README.klibc README
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
}

metadata.xml





kernel-misc