diff mbox series

[bug#55999,v3,3/3] guix: Modernize dub-build-system somewhat.

Message ID 20220624175628.7877-3-paren@disroot.org
State Accepted
Headers show
Series [bug#55999,v3,1/3] gnu: packages: Replace rdmd with d-tools. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

\( June 24, 2022, 5:56 p.m. UTC
* guix/build-system/dub.scm (default-ld-gold-wrapper): New variable.
(lower): Add keyed argument ld-gold-wrapper.
[bag]<build-inputs>: Add ld-gold-wrapper.
* guix/build/dub-build-system.scm (configure): Remove trailing #t, and
  fix docstring formatting.
(build): Remove trailing #t, and avoid substituting ".dub/dub.json" as
Dub no longer produces it.
(check): Same as (build).
(install): Remove trailing #t.
---
 guix/build-system/dub.scm       |  8 ++++++++
 guix/build/dub-build-system.scm | 26 ++++++++------------------
 2 files changed, 16 insertions(+), 18 deletions(-)

Comments

Tobias Geerinckx-Rice June 25, 2022, 9:37 p.m. UTC | #1
Hi ),

I split these patches up into more atomic parts, made a few minor 
tweaks I deemed fit, and pushed them to master in two stages as 
4c63796545ce2a1f7cd556a831bb92c7b3166358 et al and 
30edb241a9ba50fefbd08438b5ffba25b10c6e61 et al.

Thanks!

T G-R
diff mbox series

Patch

diff --git a/guix/build-system/dub.scm b/guix/build-system/dub.scm
index 55ad7decb8..1577f4a0c7 100644
--- a/guix/build-system/dub.scm
+++ b/guix/build-system/dub.scm
@@ -51,6 +51,12 @@  (define (default-pkg-config)
   (let ((pkg-config (resolve-interface '(gnu packages pkg-config))))
     (module-ref pkg-config 'pkg-config)))
 
+;; LDC doesn't work with the bfd linker.
+(define (default-ld-gold-wrapper)
+  "Return the default ld-gold-wrapper package."
+  (let ((commencement (resolve-interface '(gnu packages commencement))))
+    (module-ref commencement 'ld-gold-wrapper)))
+
 (define %dub-build-system-modules
   ;; Build-side modules imported by default.
   `((guix build dub-build-system)
@@ -100,6 +106,7 @@  (define* (lower name
                 (ldc (default-ldc))
                 (dub (default-dub))
                 (pkg-config (default-pkg-config))
+                (ld-gold-wrapper (default (default-ld-gold-wrapper)))
                 #:allow-other-keys
                 #:rest arguments)
   "Return a bag for NAME."
@@ -121,6 +128,7 @@  (define private-keywords
                         ,@(standard-packages)))
          (build-inputs `(("ldc" ,ldc)
                          ("dub" ,dub)
+                         ("ld-gold-wrapper" ,ld-gold-wrapper)
                          ,@native-inputs))
          (outputs outputs)
          (build dub-build)
diff --git a/guix/build/dub-build-system.scm b/guix/build/dub-build-system.scm
index 3ab50733de..9ee0433ffd 100644
--- a/guix/build/dub-build-system.scm
+++ b/guix/build/dub-build-system.scm
@@ -48,10 +48,10 @@  (define (package-name->d-package-name name)
     (_ #f)))
 
 (define* (configure #:key inputs #:allow-other-keys)
-  "Prepare one new directory with all the required dependencies.
-   It's necessary to do this (instead of just using /gnu/store as the
-   directory) because we want to hide the libraries in subdirectories
-   lib/dub/... instead of polluting the user's profile root."
+  "Prepare one new directory with all the required dependencies. It's necessary
+to do this (instead of just using /gnu/store as the directory) because we want
+to hide the libraries in subdirectories lib/dub/... instead of polluting the
+user's profile root."
   (let* ((dir (mkdtemp! "/tmp/dub.XXXXXX"))
          (vendor-dir (string-append dir "/vendor")))
     (setenv "HOME" dir)
@@ -67,8 +67,7 @@  (define* (configure #:key inputs #:allow-other-keys)
                 (symlink (string-append path "/lib/dub/" d-basename)
                          (string-append vendor-dir "/" d-basename))))))))
       inputs)
-    (invoke "dub" "add-path" vendor-dir)
-    #t))
+    (invoke "dub" "add-path" vendor-dir)))
 
 (define (grep string file-name)
   "Find the first occurrence of STRING in the file named FILE-NAME.
@@ -92,19 +91,11 @@  (define* (build #:key (dub-build-flags '())
   (unless (or (grep* "sourceLibrary" "package.json")
               (grep* "sourceLibrary" "dub.sdl") ; note: format is different!
               (grep* "sourceLibrary" "dub.json"))
-    (apply invoke `("dub" "build" ,@dub-build-flags))
-    (substitute* ".dub/dub.json"
-      (("\"lastUpgrade\": \"[^\"]*\"")
-       "\"lastUpgrade\": \"1970-01-01T00:00:00.0000000\"")))
-  #t)
+    (apply invoke `("dub" "build" ,@dub-build-flags))))
 
 (define* (check #:key tests? #:allow-other-keys)
   (when tests?
-    (invoke "dub" "test")
-    (substitute* ".dub/dub.json"
-      (("\"lastUpgrade\": \"[^\"]*\"")
-       "\"lastUpgrade\": \"1970-01-01T00:00:00.0000000\"")))
-  #t)
+    (invoke "dub" "test")))
 
 (define* (install #:key inputs outputs #:allow-other-keys)
   "Install a given DUB package."
@@ -115,8 +106,7 @@  (define* (install #:key inputs outputs #:allow-other-keys)
     ;; TODO remove "-test-application"
     (copy-recursively "bin" outbin)
     (mkdir-p outlib)
-    (copy-recursively "." (string-append outlib))
-    #t))
+    (copy-recursively "." (string-append outlib))))
 
 (define %standard-phases
   (modify-phases gnu:%standard-phases