commit: d5063fd94813514c29539b5bd9baddfa3954b2f6
Author: Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
AuthorDate: Sun Feb 18 14:22:48 2024 +0000
Commit: Horodniceanu Andrei <a.horodniceanu <AT> proton <DOT> me>
CommitDate: Sun Feb 18 14:22:48 2024 +0000
URL: https://gitweb.gentoo.org/repo/user/dlang.git/commit/?id=d5063fd9
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 <AT> proton.me>
eclass/dmd.eclass | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
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"
}