From ad6182343997a405079870a2fe91c4e0c6b94595 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 25 Sep 2019 19:33:39 +0100 Subject: gentoo resync : 25.09.2019 --- sys-libs/netbsd-csu/Manifest | 5 +- sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild | 81 +++++++------- sys-libs/netbsd-csu/netbsd-csu-9.0_beta.ebuild | 139 +++++++++++++++++++++++++ 3 files changed, 188 insertions(+), 37 deletions(-) create mode 100644 sys-libs/netbsd-csu/netbsd-csu-9.0_beta.ebuild (limited to 'sys-libs/netbsd-csu') diff --git a/sys-libs/netbsd-csu/Manifest b/sys-libs/netbsd-csu/Manifest index 3845433c7f89..6646dbafbb13 100644 --- a/sys-libs/netbsd-csu/Manifest +++ b/sys-libs/netbsd-csu/Manifest @@ -1,3 +1,6 @@ +DIST netbsd-csu-7.1-tests.tar.bz2 579 BLAKE2B 6d042b3b549ce6ffe0bd0ce908d042e4501a95c21958710078f587d9f52316a52f4bcc219f694ee60066a427a84c027c34906b76c7b8ca151766e5b476152708 SHA512 f2aa7d2340e2545a99cb88e104aaca77b64fd5bfea42bbe5e34d790ae120a749245099a550728f3b7ca2ca5a29fd1f426ddd2e8d5a7bc1a44921c308f1cb12db DIST netbsd-csu-7.1.tar.xz 993460 BLAKE2B 013dd56eb5c49289f68518bee3f72afb42b264f7be869c7dda69f12c98ff782246fcee22c84a51719ab7ed45258cf5c06b43ee9d9da31879187bc0025b8e8c02 SHA512 834524a3ada2a4c02e7eb17d8be09cf023b91e64627f3b2abc32d4f3302e982dcf0939406dc8d6c0ec7ca5e641d2d1845885bb22a165b3d6a1979c2945e2aaad -EBUILD netbsd-csu-7.1.ebuild 3099 BLAKE2B b22e7fcdcbd556f381d8d864c5e1d9752c1173481b21a9b49d445eb0dc6e3ee70b287a3b41c22ea6892c2a8132256d8b727d083d0bd656e162fb4ad33d2b6b14 SHA512 6b2e25c5a2c38add7f9b91bf0c03fe4ae4baad4cd645c19d0cfc9004cd85ce16eec2c66bee701487a6b3f48b6985d317f04d87c74d9c7dbd0df48fcce8808f7c +DIST netbsd-csu-9.0_beta.tar.xz 846120 BLAKE2B 59257e72766279ec043cbee39e2056345348088fbb9af097815c381d6cc5d2bf74c24c0ffd91f45da7384ad6df74a1a4bb0a283b3fb44976f7a59ad2f3bbbb24 SHA512 497ea33ac49338cf32bc265f5d9e7f3ba19c58009717af8505f07d9e2ec9bd3a3c72f85ec37924659509111aca20a6552fd8a06c765fa442b414bd6160815e1a +EBUILD netbsd-csu-7.1.ebuild 3465 BLAKE2B a2ea666d2aac8bffbd461be3df7a6853c1fe2118a511851686a0635dc8e8bc42d3a2b621bd3db764ef069866f3abf306fa42e6dd6df0497945cbcb678c97ec54 SHA512 7888be9788b0f63f8d835e241d6b9e35777dcc6264178d0b11bd5c02a3e27c5c9606d9a61eb423728b149fa143443914909b201f33115af21fc190124da7cc86 +EBUILD netbsd-csu-9.0_beta.ebuild 3478 BLAKE2B 2193d6bf405467d5a812fc683fd63f618d1ba8d7673a82ee1766785b2f50035415a4ef4b95b61f205181a268cb5a3e7a5fb145e3cbb3fe96ad52113e281db921 SHA512 cffbe64e6bd3cb5d9259df1020469293f5f989ad9556e402e8189d1b291e8b3ebd64b393154097ee5716c3ea0c231530324bf1ce36a6a4229bce178c377d4087 MISC metadata.xml 216 BLAKE2B fe5e49887842aa513fbf1f2e09bed09a884d531fd21bdaeb2d389e8bf590b6c0e7063f0af98f66e2db129308ab0f0804ba327c3c752bbb4c900c59ac109d99aa SHA512 3485598147c953e72e1785693a489a7e7d73d59620b76054db9c0ce95d8bfa0e8ffec29da7f7a9d73a32e5b77eac07ca3306c56a972dc57fd89d477edaebf3d5 diff --git a/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild b/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild index bacdd60d24fa..dae26e9e001f 100644 --- a/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild +++ b/sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2017 Gentoo Foundation +# Copyright 1999-2019 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=6 @@ -7,14 +7,17 @@ inherit bsdmk multilib-minimal toolchain-funcs DESCRIPTION="crtbegin.o/crtend.o from NetBSD CSU for GCC-free toolchain" HOMEPAGE="http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/" -SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz" +SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz + test? ( https://dev.gentoo.org/~mgorny/dist/${P}-tests.tar.bz2 )" LICENSE="BSD-2" SLOT="0" KEYWORDS="~amd64 ~x86" -IUSE="" +IUSE="test" +RESTRICT="!test? ( test )" -DEPEND="app-arch/xz-utils" +DEPEND="app-arch/xz-utils + test? ( sys-devel/clang )" S=${WORKDIR}/${P}/lib/csu @@ -57,12 +60,22 @@ multilib_src_compile() { opts+=( crtbegin.o crtbeginS.o crtend.o ) bsdmk_src_compile "${opts[@]}" + + ln -s crtbegin.o crtbeginT.o || die + ln -s crtend.o crtendS.o || die } multilib_src_test() { + cd "${WORKDIR}"/*-tests || die + + # TODO: fix gcc support + local -x CC=${CHOST}-clang + local -x CXX=${CHOST}-clang++ + strip-unsupported-flags + local cc=( # -B sets prefix for internal gcc/clang file lookup - $(tc-getCC) -B"${BUILD_DIR}" + "${CC}" -B"${BUILD_DIR}" ) # 1. figure out the correct location for crt* files @@ -90,37 +103,33 @@ multilib_src_test() { die "Compiler uses wrong crtend: ${crtend}" fi - cat > hello.c <<-EOF || die - #include - - __attribute__((constructor)) - static void ctor_test() - { - fputs("ctor:", stdout); - } - - __attribute__((destructor)) - static void dtor_test() - { - fputs(":dtor", stdout); - } - - int main() - { - fputs("main", stdout); - return 0; - } - EOF - - emake -f /dev/null CC="${cc[*]}" hello - - local out=$(./hello) || die - if [[ ${out} != ctor:main:dtor ]]; then - eerror "Invalid output from the test case." - eerror " Expected: ctor:main:dtor" - eerror " Output : ${out}" - die "Test failed for ${ABI:-${ARCH}}" - fi + # 3. build and run the tests + emake CC="${cc[*]}" + + local p out exp + for p in ./hello{,-static,-dyn}; do + if [[ ${p} == ./hello-dyn && ${ABI} == x32 ]]; then + einfo "Skipping ${p} on x32 -- known to crash" + continue + fi + + ebegin "Testing ${p}" + exp='ctor:main:dtor' + [[ ${p} == ./hello-dyn ]] && exp=libctor:${exp}:libdtor + if ! out=$("${p}"); then + eend 1 + die "Test ${p} crashed for ${ABI:-${ARCH}}" + fi + + [[ ${out} == ${exp} ]] + if ! eend "${?}"; then + eerror " Expected: ${exp}" + eerror " Output : ${out}" + die "Test ${p} failed for ${ABI:-${ARCH}}" + fi + done + + emake clean } multilib_src_install() { diff --git a/sys-libs/netbsd-csu/netbsd-csu-9.0_beta.ebuild b/sys-libs/netbsd-csu/netbsd-csu-9.0_beta.ebuild new file mode 100644 index 000000000000..51311c325c24 --- /dev/null +++ b/sys-libs/netbsd-csu/netbsd-csu-9.0_beta.ebuild @@ -0,0 +1,139 @@ +# Copyright 1999-2019 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +inherit bsdmk multilib-minimal toolchain-funcs + +DESCRIPTION="crtbegin.o/crtend.o from NetBSD CSU for GCC-free toolchain" +HOMEPAGE="http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/csu/" +SRC_URI="https://dev.gentoo.org/~mgorny/dist/${P}.tar.xz + test? ( https://dev.gentoo.org/~mgorny/dist/netbsd-csu-7.1-tests.tar.bz2 )" + +LICENSE="BSD-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="test" +RESTRICT="!test? ( test )" + +BDEPEND="app-arch/xz-utils + test? ( sys-devel/clang )" + +S=${WORKDIR}/${P}/lib/csu + +src_prepare() { + default + multilib_copy_sources +} + +multilib_src_compile() { + local inc_arch=${ABI:-${ARCH}} + + # rewrite ARCH to match NetBSD includes + case "${inc_arch}" in + x86) inc_arch=i386;; + # x32 seems to be equivalent to amd64 as far as we're concerned + x32) inc_arch=amd64;; + arm64) inc_arch=aarch64;; + esac + + # we need arch-specific headers for some assembler macros + if [[ ! -d ${WORKDIR}/${P}/sys/arch/${inc_arch} ]]; then + die "Unexpected ABI/ARCH: ${inc_arch}, please report" + fi + ln -s "${WORKDIR}/${P}/sys/arch/${inc_arch}/include" common/machine || die + + local opts=( + CC="$(tc-getCC)" + OBJCOPY="$(tc-getOBJCOPY)" + + MKPIC=yes + MKSTRIPIDENT=no + ) + # rewrite MACHINE_ARCH to match names used in CSU + case "${inc_arch}" in + amd64) opts+=( MACHINE_ARCH=x86_64 );; + *) opts+=( MACHINE_ARCH="${inc_arch}" );; + esac + + # we only need those files; crt1 and friends are provided by libc + opts+=( crtbegin.o crtbeginS.o crtend.o ) + + bsdmk_src_compile "${opts[@]}" + + ln -s crtbegin.o crtbeginT.o || die + ln -s crtend.o crtendS.o || die +} + +multilib_src_test() { + cd "${WORKDIR}"/*-tests || die + + # TODO: fix gcc support + local -x CC=${CHOST}-clang + local -x CXX=${CHOST}-clang++ + strip-unsupported-flags + + local cc=( + # -B sets prefix for internal gcc/clang file lookup + "${CC}" -B"${BUILD_DIR}" + ) + + # 1. figure out the correct location for crt* files + if tc-is-gcc; then + # gcc requires crt*.o in multi-dir + local multidir=$("${cc[@]}" -print-multi-directory) + if [[ ${multidir} != . ]]; then + ln -s . "${multidir}" || die + fi + elif tc-is-clang; then + # clang is entirely happy with crt*.o in -B + : + else + eerror "Unsupported compiler for tests ($(tc-getCC))" + return + fi + + # 2. verify that the compiler can use our crtbegin/crtend + local crtbegin=$("${cc[@]}" -print-file-name=crtbegin.o) || die + local crtend=$("${cc[@]}" -print-file-name=crtend.o) || die + if [[ ! ${crtbegin} -ef ${BUILD_DIR}/crtbegin.o ]]; then + die "Compiler uses wrong crtbegin: ${crtbegin}" + fi + if [[ ! ${crtend} -ef ${BUILD_DIR}/crtend.o ]]; then + die "Compiler uses wrong crtend: ${crtend}" + fi + + # 3. build and run the tests + emake CC="${cc[*]}" + + local p out exp + for p in ./hello{,-static,-dyn}; do + if [[ ${p} == ./hello-dyn && ${ABI} == x32 ]]; then + einfo "Skipping ${p} on x32 -- known to crash" + continue + fi + + ebegin "Testing ${p}" + exp='ctor:main:dtor' + [[ ${p} == ./hello-dyn ]] && exp=libctor:${exp}:libdtor + if ! out=$("${p}"); then + eend 1 + die "Test ${p} crashed for ${ABI:-${ARCH}}" + fi + + [[ ${out} == ${exp} ]] + if ! eend "${?}"; then + eerror " Expected: ${exp}" + eerror " Output : ${out}" + die "Test ${p} failed for ${ABI:-${ARCH}}" + fi + done + + emake clean +} + +multilib_src_install() { + dolib.a crtbegin.o crtbeginS.o crtend.o + dosym crtbegin.o "/usr/$(get_libdir)/crtbeginT.o" + dosym crtend.o "/usr/$(get_libdir)/crtendS.o" +} -- cgit v1.2.3