# $Id: klibc-1.5.15-r4.smage2 3200 2009-10-16 11:22:56Z niro $ PNAME="klibc" PVER="1.5.21" PBUILD="r1" PCATEGORIE="dev-libs" STATE="unstable" DESCRIPTION="A minimal libc subset for use with initramfs." HOMEPAGE="http://www.kernel.org/pub/linux/libs/klibc/" DEPEND=">= dev-lang/perl-5" SDEPEND=">= virtual/kernel-sources" SRCFILE="${PNAME}-${PVER}.tar.bz2" SRCDIR="${BUILDDIR}/${PNAME}-${PVER}" # global var: ${LINUX_SOURCES} # location where they are [[ -z ${LINUX_SOURCES} ]] && LINUX_SOURCES="/usr/src/linux" sminclude mtools SRC_URI=( http://www.kernel.org/pub/linux/libs/${PNAME}/Current/${SRCFILE} mirror://${PNAME}/${SRCFILE} mirror://${PNAME}/${PNAME}-1.5.15-mntproc-definitions.patch ) UP2DATE="updatecmd ${HOMEPAGE}/Current/'?C=M;O=A' | lasttarball" src_prepare() { munpack ${SRCFILE} || die cd ${SRCDIR} # mntproc definitions are missing in newer kernels (>=2.6.31) mpatch ${PNAME}-1.5.15-mntproc-definitions.patch || die ln -snf ${LINUX_SOURCES} ${SRCDIR}/linux || die } src_compile() { cd ${SRCDIR} mmake \ ARCH=${ARCH/i*86/i386} \ KLIBCARCH=${ARCH/i*86/i386} \ KLIBCASMARCH=${ARCH/i*86/x86} \ mandir=/usr/share/man \ libdir=/usr/$(mlibdir) \ INSTALLDIR=/usr/$(mlibdir)/klibc \ SHLIBDIR=/$(mlibdir) \ || die } src_install() { cd ${SRCDIR} # needed directories minstalldir /usr/share/aclocal || die mmake \ ARCH=${ARCH/i*86/i386} \ KLIBCARCH=${ARCH/i*86/i386} \ KLIBCASMARCH=${ARCH/[i|x]*86*/x86} \ INSTALLROOT=${BINDIR} \ mandir=/usr/share/man \ libdir=/usr/$(mlibdir) \ INSTALLDIR=/usr/$(mlibdir)/klibc \ SHLIBDIR=/$(mlibdir) \ install || die # remove hardlinks; use symlinks rm ${BINDIR}/usr/$(mlibdir)/klibc/bin/{gunzip,zcat} || die mlink gzip /usr/$(mlibdir)/klibc/bin/gunzip || die mlink gzip /usr/$(mlibdir)/klibc/bin/zcat || die # missing ac-includes minstallfile contrib/klibc.m4 /usr/share/aclocal || die # # broken due the patch # mlink asm-x86 /usr/$(mlibdir)/klibc/include/asm || die # remove broken symlinks if [[ -L ${BINDIR}/usr/$(mlibdir)/klibc/include/asm/asm-${ARCH/i*86/x86} ]] then rm ${BINDIR}/usr/$(mlibdir)/klibc/include/asm/asm-${ARCH/i*86/x86} || die fi if [[ -L ${BINDIR}/usr/$(mlibdir)/klibc/include/asm/asm-${ARCH/i*86/i386} ]] then rm ${BINDIR}/usr/$(mlibdir)/klibc/include/asm/asm-${ARCH/i*86/i386} || die fi # copy missing adm includes cp -a linux/arch/x86/include/asm/* ${BINDIR}/usr/$(mlibdir)/klibc/include/asm/ || die # docs minstalldocs README usr/klibc/{CAVEATS,LICENSE} usr/dash/README.klibc || die }