summaryrefslogtreecommitdiff
path: root/gnu/packages/dlang.scm
diff options
context:
space:
mode:
authorJonas Meeuws <jonas.meeuws@gmail.com>2026-07-18 17:01:07 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-08-22 16:49:15 +0200
commit87949b1b6438b63eb679e81c155dab24fb18fd3e (patch)
tree0cd4d9265f2d21b986d96969531bfb47c8f18628 /gnu/packages/dlang.scm
parent10d6c99d9ac429bf6f5ec71f8e0c291299da2abd (diff)
gnu: ldc: Use G-Expressions.
* gnu/packages/dlang.scm (ldc-bootstrap, ldc)[arguments]: Convert to list of G-Expressions. Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu/packages/dlang.scm')
-rw-r--r--gnu/packages/dlang.scm377
1 files changed, 188 insertions, 189 deletions
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 6d4b65844ea..59aa2ffb0ad 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -82,32 +82,33 @@
82 (patches (search-patches "ldc-i686-int128-alignment.patch")))) 82 (patches (search-patches "ldc-i686-int128-alignment.patch"))))
83 (build-system cmake-build-system) 83 (build-system cmake-build-system)
84 (arguments 84 (arguments
85 `(#:disallowed-references (,tzdata-for-tests) 85 (list
86 #:tests? #f ; skip in the bootstrap 86 #:disallowed-references (list tzdata-for-tests)
87 #:build-type "Release" 87 #:tests? #f ; skip in the bootstrap
88 #:configure-flags 88 #:build-type "Release"
89 (list "-GNinja" 89 #:configure-flags
90 #~(list "-GNinja"
90 "-DBUILD_SHARED_LIBS=OFF"); see .github/actions/2-build-bootstrap 91 "-DBUILD_SHARED_LIBS=OFF"); see .github/actions/2-build-bootstrap
91 #:make-flags (list "all") ; used as build targets 92 #:make-flags #~(list "all") ; used as build targets
92 #:phases 93 #:phases
93 (modify-phases %standard-phases 94 #~(modify-phases %standard-phases
94 (add-after 'unpack 'patch-paths 95 (add-after 'unpack 'patch-paths
95 (lambda* (#:key inputs #:allow-other-keys) 96 (lambda* (#:key inputs #:allow-other-keys)
96 (substitute* "runtime/phobos/std/process.d" 97 (substitute* "runtime/phobos/std/process.d"
97 (("/bin/sh") (which "sh")) 98 (("/bin/sh") (which "sh"))
98 (("echo") (which "echo"))))) 99 (("echo") (which "echo")))))
99 (replace 'build 100 (replace 'build
100 ;; Building with Make would result in "make: *** [Makefile:166: 101 ;; Building with Make would result in "make: *** [Makefile:166:
101 ;; all] Error 2". 102 ;; all] Error 2".
102 (lambda* (#:key make-flags parallel-build? #:allow-other-keys) 103 (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
103 (let ((job-count (number->string (or (and parallel-build? 104 (let ((job-count (number->string (or (and parallel-build?
104 (parallel-job-count)) 105 (parallel-job-count))
105 1)))) 106 1))))
106 (apply invoke "cmake" "--build" "." "-j" job-count 107 (apply invoke "cmake" "--build" "." "-j" job-count
107 "--target" make-flags)))) 108 "--target" make-flags))))
108 (replace 'install 109 (replace 'install
109 (lambda _ 110 (lambda _
110 (invoke "cmake" "--install" ".")))))) 111 (invoke "cmake" "--install" "."))))))
111 (inputs 112 (inputs
112 `(("zlib" ,zlib))) 113 `(("zlib" ,zlib)))
113 (native-inputs 114 (native-inputs
@@ -145,181 +146,179 @@ bootstrapping more recent compilers written in D.")
145 (substitute-keyword-arguments 146 (substitute-keyword-arguments
146 (strip-keyword-arguments '(#:tests?) (package-arguments ldc-bootstrap)) 147 (strip-keyword-arguments '(#:tests?) (package-arguments ldc-bootstrap))
147 ((#:make-flags _ #f) 148 ((#:make-flags _ #f)
148 '(list "all" 149 #~(list "all"
149 ;; Also build the test runner binaries. 150 ;; Also build the test runner binaries.
150 "ldc2-unittest" "all-test-runners")) 151 "ldc2-unittest" "all-test-runners"))
151 ((#:configure-flags _ #~'()) 152 ((#:configure-flags _ #~'())
152 `(list "-GNinja" 153 #~(list "-GNinja"
153 "-DBUILD_SHARED_LIBS=ON" 154 "-DBUILD_SHARED_LIBS=ON"
154 ,@(if (target-riscv64?) 155 #$@(if (target-riscv64?)
155 `("-DCMAKE_EXE_LINKER_FLAGS=-latomic") 156 #~("-DCMAKE_EXE_LINKER_FLAGS=-latomic")
156 '()))) 157 #~())))
157 ((#:phases phases) 158 ((#:phases phases)
158 `(modify-phases ,phases 159 #~(modify-phases #$phases
159 (add-after 'unpack 'fix-compiler-rt-library-discovery 160 (add-after 'unpack 'fix-compiler-rt-library-discovery
160 (lambda* (#:key inputs #:allow-other-keys) 161 (lambda* (#:key inputs #:allow-other-keys)
161 (let ((clang-runtime (assoc-ref inputs "clang-runtime")) 162 (let ((clang-runtime (assoc-ref inputs "clang-runtime"))
162 (system ,(or (%current-target-system) 163 (system #$(or (%current-target-system)
163 (%current-system)))) 164 (%current-system))))
164 (define (gnu-triplet->clang-arch system) 165 (define (gnu-triplet->clang-arch system)
165 (let ((system-prefix 166 (let ((system-prefix
166 (car (string-tokenize 167 (car (string-tokenize
167 system (char-set-complement (char-set #\-)))))) 168 system (char-set-complement (char-set #\-))))))
168 (cond 169 (cond
169 ((equal? system-prefix "i686") "i386") 170 ((equal? system-prefix "i686") "i386")
170 (#t system-prefix)))) 171 (#t system-prefix))))
171 ;; Coax LLVM into agreeing with Clang about system target 172 ;; Coax LLVM into agreeing with Clang about system target
172 ;; naming. 173 ;; naming.
173 (substitute* "driver/linker-gcc.cpp" 174 (substitute* "driver/linker-gcc.cpp"
174 (("triple.getArchName\\(\\)") 175 (("triple.getArchName\\(\\)")
175 (format #f "~s" (gnu-triplet->clang-arch system)))) 176 (format #f "~s" (gnu-triplet->clang-arch system))))
176 ;; Augment the configuration of the ldc2 binaries so they can 177 ;; Augment the configuration of the ldc2 binaries so they can
177 ;; find the compiler-rt libraries they need to be linked with 178 ;; find the compiler-rt libraries they need to be linked with
178 ;; for the tests. 179 ;; for the tests.
179 (substitute* (find-files "." "^ldc2.*\\.conf\\.in$") 180 (substitute* (find-files "." "^ldc2.*\\.conf\\.in$")
180 ((".*LIB_SUFFIX.*" all) 181 ((".*LIB_SUFFIX.*" all)
181 (string-append all 182 (string-append all
182 " \"" clang-runtime 183 " \"" clang-runtime
183 "/lib/linux\",\n")))))) 184 "/lib/linux\",\n"))))))
184 (add-after 'unpack 'patch-paths-in-tests 185 (add-after 'unpack 'patch-paths-in-tests
185 (lambda _ 186 (lambda _
186 (substitute* "runtime/druntime/test/profile/Makefile" 187 (substitute* "runtime/druntime/test/profile/Makefile"
187 (("/bin/bash") (which "bash"))) 188 (("/bin/bash") (which "bash")))
188 (substitute* "tests/driver/cli_CC_envvar.d" 189 (substitute* "tests/driver/cli_CC_envvar.d"
189 (("cc") (which "clang"))) 190 (("cc") (which "clang")))
190 (substitute* "tests/linking/linker_switches.d" 191 (substitute* "tests/linking/linker_switches.d"
191 (("echo") (which "echo"))) 192 (("echo") (which "echo")))
192 (substitute* "tests/dmd/dshell/test6952.d" 193 (substitute* "tests/dmd/dshell/test6952.d"
193 (("/usr/bin/env bash") 194 (("/usr/bin/env bash")
194 (which "bash"))))) 195 (which "bash")))))
195 (add-after 'unpack 'disable-problematic-tests 196 (add-after 'unpack 'disable-problematic-tests
196 (lambda* (#:key inputs #:allow-other-keys) 197 (lambda* (#:key inputs #:allow-other-keys)
197 ;; Disable unittests in the following files. 198 ;; Disable unittests in the following files.
198 (substitute* '("runtime/phobos/std/net/curl.d" 199 (substitute* '("runtime/phobos/std/net/curl.d"
199 "runtime/phobos/std/datetime/systime.d" 200 "runtime/phobos/std/datetime/systime.d"
200 "runtime/phobos/std/datetime/timezone.d") 201 "runtime/phobos/std/datetime/timezone.d")
201 (("version(unittest)") "version(skipunittest)") 202 (("version(unittest)") "version(skipunittest)")
202 ((" unittest") " version(skipunittest) unittest")) 203 ((" unittest") " version(skipunittest) unittest"))
203 ;; The following tests plugins we don't have. 204 ;; The following tests plugins we don't have.
204 (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d") 205 (delete-file "tests/plugins/addFuncEntryCall/testPlugin.d")
205 (delete-file "tests/plugins/addFuncEntryCall/testPluginLegacy.d") 206 (delete-file "tests/plugins/addFuncEntryCall/testPluginLegacy.d")
206 ;; This unit test requires networking, fails with 207 ;; This unit test requires networking, fails with
207 ;; "core.exception.RangeError@std/socket.d(778): Range 208 ;; "core.exception.RangeError@std/socket.d(778): Range
208 ;; violation". 209 ;; violation".
209 (substitute* "runtime/phobos/std/socket.d" 210 (substitute* "runtime/phobos/std/socket.d"
210 (("assert\\(ih.addrList\\[0\\] == 0x7F_00_00_01\\);.*") 211 (("assert\\(ih.addrList\\[0\\] == 0x7F_00_00_01\\);.*")
211 "")) 212 ""))
212 213
213 ;; These tests fail on riscv64-linux. 214 ;; These tests fail on riscv64-linux.
214 (substitute* "runtime/phobos/std/math/operations.d" 215 (substitute* "runtime/phobos/std/math/operations.d"
215 (("static assert\\(getNaNPayload\\(a\\)" all ) 216 (("static assert\\(getNaNPayload\\(a\\)" all )
216 (string-append "// " all))) 217 (string-append "// " all)))
217 (substitute* "runtime/phobos/std/math/traits.d" 218 (substitute* "runtime/phobos/std/math/traits.d"
218 (("static assert\\(signbit\\(-.*\\.nan" all) 219 (("static assert\\(signbit\\(-.*\\.nan" all)
219 (string-append "// " all))) 220 (string-append "// " all)))
220 221
221 ;; The GDB tests suite fails; there are a few bug reports about 222 ;; The GDB tests suite fails; there are a few bug reports about
222 ;; it upstream. 223 ;; it upstream.
223 (for-each delete-file (find-files "tests" "gdb.*\\.(c|d|sh)$")) 224 (for-each delete-file (find-files "tests" "gdb.*\\.(c|d|sh)$"))
224 (delete-file "tests/dmd/runnable/b18504.d") 225 (delete-file "tests/dmd/runnable/b18504.d")
225 (substitute* "runtime/druntime/test/exceptions/Makefile" 226 (substitute* "runtime/druntime/test/exceptions/Makefile"
226 ((".*TESTS\\+=rt_trap_exceptions_drt_gdb.*") 227 ((".*TESTS\\+=rt_trap_exceptions_drt_gdb.*")
227 "")) 228 ""))
228 ;; Unsupported with glibc-2.35. 229 ;; Unsupported with glibc-2.35.
229 (delete-file "tests/dmd/compilable/stdcheaders.c") 230 (delete-file "tests/dmd/compilable/stdcheaders.c")
230 (delete-file "tests/dmd/compilable/test23958.c") 231 (delete-file "tests/dmd/compilable/test23958.c")
231 (delete-file "tests/dmd/runnable/test23889.c") 232 (delete-file "tests/dmd/runnable/test23889.c")
232 (delete-file "tests/dmd/runnable/test23402.d") 233 (delete-file "tests/dmd/runnable/test23402.d")
233 (delete-file "tests/dmd/runnable/helloc.c") 234 (delete-file "tests/dmd/runnable/helloc.c")
234 ;; Only works in 2024 and without SOURCE_DATE_EPOCH 235 ;; Only works in 2024 and without SOURCE_DATE_EPOCH
235 (delete-file "tests/dmd/compilable/ddocYear.d") 236 (delete-file "tests/dmd/compilable/ddocYear.d")
236 ;; Drop gdb_dflags from the test suite. 237 ;; Drop gdb_dflags from the test suite.
237 (substitute* "tests/dmd/CMakeLists.txt" 238 (substitute* "tests/dmd/CMakeLists.txt"
238 (("\\$\\{gdb_dflags\\}") "")) 239 (("\\$\\{gdb_dflags\\}") ""))
239 ;; The following tests fail on some systems, not all of 240 ;; The following tests fail on some systems, not all of
240 ;; which are tested upstream. 241 ;; which are tested upstream.
241 (with-directory-excursion "tests" 242 (with-directory-excursion "tests"
242 (cond 243 (cond
243 (,(or (target-x86-32?) 244 (#$(or (target-x86-32?)
244 (target-arm32?)) 245 (target-arm32?))
245 (for-each delete-file 246 (for-each delete-file
246 '("PGO/profile_rt_calls.d" 247 '("PGO/profile_rt_calls.d"
247 "codegen/mangling.d" 248 "codegen/mangling.d"
248 "instrument/xray_check_pipeline.d" 249 "instrument/xray_check_pipeline.d"
249 "instrument/xray_link.d" 250 "instrument/xray_link.d"
250 "instrument/xray_simple_execution.d" 251 "instrument/xray_simple_execution.d"
251 "sanitizers/msan_noerror.d" 252 "sanitizers/msan_noerror.d"
252 "sanitizers/msan_uninitialized.d" 253 "sanitizers/msan_uninitialized.d"
253 "dmd/runnable_cxx/cppa.d"))) 254 "dmd/runnable_cxx/cppa.d")))
254 (,(target-riscv64?) 255 (#$(target-riscv64?)
255 (for-each delete-file 256 (for-each delete-file
256 '("codegen/simd_alignment.d" 257 '("codegen/simd_alignment.d"
257 "dmd/runnable/argufilem.d" 258 "dmd/runnable/argufilem.d"
258 "dmd/compilable/test23705.d" 259 "dmd/compilable/test23705.d"
259 "dmd/fail_compilation/diag7420.d"))) 260 "dmd/fail_compilation/diag7420.d")))
260 (#t '()))))) 261 (#t '())))))
261 ;; The tests require to be built with Clang; build everything 262 ;; The tests require to be built with Clang; build everything
262 ;; with it, for simplicity. 263 ;; with it, for simplicity.
263 (add-before 'configure 'set-cc-and-cxx-to-use-clang 264 (add-before 'configure 'set-cc-and-cxx-to-use-clang
264 (lambda _ 265 (lambda _
265 (setenv "CC" (which "clang")) 266 (setenv "CC" (which "clang"))
266 (setenv "CXX" (which "clang++")))) 267 (setenv "CXX" (which "clang++"))))
267 (replace 'check 268 (replace 'check
268 (lambda* (#:key tests? parallel-tests? #:allow-other-keys) 269 (lambda* (#:key tests? parallel-tests? #:allow-other-keys)
269 (when tests? 270 (when tests?
270 (let ((job-count (number->string 271 (let ((job-count (number->string
271 (or (and parallel-tests? 272 (or (and parallel-tests?
272 (parallel-job-count)) 273 (parallel-job-count))
273 1)))) 274 1))))
274 ;; The test targets are tested separately to provide 275 ;; The test targets are tested separately to provide
275 ;; finer-grained diagnostics (see: 276 ;; finer-grained diagnostics (see:
276 ;; https://raw.githubusercontent.com/ldc-developers/ 277 ;; https://raw.githubusercontent.com/ldc-developers/
277 ;; ldc/master/.azure-pipelines/3-posix-test.yml) 278 ;; ldc/master/.azure-pipelines/3-posix-test.yml)
278 (display "running the ldc2 unit tests...\n") 279 (display "running the ldc2 unit tests...\n")
279 (invoke "ctest" "--output-on-failure" "-j" job-count 280 (invoke "ctest" "--output-on-failure" "-j" job-count
280 "-R" "ldc2-unittest") 281 "-R" "ldc2-unittest")
281 (display "running the lit test suite...\n") 282 (display "running the lit test suite...\n")
282 (invoke "ctest" "--output-on-failure" "-j" job-count 283 (invoke "ctest" "--output-on-failure" "-j" job-count
283 "-R" "lit-tests") 284 "-R" "lit-tests")
284 (display "running the dmd test suite...\n") 285 (display "running the dmd test suite...\n")
285 ;; This test has a race condition so run it with 1 core. 286 ;; This test has a race condition so run it with 1 core.
286 (invoke "ctest" "--output-on-failure" "-j" "1" 287 (invoke "ctest" "--output-on-failure" "-j" "1"
287 "-R" "dmd-testsuite") 288 "-R" "dmd-testsuite")
288 (display "running the defaultlib unit tests and druntime \ 289 (display "running the defaultlib unit tests and druntime \
289integration tests...\n") 290integration tests...\n")
290 (invoke 291 (invoke
291 "ctest" "--output-on-failure" "-j" job-count "-E" 292 "ctest" "--output-on-failure" "-j" job-count "-E"
292 (string-append 293 (string-append
293 "dmd-testsuite|lit-tests|ldc2-unittest" 294 "dmd-testsuite|lit-tests|ldc2-unittest"
294 ,@(cond 295 #$@(cond
295 ((target-aarch64?) 296 ((target-aarch64?)
296 `(,(string-append 297 #~("|std.internal.math.gammafunction-shared"
297 "|std.internal.math.gammafunction-shared" 298 "|std.math.exponential-shared"
298 "|std.math.exponential-shared" 299 "|std.internal.math.gammafunction-debug-shared"
299 "|std.internal.math.gammafunction-debug-shared" 300 "|druntime-test-exceptions-debug"))
300 "|druntime-test-exceptions-debug"))) 301 ((target-riscv64?)
301 ((target-riscv64?) 302 #~("|std.internal.math.errorfunction-shared"
302 `(,(string-append 303 "|std.internal.math.gammafunction-shared"
303 "|std.internal.math.errorfunction-shared" 304 "|std.math.exponential-shared"
304 "|std.internal.math.gammafunction-shared" 305 "|std.math.trigonometry-shared"
305 "|std.math.exponential-shared" 306 "|std.mathspecial-shared"
306 "|std.math.trigonometry-shared" 307 "|std.socket-shared"
307 "|std.mathspecial-shared" 308 "|std.internal.math.errorfunction-debug-shared"
308 "|std.socket-shared" 309 "|std.internal.math.gammafunction-debug-shared"
309 "|std.internal.math.errorfunction-debug-shared" 310 "|std.math.operations-debug-shared"
310 "|std.internal.math.gammafunction-debug-shared" 311 "|std.math.exponential-debug-shared"
311 "|std.math.operations-debug-shared" 312 "|std.math.traits-debug-shared"
312 "|std.math.exponential-debug-shared" 313 "|std.mathspecial-debug-shared"
313 "|std.math.traits-debug-shared" 314 "|std.math.trigonometry-debug-shared"
314 "|std.mathspecial-debug-shared" 315 "|std.socket-debug-shared"
315 "|std.math.trigonometry-debug-shared" 316 ;; These four hang forever
316 "|std.socket-debug-shared" 317 "|core.thread.fiber-shared"
317 ;; These four hang forever 318 "|core.thread.osthread-shared"
318 "|core.thread.fiber-shared" 319 "|core.thread.fiber-debug-shared"
319 "|core.thread.osthread-shared" 320 "|core.thread.osthread-debug-shared"))
320 "|core.thread.fiber-debug-shared" 321 (#t #~()))))))))))))
321 "|core.thread.osthread-debug-shared")))
322 (#t `("")))))))))))))
323 (native-inputs 322 (native-inputs
324 (modify-inputs native-inputs 323 (modify-inputs native-inputs
325 (delete "llvm") 324 (delete "llvm")