1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-06-15 07:34:03 +02:00

gnu: dmd: Support GNU/Hurd.

* gnu/packages/patches/dmd-hurd.patch, gnu/packages/patches/phobos-hurd.patch
: New patches.
* gnu/local.mk: Register them.
* gnu/packages/dlang.scm (dmd-bootstrap): Add dmd patch.
[native-inputs]: Make gdb/pinned linux-only, add patch to phobos.
[#:make-flags]: Set DISABLED_TESTS.
[#:phases]: In 'patch-tests disable more tests.
Change-Id: Id5e2fee30bb48a27785682d1b6a30666f33e37c5

Change-Id: I16ad0cba2666fe475cd4028287316e9f8cbad2fe
This commit is contained in:
Yelninei
2026-03-13 18:56:33 +00:00
committed by Janneke Nieuwenhuizen
parent 0c53e15628
commit e5b92baa27
4 changed files with 5273 additions and 16 deletions
+2
View File
@@ -1199,6 +1199,7 @@ dist_patch_DATA = \
%D%/packages/patches/directfb-davinci-glibc-228-compat.patch \
%D%/packages/patches/django-compressor-build-with-beautifulsoup-4.14+.patch \
%D%/packages/patches/dkimproxy-add-ipv6-support.patch \
%D%/packages/patches/dmd-hurd.patch \
%D%/packages/patches/doc++-gcc-14.patch \
%D%/packages/patches/docbook-utils-documentation-edits.patch \
%D%/packages/patches/docbook-utils-escape-characters.patch \
@@ -2101,6 +2102,7 @@ dist_patch_DATA = \
%D%/packages/patches/pdl-2.100-reproducibility.patch \
%D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch \
%D%/packages/patches/pharo-vm-cmake.patch \
%D%/packages/patches/phobos-hurd.patch \
%D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \
%D%/packages/patches/plasp-fix-normalization.patch \
%D%/packages/patches/plasp-include-iostream.patch \
+46 -16
View File
@@ -351,7 +351,9 @@ integration tests...\n")
(file-name (git-file-name "dmd" version))
(sha256
(base32
"0qvg2fb73kyng8k1wj482g07ar2qw5laa5fynwx7pdd610n0pjpc"))))
"0qvg2fb73kyng8k1wj482g07ar2qw5laa5fynwx7pdd610n0pjpc"))
(patches
(search-patches "dmd-hurd.patch"))))
(build-system gnu-build-system)
(arguments
(list
@@ -372,7 +374,16 @@ integration tests...\n")
;; Do not build the shared libphobos2.so library, to avoid
;; retaining a reference to gcc:lib.
"SHARED=0"
"DIFFABLE=1" ;constant timestamp
#$@(if (target-hurd?)
(list (string-append "DISABLED_TESTS=core/thread/osthread "
"std/parallelism " ;; pthread stubs
"std/file " ;; rename (NULL, "")
"std/socket " ;; ENOPROTOOPT
"std/datetime/systime "
"std/datetime/timezone " ;; TZDIR
"std/net/curl ")) ;; dlopen curl
'())
"DIFFABLE=1" ;constant timestamp
"VERBOSE=1")
#:modules
`(,@%default-gnu-modules
@@ -470,7 +481,19 @@ integration tests...\n")
"long_backtrace_trunc rt_trap_exceptions "))
""))
(substitute* "dmd/druntime/test/gc/Makefile"
((" invariant ") " "))))
((" invariant ") " "))
#$@(if (target-hurd?)
'((for-each
delete-file
;; environment differs in LD_ORIGIN_PATH
'("dmd/compiler/test/dshell/sameenv.d"
;; Non _GLIBCXX_USE_CXX98_ABI version prints a warning
"dmd/compiler/test/runnable_cxx/cppa.d"))
;; Segfault
(substitute* "dmd/druntime/test/shared/Makefile"
(("loadDR host ") "")))
'())))
(delete 'bootstrap)
(delete 'configure)
(replace 'build
@@ -492,7 +515,8 @@ integration tests...\n")
(phase-in-sub-dir 'check "phobos"))
(replace 'install
(lambda* (#:key outputs #:allow-other-keys)
(let* ((platform (cond (#$(target-linux?) "linux")))
(let* ((platform (cond (#$(target-linux?) "linux")
(#$(target-hurd?) "hurd")))
(bits (if #$(target-64bit?) 64 32))
(build-sub-dir (format #f "generated/~a/release/~a"
platform bits))
@@ -536,17 +560,22 @@ integration tests...\n")
(inputs
(list bash-minimal))
(native-inputs
(list gdmd which
gdb/pinned ; for tests
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/dlang/phobos")
(commit (string-append "v" version))))
(file-name (git-file-name "phobos" version))
(sha256
(base32
"0afi5glnf96242cbnr10ccjvfsgkh4k5y7qnmxv4ph5g0izvi1dc")))))
(append
(if (target-linux?)
;; gdb tests only on on linux
(list gdb/pinned)
'())
(list gdmd which
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/dlang/phobos")
(commit (string-append "v" version))))
(file-name (git-file-name "phobos" version))
(sha256
(base32
"0afi5glnf96242cbnr10ccjvfsgkh4k5y7qnmxv4ph5g0izvi1dc"))
(patches (search-patches "phobos-hurd.patch"))))))
(outputs '("out" "lib" "debug"))
(synopsis "Reference D Programming Language compiler")
(description "@acronym{DMD, Digital Mars D compiler} is the reference
@@ -555,7 +584,8 @@ compiler for the D programming language.")
(home-page "https://github.com/dlang/dmd")
;; As reported by upstream:
;; https://wiki.dlang.org/Compilers#Comparison
(supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"))
(supported-systems '("i686-linux" "x86_64-linux" "aarch64-linux"
"i586-gnu" "x86_64-gnu"))
;; This variant exists only for bootstrapping purposes.
(properties '((hidden? . #t)))))
File diff suppressed because it is too large Load Diff
+64
View File
@@ -0,0 +1,64 @@
From e2d65597896089a8bd06992a4b83e3d14176b02c Mon Sep 17 00:00:00 2001
From: Yelninei <yelninei@tutamail.com>
Date: Tue, 24 Mar 2026 19:46:30 +0000
Subject: [PATCH] phobos: Fixes for GNU/Hurd.
---
Makefile | 2 +-
std/datetime/timezone.d | 1 +
std/math/algebraic.d | 1 +
std/process.d | 2 ++
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 4fa51299e..a9d4789f6 100644
--- a/Makefile
+++ b/Makefile
@@ -305,7 +305,7 @@ else
endif
# build with shared library support (defaults to true on supported platforms)
-SHARED=$(if $(findstring $(OS),linux freebsd),1,)
+SHARED=$(if $(findstring $(OS),linux freebsd hurd),1,)
TESTS_EXTRACTOR=$(ROOT)/tests_extractor$(DOTEXE)
PUBLICTESTS_DIR=$(ROOT)/publictests
diff --git a/std/datetime/timezone.d b/std/datetime/timezone.d
index 7461fcaa3..05c2999d3 100644
--- a/std/datetime/timezone.d
+++ b/std/datetime/timezone.d
@@ -338,6 +338,7 @@ public:
else version (linux) enum utcZone = "UTC";
else version (Darwin) enum utcZone = "UTC";
else version (Solaris) enum utcZone = "UTC";
+ else version (Hurd) enum utcZone = "UTC";
else static assert(0, "The location of the UTC timezone file on this Posix platform must be set.");
auto tzs = [testTZ("America/Los_Angeles", "PST", "PDT", dur!"hours"(-8), dur!"hours"(1)),
diff --git a/std/math/algebraic.d b/std/math/algebraic.d
index f96f24f15..05bf08b9c 100644
--- a/std/math/algebraic.d
+++ b/std/math/algebraic.d
@@ -631,6 +631,7 @@ else version (FreeBSD) version = GenericPosixVersion;
else version (OpenBSD) version = GenericPosixVersion;
else version (Solaris) version = GenericPosixVersion;
else version (DragonFlyBSD) version = GenericPosixVersion;
+else version (Hurd) version = GenericPosixVersion;
private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
{
diff --git a/std/process.d b/std/process.d
index d359ca0ba..dc981c5e5 100644
--- a/std/process.d
+++ b/std/process.d
@@ -1031,6 +1031,8 @@ private Pid spawnProcessPosix(scope const(char[])[] args,
import core.sys.freebsd.unistd : closefrom;
else version (OpenBSD)
import core.sys.openbsd.unistd : closefrom;
+ else version (Hurd)
+ import core.sys.hurd.unistd : closefrom;
static if (!__traits(compiles, closefrom))
{
--
2.52.0