diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-26 20:18:40 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2013-12-26 20:18:40 +0000 |
commit | 3ec7c2f19f120ea764ba922b93cb2f9c2d265f53 (patch) | |
tree | a7a9aaff5cf387b779caff0504744bea68116bc9 /dev-libs/klibc | |
parent | ia64 stable wrt bug #493292 (diff) | |
download | historical-3ec7c2f19f120ea764ba922b93cb2f9c2d265f53.tar.gz historical-3ec7c2f19f120ea764ba922b93cb2f9c2d265f53.tar.bz2 historical-3ec7c2f19f120ea764ba922b93cb2f9c2d265f53.zip |
Bug #461982: Make it possible to build with custom-cflags, but not by default, as klibc is closer to kernel ABI than userspace.
Package-Manager: portage-2.2.7/cvs/Linux x86_64
Diffstat (limited to 'dev-libs/klibc')
-rw-r--r-- | dev-libs/klibc/ChangeLog | 8 | ||||
-rw-r--r-- | dev-libs/klibc/Manifest | 4 | ||||
-rw-r--r-- | dev-libs/klibc/klibc-2.0.2-r1.ebuild | 295 |
3 files changed, 304 insertions, 3 deletions
diff --git a/dev-libs/klibc/ChangeLog b/dev-libs/klibc/ChangeLog index 9fb707b89584..9a78e203b002 100644 --- a/dev-libs/klibc/ChangeLog +++ b/dev-libs/klibc/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-libs/klibc # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.95 2013/12/26 19:40:02 robbat2 Exp $ +# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/ChangeLog,v 1.96 2013/12/26 20:18:33 robbat2 Exp $ + +*klibc-2.0.2-r1 (26 Dec 2013) + + 26 Dec 2013; Robin H. Johnson <robbat2@gentoo.org> +klibc-2.0.2-r1.ebuild: + Bug #461982: Make it possible to build with custom-cflags, but not by default, + as klibc is closer to kernel ABI than userspace. 26 Dec 2013; Robin H. Johnson <robbat2@gentoo.org> klibc-2.0.2.ebuild: Bug #485482: Enable building on mixed 64-bit kernel + 32-bit userland; patch diff --git a/dev-libs/klibc/Manifest b/dev-libs/klibc/Manifest index 5f569cdf6a45..88eb80a94923 100644 --- a/dev-libs/klibc/Manifest +++ b/dev-libs/klibc/Manifest @@ -14,7 +14,7 @@ DIST klibc-2.0.2.tar.xz 466696 SHA256 1e9d4ba6fe2aeea0bd27d14a9a674c29fb7cf766ff DIST linux-2.6.39.tar.bz2 76096559 SHA256 584d17f2a3ee18a9501d7ff36907639e538cfdba4529978b8550c461d45c61f6 SHA512 06cb5aba7c53c68d43afcebbbb9507d8b398b3e994d8a237c66a49374ca569237f074adaa3fccba7f908eab4f51f99bae40656793eab5c2f5ce03cd3a65fa02c WHIRLPOOL 2f2c833ab1d8ddbe3e0b862b71a38d47fd3fc5688ea81cdd818369b09e72fa50481bf84533ddcea992af1130b2ceec10b6ff5eaff393a14ee70639293a555912 DIST linux-3.2.tar.xz 65065516 SHA256 dd96ed02b53fb5d57762e4b1f573460909de472ca588f81ec6660e4a172e7ba7 SHA512 77e9a52d78d6c8e951df1e166023eebe5defc5ef3c45d3ac84b613137b3c2e55cee5693d828ebd06c5034bd89ea2a5f862f55824f2b7839c9ad7212c81e3ecb0 WHIRLPOOL 7cc68baac4441740e2171fbbc4195ee6c0351de099aadaee8cb3487f6d1f8b7e1d3144ee54ba38dbd24d6be431a1ea3b921ffce82ff84df21a98da7bc61c1d17 EBUILD klibc-1.5.25.ebuild 7605 SHA256 48b2924efd4cece6a3c6d100ebd6cf40402fcedbe766297faa825ed7a1d69712 SHA512 98804fad0d8652da84db78ceb2c3c210bd39798b2a2e8416507d898e228439ed2aff8f99cab3ad1c26b1aa9736d71285b44740e6437c5d753f3909222436ad4a WHIRLPOOL c8b1ccf03928d07e2555f00149c07328cf33aba3ca2d5d723ec97389e51f711fb4ddbb451721e674ff4210586b29cb6facb0e332d5baa8f99092cfe3cdd762aa +EBUILD klibc-2.0.2-r1.ebuild 8657 SHA256 b8dee77f3b5d28c347b65871d98f8c6846db8c5076b0f2139f8d4c11ad9a695b SHA512 2ac2fad49b22d43668e700006360ddf42ebe6492acf250a8f9b6b62167ffd359eb402c8793629793fc6c27650ce2fb40aac8e02b17b373afc335da4357e1808a WHIRLPOOL 45c5921ad89e98dcaf29dcba96bb5195be4321acf078bf28c8b216b5603c0234b7964d3a04eb792c39ad3599381dd02261ab137497addecf7365c42e0a91b84c EBUILD klibc-2.0.2.ebuild 8235 SHA256 734d88ab2557ee157f32c4306ea37a53e2a910ab5057b85b3c3671f092b6ebed SHA512 35cb2d4e8bd3139ed8a459eb5c87b040b9b0a84a7f194f0a85aa86bc74fe25a1665279ab64684eff46e7187e8287f2ab40269bcce82741633449bd6d6e05f496 WHIRLPOOL 34a72c50de855ffa3f36d6c7f793f6ceb2c54714c5d1dc9c2642e024a401e6f20d593be585fcd87466025a6e09d46128cb48a5fddc2f5c812043ffe240b4a607 -MISC ChangeLog 15599 SHA256 a7bb074bf2bb257d2374616dea7b005a0ca29ba5bdb0579b55cb3bb3e24c4a9d SHA512 7e6a9fd7fa94b72f41c854ed3169531666ae74af1f4cbd5a0be7b2adfa812f3b58282d4c1c96e57a04da3033702d5d8d3ae2bbf2f0b80d12b2e9978f8839ddfc WHIRLPOOL b78599bac2c9aba31f09f0984aeb0c4a459400df3a269086823dc0e3dc77d573fe8d393a5b55511f3ba8929d941f73fa735f6a97e8495bf3f0c04cfb70515987 -MISC klibc-2.0.2.ebuild.orig 8129 SHA256 fcd8f59994a3593b4b0d6f1b49c7acbe1024c48af4ecfb4a725608734fafd680 SHA512 c1e70aa1b98bc529916b67b6c6021a10747eb68b38c3e4d50143aebf1f4a93dcf75fef6f50a75ee296d6eddb9c728a25b7513a6f6d7b073f6fff024ca9f0d7d2 WHIRLPOOL 8f7c8adf86423fa879c244664bb8c7e57de3c73f4addb15dc10ee0c5a70912e1f6c353db5c00781988cd94f00d64b1763966339b613dfceb3dbb4399586c1671 +MISC ChangeLog 15840 SHA256 7c3ea65632bdd11fdae13f67881fbd6fd94a3d2c525c5181dfc53fc2b818c8b9 SHA512 307fd049e5401470be4c9a01a4b063398bb595e8e795a699df7c6f692ae1c1cbd1ff8d68ef6952c616f40e2120eba58511846e9f372823d47ff3a2550f2e05f0 WHIRLPOOL cca70578e7a9ea62c020aec037a407d5a2cc8f80d533518857480c5964d789acde39b63f3cc614ef54fe52152ee5781bf47462569d7c9ab6a0e149e976a1af81 MISC metadata.xml 164 SHA256 3b1b59f5a5a6e3a377f6124aa855936c20e9b883f7bbbef0210fdef022da34f3 SHA512 84cc2f3f5b3ece35f020ba9a4b29f5ea9082ee201bc21b5a386c5f8a44a685967a27e2af96e3f6addc19ee0b6ee80e116f2afab770ec4e57b994f97c3d1161ea WHIRLPOOL 9b0f6952edfd4458f8d8f2186f89ae04ecc2b8de5eb819626c8da501dbac0ab3bcf8606b10a896582b2c5ab9de015f174ca4962f98fd4772759046213767e13e diff --git a/dev-libs/klibc/klibc-2.0.2-r1.ebuild b/dev-libs/klibc/klibc-2.0.2-r1.ebuild new file mode 100644 index 000000000000..dd1fd205fab1 --- /dev/null +++ b/dev-libs/klibc/klibc-2.0.2-r1.ebuild @@ -0,0 +1,295 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-libs/klibc/klibc-2.0.2-r1.ebuild,v 1.1 2013/12/26 20:18:33 robbat2 Exp $ + +# 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 +# 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. + +EAPI=5 +K_TARBALL_SUFFIX="xz" + +inherit eutils multilib toolchain-funcs flag-o-matic + +DESCRIPTION="A minimal libc subset for use with initramfs." +HOMEPAGE="http://www.zytor.com/mailman/listinfo/klibc" +KV_MAJOR="3" KV_MINOR="x" KV_SUB="2" +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}" +SRC_URI=" + mirror://kernel/linux/libs/klibc/${PV:0:3}/${P}.tar.${K_TARBALL_SUFFIX} + ${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" + +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" + +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|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} +} + +src_prepare() { + [[ ${PKV} ]] && EPATCH_OPTS="-d ${KS} -p1" epatch "${DISTDIR}"/patch-${PKV}.${K_TARBALL_SUFFIX} + 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 + + # Fix usage of -s, bug #201006 + epatch "${FILESDIR}"/klibc-1.5.7-strip-fix-dash-s.patch +} + +# 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' \ + "${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 + + emake \ + EXTRA_KLIBCAFLAGS="-Wa,--noexecstack" \ + EXTRA_KLIBCLDFLAGS="-z noexecstack" \ + HOSTLDFLAGS="-z noexecstack" \ + 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}" \ + ${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" \ + 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}" \ + ${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 + 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 +} |