summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorJonas Meeuws <jonas.meeuws@gmail.com>2026-03-13 19:54:02 +0100
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-08-22 16:49:14 +0200
commit4aca2de09370c5bb2244592926d84d0dba9bd3a8 (patch)
treeb436d21a6d1bb944404c2c3e715be050b937aabf /gnu
parent106a9a89c12ea5a2b2251521b06c48b032b17eab (diff)
gnu: dmd: Reinstate phobos tests.
* gnu/packages/dlang.scm (dmd-bootstrap) [#:disallowed-references]: Add tzdata-for-tests. [#:test-target]: Remove. [#:phases]<patch-paths-in-phobos>: Remove commented out zoneinfo path patch. Reinstate commented out libcurl path patch. <patch-tests>: Disable an unittest from ‘std.process’. <check>: Override ‘#:test-target’. <check-phobos>: Override ‘#:test-target’. [inputs]: Add curl. [native-inputs]: Add tzdata-for-tests. <phobos>{patches}: Add “dmd-phobos-support-TZDIR.patch”. (dmd)[#:disallowed-references]: Add tzdata-for-tests. * gnu/packages/patches/dmd-phobos-support-TZDIR.patch: New file. * gnu/local.mk (dist_patch_DATA): Add the patch. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/dlang.scm41
-rw-r--r--gnu/packages/patches/dmd-phobos-support-TZDIR.patch42
3 files changed, 67 insertions, 17 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index d99bf29551e..836a8d60200 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1209,6 +1209,7 @@ dist_patch_DATA = \
1209 %D%/packages/patches/directfb-davinci-glibc-228-compat.patch \ 1209 %D%/packages/patches/directfb-davinci-glibc-228-compat.patch \
1210 %D%/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch \ 1210 %D%/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch \
1211 %D%/packages/patches/dkimproxy-add-ipv6-support.patch \ 1211 %D%/packages/patches/dkimproxy-add-ipv6-support.patch \
1212 %D%/packages/patches/dmd-phobos-support-TZDIR.patch \
1212 %D%/packages/patches/doc++-gcc-14.patch \ 1213 %D%/packages/patches/doc++-gcc-14.patch \
1213 %D%/packages/patches/docbook-utils-documentation-edits.patch \ 1214 %D%/packages/patches/docbook-utils-documentation-edits.patch \
1214 %D%/packages/patches/docbook-utils-escape-characters.patch \ 1215 %D%/packages/patches/docbook-utils-escape-characters.patch \
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 112c6cbf9c3..38f756b3833 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -357,13 +357,12 @@ integration tests...\n")
357 (build-system gnu-build-system) 357 (build-system gnu-build-system)
358 (arguments 358 (arguments
359 (list 359 (list
360 #:disallowed-references (list (gexp-input (canonical-package gcc) 360 #:disallowed-references (list (gexp-input (canonical-package gcc) "lib")
361 "lib")) 361 tzdata-for-tests)
362 ;; Disable tests, as gdmd cannot cope with some arguments used such as 362 ;; Disable tests, as gdmd cannot cope with some arguments used such as
363 ;; '-conf'. 363 ;; '-conf'.
364 #:tests? #f 364 #:tests? #f
365 #:out-of-source? #t 365 #:out-of-source? #t
366 #:test-target "test"
367 #:make-flags 366 #:make-flags
368 #~(list (string-append "CC=" #$(cc-for-target)) 367 #~(list (string-append "CC=" #$(cc-for-target))
369 (string-append "HOST_CXX=" #$(cxx-for-target)) 368 (string-append "HOST_CXX=" #$(cxx-for-target))
@@ -389,7 +388,8 @@ integration tests...\n")
389 (append args '#$extra-args)))))) 388 (append args '#$extra-args))))))
390 (target-file (lambda (pkg-name path) 389 (target-file (lambda (pkg-name path)
391 (file-append (this-package-input pkg-name) path))) 390 (file-append (this-package-input pkg-name) path)))
392 (target-bin-sh (target-file "bash-minimal" "/bin/sh"))) 391 (target-bin-sh (target-file "bash-minimal" "/bin/sh"))
392 (target-lib-curl (target-file "curl" "/lib/libcurl.so")))
393 #~(modify-phases %standard-phases 393 #~(modify-phases %standard-phases
394 (replace 'unpack 394 (replace 'unpack
395 (lambda* (#:key source #:allow-other-keys) 395 (lambda* (#:key source #:allow-other-keys)
@@ -418,12 +418,9 @@ integration tests...\n")
418 (add-after 'unpack 'patch-paths-in-phobos 418 (add-after 'unpack 'patch-paths-in-phobos
419 (lambda _ 419 (lambda _
420 (with-directory-excursion "phobos" 420 (with-directory-excursion "phobos"
421 ;; (substitute* "std/datetime/timezone.d" 421 (substitute* "std/net/curl.d"
422 ;; (("\"/usr/share/zoneinfo/\"") 422 (("\"libcurl\\.so\"")
423 ;; (format #f "~s" target-zoneinfo))) 423 (format #f "~s" #$target-lib-curl)))
424 ;; (substitute* "std/net/curl.d"
425 ;; (("\"libcurl\\.so\"")
426 ;; (format #f "~s" target-lib-curl)))
427 (substitute* "std/process.d" 424 (substitute* "std/process.d"
428 (("return \"/bin/sh\";") 425 (("return \"/bin/sh\";")
429 (format #f "return ~s;" #$target-bin-sh)) 426 (format #f "return ~s;" #$target-bin-sh))
@@ -472,7 +469,13 @@ integration tests...\n")
472 "long_backtrace_trunc rt_trap_exceptions ")) 469 "long_backtrace_trunc rt_trap_exceptions "))
473 "")) 470 ""))
474 (substitute* "dmd/druntime/test/gc/Makefile" 471 (substitute* "dmd/druntime/test/gc/Makefile"
475 ((" invariant ") " ")))) 472 ((" invariant ") " "))
473
474 ;; Skip a std.process unittest that fails due to "kill" not
475 ;; working properly in the build environment.
476 (substitute* "phobos/std/process.d"
477 (("^.*sleep.*10000" all)
478 (string-append " return;\n" all)))))
476 (delete 'bootstrap) 479 (delete 'bootstrap)
477 (delete 'configure) 480 (delete 'configure)
478 (replace 'build 481 (replace 'build
@@ -489,9 +492,11 @@ integration tests...\n")
489 (string-append "DMD=" dmd) 492 (string-append "DMD=" dmd)
490 make-flags)))))) 493 make-flags))))))
491 (replace 'check 494 (replace 'check
492 #$(wrap-in-directory-excursion "dmd" 'check)) 495 #$(wrap-in-directory-excursion "dmd" 'check
496 #:test-target "test"))
493 (add-after 'check 'check-phobos 497 (add-after 'check 'check-phobos
494 #$(wrap-in-directory-excursion "phobos" 'check)) 498 #$(wrap-in-directory-excursion "phobos" 'check
499 #:test-target "unittest"))
495 (replace 'install 500 (replace 'install
496 (lambda* (#:key outputs #:allow-other-keys) 501 (lambda* (#:key outputs #:allow-other-keys)
497 (let* ((platform (cond (#$(target-linux?) "linux"))) 502 (let* ((platform (cond (#$(target-linux?) "linux")))
@@ -536,10 +541,11 @@ integration tests...\n")
536 ;; Phobos license is identical. 541 ;; Phobos license is identical.
537 #$(wrap-in-directory-excursion "dmd" 'install-license-files)))))) 542 #$(wrap-in-directory-excursion "dmd" 'install-license-files))))))
538 (inputs 543 (inputs
539 (list bash-minimal)) 544 (list curl ; std.net.curl
545 bash-minimal)) ; std.process
540 (native-inputs 546 (native-inputs
541 (list gdmd which 547 (list gdmd which
542 gdb/pinned ; for tests 548 gdb/pinned tzdata-for-tests ; for tests
543 (origin 549 (origin
544 (method git-fetch) 550 (method git-fetch)
545 (uri (git-reference 551 (uri (git-reference
@@ -548,7 +554,8 @@ integration tests...\n")
548 (file-name (git-file-name "phobos" version)) 554 (file-name (git-file-name "phobos" version))
549 (sha256 555 (sha256
550 (base32 556 (base32
551 "1ydls3ar6d3f7ffqvidr46x3zrz3wlzjln5qa0nbz843ndjr4g7n"))))) 557 "1ydls3ar6d3f7ffqvidr46x3zrz3wlzjln5qa0nbz843ndjr4g7n"))
558 (patches (search-patches "dmd-phobos-support-TZDIR.patch")))))
552 (outputs '("out" "lib" "debug")) 559 (outputs '("out" "lib" "debug"))
553 (synopsis "Reference D Programming Language compiler") 560 (synopsis "Reference D Programming Language compiler")
554 (description "@acronym{DMD, Digital Mars D compiler} is the reference 561 (description "@acronym{DMD, Digital Mars D compiler} is the reference
@@ -573,7 +580,7 @@ compiler for the D programming language.")
573 '(#:tests?) ;reinstate tests 580 '(#:tests?) ;reinstate tests
574 (package-arguments dmd-bootstrap)) 581 (package-arguments dmd-bootstrap))
575 ((#:disallowed-references _ ''()) 582 ((#:disallowed-references _ ''())
576 (list dmd-bootstrap)) 583 (list dmd-bootstrap tzdata-for-tests))
577 ((#:make-flags flags ''()) 584 ((#:make-flags flags ''())
578 #~(fold delete #$flags '("HOST_DMD=gdmd" 585 #~(fold delete #$flags '("HOST_DMD=gdmd"
579 "SHARED=0"))) 586 "SHARED=0")))
diff --git a/gnu/packages/patches/dmd-phobos-support-TZDIR.patch b/gnu/packages/patches/dmd-phobos-support-TZDIR.patch
new file mode 100644
index 00000000000..62a2a7ea2d6
--- /dev/null
+++ b/gnu/packages/patches/dmd-phobos-support-TZDIR.patch
@@ -0,0 +1,42 @@
1commit 957d704139d6430fcce7e5b0d7058572f220ab09
2Author: Jonas Meeuws <jonas.meeuws@gmail.com>
3Date: Thu Mar 12 01:27:34 2026 +0100
4
5 std.datetime.timezone: Support the TZDIR environment variable on POSIX.
6
7diff --git a/std/datetime/timezone.d b/std/datetime/timezone.d
8index 6a1898b0e..4e7b1f95b 100644
9--- a/std/datetime/timezone.d
10+++ b/std/datetime/timezone.d
11@@ -2033,7 +2033,15 @@ public:
12 }
13 else version (Posix)
14 {
15- enum defaultTZDatabaseDir = "/usr/share/zoneinfo/";
16+ static nothrow
17+ string defaultTZDatabaseDir()
18+ {
19+ import std.exception : assumeWontThrow;
20+ import std.process : environment;
21+ return environment
22+ .get("TZDIR", "/usr/share/zoneinfo/")
23+ .assumeWontThrow; // nothrow on POSIX
24+ }
25 }
26 else version (Windows)
27 {
28@@ -2455,11 +2463,13 @@ public:
29 // RefCounted variable, but here, no references to the payload is
30 // escaped to the outside, so this should be @trusted
31 () @trusted {
32- foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth))
33+ foreach (DirEntry de; dirEntries(tzDatabaseDir, SpanMode.depth, false))
34 {
35 if (de.isFile)
36 {
37 auto tzName = de.name[tzDatabaseDir.length .. $];
38+ if (tzName.startsWith("/"))
39+ tzName = tzName[1 .. $];
40
41 if (!tzName.extension().empty ||
42 !tzName.startsWith(subName) ||