diff options
author | 2024-02-18 16:22:48 +0200 | |
---|---|---|
committer | 2024-02-18 16:22:48 +0200 | |
commit | d5063fd94813514c29539b5bd9baddfa3954b2f6 (patch) | |
tree | 6b11506daab911f0cee0853f35f272824d37d1ac /eclass | |
parent | */*: set an upper bound on DLANG_VERSION_RANGE (diff) | |
download | dlang-d5063fd94813514c29539b5bd9baddfa3954b2f6.tar.gz dlang-d5063fd94813514c29539b5bd9baddfa3954b2f6.tar.bz2 dlang-d5063fd94813514c29539b5bd9baddfa3954b2f6.zip |
dmd.eclass: explicitly specify arguments to dmd in tests
Refactor the test code a little for better readability and prevent
linking by default to libphosbos2.a, which happens to work only because
the build wrongfully generates both shared and static libraries
regardless of USE=static-libs.
Pass the same options to dmd as the ones in the installed dmd.conf to
get a closer setup to what the user will have installed on their system.
Signed-off-by: Horodniceanu Andrei <a.horodniceanu@proton.me>
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/dmd.eclass | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/eclass/dmd.eclass b/eclass/dmd.eclass index 1e49af7..52e4209 100644 --- a/eclass/dmd.eclass +++ b/eclass/dmd.eclass @@ -233,7 +233,22 @@ dmd_src_compile() { dmd_src_test() { test_hello_world() { - "$(dmd_gen_exe_dir)/dmd" -m${MODEL} -fPIC -Iphobos -Idruntime/import -L-Lphobos/generated/linux/release/${MODEL} samples/d/hello.d || die "Failed to build hello.d (${MODEL}-bit)" + local phobosDir=phobos/generated/linux/release/"${MODEL}" + local commandArgs=( + # Copied from below, where dmd.conf is generated + -L--export-dynamic + -defaultlib=phobos2 # If unspecified, defaults to libphobos2.a + -fPIC + -L-L"${phobosDir}" + -L-rpath="${phobosDir}" + + -conf= # Don't use dmd.conf + -m"${MODEL}" + -Iphobos + -Idruntime/import + ) + "$(dmd_gen_exe_dir)/dmd" "${commandArgs[@]}" samples/d/hello.d \ + || die "Failed to build hello.d (${MODEL}-bit)" ./hello ${MODEL}-bit || die "Failed to run test sample (${MODEL}-bit)" rm hello.o hello || die "Could not remove temporary files" } |