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/netbsd-csu-7.1.ebuild | 81 +++++++++++++++++-------------- 1 file changed, 45 insertions(+), 36 deletions(-) (limited to 'sys-libs/netbsd-csu/netbsd-csu-7.1.ebuild') 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() { -- cgit v1.2.3