summaryrefslogtreecommitdiff
path: root/dev-libs/klibc
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2018-03-02 15:59:12 +0000
committerV3n3RiX <venerix@redcorelinux.org>2018-03-02 15:59:12 +0000
commit06a7b5647e11a8ddf69b1c3d3ded6a8ba28b923e (patch)
tree8d58c1f4b049da677b33209b072f2b3057268fe0 /dev-libs/klibc
parent99abbc5e5a6ecd3fc981b45646fd8cb5d320377b (diff)
gentoo resync : 02.03.2018
Diffstat (limited to 'dev-libs/klibc')
-rw-r--r--dev-libs/klibc/Manifest2
-rw-r--r--dev-libs/klibc/klibc-2.0.4-r3.ebuild318
2 files changed, 320 insertions, 0 deletions
diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest
index 47bff66242c0..1b487e1d3525 100644
--- a/dev-libs/klibc/Manifest
+++ b/dev-libs/klibc/Manifest
@@ -5,6 +5,8 @@ AUX klibc-2.0.3-kernel-uapi.patch 4584 BLAKE2B cb8a9344eaed0ab8fe2d87934f64d6239
AUX klibc.m4 3619 BLAKE2B b0895e5d775b2edc497514ce5adffa3824730cebd1b0c9f166a6ca84fed7880d5bfc13409835eb07d515307e5a83e2459665fa45987ee182619458f80b49defb SHA512 42cf4add07031105689d7438838e0306d32a637e8a4719afc11722fd8f1ac040e6bb92cc7ba3536b83a6de8907a91bc5ad11036f22810443f4cd24161950cc6b
DIST klibc-2.0.4.tar.xz 469348 BLAKE2B 5975e3d25f72b70c4cbaa56ea5363417407e8dace1e02e2da0b835bbb2cad56648b0084e5404528206ef3facf4ffd3611e8bd729eadd80b00e30d1a70b3057cf SHA512 7a01d1744b49f3de64111fefc522b1d63f054199acf671254bc046d6f1d0b6ca68e050c99025bf8303751c2466a5e034677555649ae5909c40997858d393db8d
DIST klibc_2.0.4-9.debian.tar.xz 28628 BLAKE2B aaad6fafb7372152987eebda5951b9f3de2e33da583e0ea7597f666461977f461303566f9e363e9c96994c7b0eb6213c6a17b2fab72df7460db3cfbc0c2e1cf8 SHA512 0fe9a6642be962fa631919850d7eeed5a87c10682766ee10fe31dec2b19a6179e0067602acb26bdc2aa8ceecfd39b1dc95a76f3b0a9bc813b172c0ffe9f0ff53
+DIST linux-4.14.tar.xz 100770500 BLAKE2B 85dc4aa953fe65e273a24473d8de98e4f204f97c43be9fc87cf5be01f796f94cfde5c8f9c84619751f1cac51f83ce0b4681fb19c5f2965a72d4a94fe5577846a SHA512 77e43a02d766c3d73b7e25c4aafb2e931d6b16e870510c22cef0cdb05c3acb7952b8908ebad12b10ef982c6efbe286364b1544586e715cf38390e483927904d8
DIST linux-4.4.tar.xz 87295988 BLAKE2B f260f1858994f5d481fd078c86e51bddbc958f7c5d1586f60dced772e1b1107ecf3aae0558c3e6f39c36f7d3aa1e6cd1e5c64ec9d6f2218f47b98413da6466fb SHA512 13c8459933a8b80608e226a1398e3d1848352ace84bcfb7e6a4a33cb230bbe1ab719d4b58e067283df91ce5311be6d2d595fc8c19e2ae6ecc652499415614b3e
EBUILD klibc-2.0.4-r2.ebuild 9408 BLAKE2B edebd4801c55ddf27208c663f6c53ec331cbfb6ffe482362590631704c5e4cc7645baa1672035ba6d61c2e6dc075ac77bd00a548dd030ca4cac8f615ae0605cd SHA512 9c840e5353ef7ed7dc24caa16f8123b1ec57c12f82a4c8853ab8481444ee5836e26715a13a9a820a2dd1b864bd85eb1685e3f63be205d26b9bb5d35cff051372
+EBUILD klibc-2.0.4-r3.ebuild 9412 BLAKE2B e9d8c38215ebbc1e8dd9d93191591660aa8edc4e1ef8b3f11547387433c790d2f4b5d958962a264e006a6186c5632ee645d4c2efd8362682ae993a2fe4aca75e SHA512 a98c89af7b3e736bbd38c4f055ddd81e180c59ae0d894780121a94dbd8cc3863eead045c0a06581cbc58d0178c99f17ba8fb9fff2b91ee0d0694170813e20d2e
MISC metadata.xml 166 BLAKE2B c254f1fb642881aba57637be14fb0a89b10384f91a128feaec3a8c870d76efc2cbacb92caccc0dee2dd19a5ac5eaf8643080dafa05c4e2ac96a68568927e5afd SHA512 a56648c974a1d14dd4c18237532773c72057a13ab90c58b5da04f185e3c12a8bd8d5c21fb06053507f31766291a82dc7d87b34cd65fd94cfe2af7295c813ef84
diff --git a/dev-libs/klibc/klibc-2.0.4-r3.ebuild b/dev-libs/klibc/klibc-2.0.4-r3.ebuild
new file mode 100644
index 000000000000..8e334dc61ba3
--- /dev/null
+++ b/dev-libs/klibc/klibc-2.0.4-r3.ebuild
@@ -0,0 +1,318 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# 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
+# unfortunately.
+# 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=6
+K_TARBALL_SUFFIX="xz"
+
+inherit eutils 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="4" KV_MINOR="x" KV_SUB="14"
+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.4
+DEBIAN_PR=9
+DEBIAN_A="${PN}_${DEBIAN_PV}-${DEBIAN_PR}.debian.tar.xz"
+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"
+
+RDEPEND="dev-lang/perl"
+DEPEND="${RDEPEND}
+ sys-devel/bc"
+
+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}
+}
+
+PATCHES=(
+ # Build interp.o with EXTRA_KLIBCAFLAGS (.S source)
+ "${FILESDIR}"/${PN}-1.4.11-interp-flags.patch
+ # Fix usage of -s, bug #201006
+ "${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
+ "${FILESDIR}"/klibc-2.0.2-mkfifo.patch
+ # Newer kernels have some headers in the uapi dir
+ "${FILESDIR}"/klibc-2.0.3-kernel-uapi.patch
+)
+
+src_prepare() {
+ [[ ${PKV} ]] && eapply "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX}
+
+ # Symlink /usr/src/linux to ${S}/linux
+ ln -snf "${KS}" linux
+ #ln -snf "/usr" linux
+
+ # Borrow the debian fixes too
+ for p in $(<"${WORKDIR}"/debian/patches/series) ; do
+ PATCHES+=( "${WORKDIR}/debian/patches/${p}" )
+ done
+
+ default
+}
+
+# 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' \
+ -e '1iCONFIG_ARM_UNWIND=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
+ # NOTE: This totally violates sandbox <asturm@gentoo.org>
+ # 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
+}