* [bug#68554] [PATCH 1/3] gnu: Add gdc alias.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-18 0:24 ` Maxim Cournoyer
2024-01-18 0:24 ` [bug#68554] [PATCH 2/3] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
` (4 subsequent siblings)
5 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 0:24 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Maxim Cournoyer, Ludovic Courtès
* gnu/packages/gcc.scm (gdc): New variable.
Change-Id: I38447e46ffba44d3a9d3757d34fe9ff081803457
---
gnu/packages/gcc.scm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 5590cd3d7e..3ee7afb97f 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1118,6 +1118,12 @@ (define-public gdc-11
(custom-gcc gcc-11 "gdc" '("d")
%generic-search-paths)))
+;;; Alias tracking the latest GDC version.
+(define-public gdc
+ (hidden-package
+ (custom-gcc gcc "gdc" '("d")
+ %generic-search-paths)))
+
(define-public (make-libgccjit gcc)
(package
(inherit gcc)
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH 2/3] gnu: gdmd: Replace gdc-11 with gdc alias.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-18 0:24 ` [bug#68554] [PATCH 1/3] gnu: Add gdc alias Maxim Cournoyer
@ 2024-01-18 0:24 ` Maxim Cournoyer
2024-01-18 0:24 ` [bug#68554] [PATCH 3/3] gnu: Add dmd Maxim Cournoyer
` (3 subsequent siblings)
5 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 0:24 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Maxim Cournoyer
* gnu/packages/dlang.scm (gdmd) [inputs]: Replace gdc-11 with gdc.
Change-Id: Ie035bb79c128c266cee85cf11bf79216f4f8b454
---
gnu/packages/dlang.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 61823714f6..5c9766110d 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -136,8 +136,7 @@ (define-public gdmd
(string-append "my $gdc_dir = \""
(dirname (search-input-file inputs "/bin/gdc"))
"\";\n"))))))))
- (inputs
- (list gdc-11 perl))
+ (inputs (list gdc perl))
(home-page "https://github.com/D-Programming-GDC/gdmd")
(synopsis "DMD-like wrapper for GDC")
(description "This package provides a DMD-like wrapper for the
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH 3/3] gnu: Add dmd.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-18 0:24 ` [bug#68554] [PATCH 1/3] gnu: Add gdc alias Maxim Cournoyer
2024-01-18 0:24 ` [bug#68554] [PATCH 2/3] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
@ 2024-01-18 0:24 ` Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
` (2 subsequent siblings)
5 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 0:24 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Maxim Cournoyer
* gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
---
gnu/packages/dlang.scm | 164 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 164 insertions(+)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 5c9766110d..dd7951e01d 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -358,6 +358,170 @@ (define-public ldc
`(("clang" ,clang-14) ;propagates llvm and clang-runtime
("python-lit" ,python-lit))))))
+;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
+;;; library.
+(define dmd-bootstrap
+ (package
+ ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
+ ;; as the final dmd package rewrites references from this one to itself,
+ ;; and their names must have the same length to avoid corrupting the
+ ;; binary.
+ (name "dmd")
+ (version "2.106.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/dmd")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name "dmd" version))
+ (sha256
+ (base32
+ "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:disallowed-references (list (gexp-input (canonical-package gcc)
+ "lib"))
+ ;; Disable tests, as gdmd cannot cope with some arguments used such as
+ ;; '-conf'.
+ #:tests? #f
+ #:test-target "test"
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ ;; XXX: Proceed despite conflicts from symbols provided by both
+ ;; the source built and GDC.
+ "DFLAGS=-L--allow-multiple-definition"
+ "ENABLE_RELEASE=1"
+ (string-append "HOST_CXX=" #$(cxx-for-target))
+ "HOST_DMD=gdmd"
+ (string-append "INSTALL_DIR=" #$output)
+ ;; Do not build the shared libphobos2.so library, to avoid
+ ;; retaining a reference to gcc:lib.
+ "SHARED=0"
+ (string-append "SYSCONFDIR=" #$output "/etc")
+ "VERBOSE=1"
+ "-f" "posix.mak")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'copy-phobos-source-and-chdir
+ ;; Start with building phobos, which in turns will automatically
+ ;; build druntime and dmd. A minimal dmd command is still
+ ;; required to do so, which is why we need dmd-bootstrap-0.
+ (lambda _
+ (symlink "." "dmd") ;to please the build system expected layout
+ (copy-recursively
+ #$(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/phobos")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
+ "phobos")
+ (chdir "phobos")))
+ (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
+ (lambda _
+ (substitute* "posix.mak"
+ ;; Install to lib directory, not to e.g. 'linux/lib64'.
+ (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
+ (string-append #$output "/lib"))
+ ;; Do not install license file, already done by the gnu build
+ ;; system.
+ ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
+ (delete 'configure)
+ (add-after 'install 'install-druntime
+ (lambda args
+ (chdir "../druntime")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir "..")))
+ (add-after 'install-druntime 'install-includes
+ (lambda _
+ ;; Normalize the include files prefix to include/dmd.
+ (let ((include-dir (string-append #$output "/include/dmd")))
+ (mkdir-p include-dir)
+ (rename-file (string-append #$output "/src/phobos")
+ (string-append include-dir))
+ (copy-recursively "druntime/import" include-dir))
+ (delete-file-recursively (string-append #$output "/src"))))
+ (add-after 'install-druntime 'install-dmd
+ (assoc-ref %standard-phases 'install))
+ (add-after 'install-license-files 'refine-install-layout
+ (lambda _
+ (let* ((docdir (string-append #$output "/share/doc/"
+ (strip-store-file-name #$output)))
+ ;; The dmd binary gets installed to
+ ;; e.g. /linux/bin64/dmd.
+ (dmd (car (find-files #$output "^dmd$")))
+ (dmd.conf (car (find-files #$output "^dmd.conf$")))
+ (os-dir (dirname (dirname dmd))))
+ ;; Move samples from root to the doc directory.
+ (rename-file (string-append #$output "/samples")
+ (string-append docdir "/samples"))
+ ;; Remove duplicate license file.
+ (delete-file (string-append #$output
+ "/dmd-boostlicense.txt"))
+ ;; Move dmd binary and dmd.conf.
+ (install-file dmd (string-append #$output "/bin"))
+ (install-file dmd.conf (string-append #$output "/etc"))
+ (delete-file-recursively os-dir))))
+ (add-after 'refine-install-layout 'patch-dmd.conf
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (search-input-file outputs "etc/dmd.conf")
+ (("lib(32|64)")
+ "lib")
+ (("\\.\\./src/(phobos|druntime/import)")
+ "include/dmd")))))))
+ (native-inputs (list gdmd which))
+ (home-page "https://github.com/dlang/dmd")
+ (synopsis "Reference D Programming Language compiler")
+ (description "@acronym{DMD, Digital Mars D compiler} is the reference
+compiler for the D programming language.")
+ (license license:boost1.0)))
+
+;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared
+;;; libraries preserved.
+(define-public dmd
+ (package
+ (inherit dmd-bootstrap)
+ (arguments
+ (substitute-keyword-arguments
+ (strip-keyword-arguments
+ '(#:tests?) ;reinstate tests
+ (package-arguments dmd-bootstrap))
+ ((#:disallowed-references _ ''())
+ (list dmd-bootstrap))
+ ((#:make-flags _ ''())
+ #~(list (string-append "CC=" #$(cc-for-target))
+ "ENABLE_RELEASE=1"
+ (string-append "HOST_CXX=" #$(cxx-for-target))
+ (string-append "INSTALL_DIR=" #$output)
+ "VERBOSE=1"
+ "-f" "posix.mak"))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap
+ ;; DMD keeps references to include files used to build a
+ ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce
+ ;; its closure size.
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (let ((dmd (search-input-file outputs "bin/dmd"))
+ (dmd-bootstrap (dirname
+ (dirname
+ (search-input-file
+ (or native-inputs inputs)
+ "bin/dmd")))))
+ ;; XXX: Use sed, as replace-store-references wouldn't
+ ;; replace the references, while substitute* throws an
+ ;; error.
+ (invoke "sed" "-i"
+ (format #f "s,~a,~a,g" dmd-bootstrap #$output)
+ dmd))))))))
+ (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap)
+ (replace "gdmd" dmd-bootstrap)))))
+
(define-public dub
(package
(name "dub")
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
` (2 preceding siblings ...)
2024-01-18 0:24 ` [bug#68554] [PATCH 3/3] gnu: Add dmd Maxim Cournoyer
@ 2024-01-18 3:28 ` Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 1/3] gnu: Add gdc alias Maxim Cournoyer
` (2 more replies)
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
5 siblings, 3 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 3:28 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
This series adds DMD, bootstrapped via GDC.
Changes in v2:
- Build dmd make flags via inheritance...
- ... fixing the missing SYSCONFDIR make flag
Maxim Cournoyer (3):
gnu: Add gdc alias.
gnu: gdmd: Replace gdc-11 with gdc alias.
gnu: Add dmd.
gnu/packages/dlang.scm | 168 ++++++++++++++++++++++++++++++++++++++++-
gnu/packages/gcc.scm | 6 ++
2 files changed, 172 insertions(+), 2 deletions(-)
base-commit: 8ca490e6600c55b2dab5db12cf1aefa2b1b27f9a
--
2.41.0
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v2 1/3] gnu: Add gdc alias.
2024-01-18 3:28 ` [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-18 3:28 ` Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 2/3] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 3/3] gnu: Add dmd Maxim Cournoyer
2 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 3:28 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Ludovic Courtès
* gnu/packages/gcc.scm (gdc): New variable.
Change-Id: I38447e46ffba44d3a9d3757d34fe9ff081803457
---
(no changes since v1)
gnu/packages/gcc.scm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 5590cd3d7e..3ee7afb97f 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1118,6 +1118,12 @@ (define-public gdc-11
(custom-gcc gcc-11 "gdc" '("d")
%generic-search-paths)))
+;;; Alias tracking the latest GDC version.
+(define-public gdc
+ (hidden-package
+ (custom-gcc gcc "gdc" '("d")
+ %generic-search-paths)))
+
(define-public (make-libgccjit gcc)
(package
(inherit gcc)
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v2 2/3] gnu: gdmd: Replace gdc-11 with gdc alias.
2024-01-18 3:28 ` [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 1/3] gnu: Add gdc alias Maxim Cournoyer
@ 2024-01-18 3:28 ` Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 3/3] gnu: Add dmd Maxim Cournoyer
2 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 3:28 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
* gnu/packages/dlang.scm (gdmd) [inputs]: Replace gdc-11 with gdc.
Change-Id: Ie035bb79c128c266cee85cf11bf79216f4f8b454
---
(no changes since v1)
gnu/packages/dlang.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 61823714f6..5c9766110d 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -136,8 +136,7 @@ (define-public gdmd
(string-append "my $gdc_dir = \""
(dirname (search-input-file inputs "/bin/gdc"))
"\";\n"))))))))
- (inputs
- (list gdc-11 perl))
+ (inputs (list gdc perl))
(home-page "https://github.com/D-Programming-GDC/gdmd")
(synopsis "DMD-like wrapper for GDC")
(description "This package provides a DMD-like wrapper for the
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v2 3/3] gnu: Add dmd.
2024-01-18 3:28 ` [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 1/3] gnu: Add gdc alias Maxim Cournoyer
2024-01-18 3:28 ` [bug#68554] [PATCH v2 2/3] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
@ 2024-01-18 3:28 ` Maxim Cournoyer
2 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-18 3:28 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
* gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
---
Changes in v2:
- Build make flags via inheritance...
- Fixing the missing SYSCONFDIR make flag
gnu/packages/dlang.scm | 165 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 165 insertions(+)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 5c9766110d..f8060fa0c3 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -358,6 +358,171 @@ (define-public ldc
`(("clang" ,clang-14) ;propagates llvm and clang-runtime
("python-lit" ,python-lit))))))
+;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
+;;; library.
+(define dmd-bootstrap
+ (package
+ ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
+ ;; as the final dmd package rewrites references from this one to itself,
+ ;; and their names must have the same length to avoid corrupting the
+ ;; binary.
+ (name "dmd")
+ (version "2.106.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/dmd")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name "dmd" version))
+ (sha256
+ (base32
+ "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:disallowed-references (list (gexp-input (canonical-package gcc)
+ "lib"))
+ ;; Disable tests, as gdmd cannot cope with some arguments used such as
+ ;; '-conf'.
+ #:tests? #f
+ #:test-target "test"
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ ;; XXX: Proceed despite conflicts from symbols provided by both
+ ;; the source built and GDC.
+ "DFLAGS=-L--allow-multiple-definition"
+ "ENABLE_RELEASE=1"
+ (string-append "HOST_CXX=" #$(cxx-for-target))
+ "HOST_DMD=gdmd"
+ (string-append "INSTALL_DIR=" #$output)
+ ;; Do not build the shared libphobos2.so library, to avoid
+ ;; retaining a reference to gcc:lib.
+ "SHARED=0"
+ (string-append "SYSCONFDIR=" #$output "/etc")
+ "VERBOSE=1"
+ "-f" "posix.mak")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'copy-phobos-source-and-chdir
+ ;; Start with building phobos, which in turns will automatically
+ ;; build druntime and dmd. A minimal dmd command is still
+ ;; required to do so, which is why we need dmd-bootstrap-0.
+ (lambda _
+ (symlink "." "dmd") ;to please the build system expected layout
+ (copy-recursively
+ #$(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/phobos")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
+ "phobos")
+ (chdir "phobos")))
+ (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
+ (lambda _
+ (substitute* "posix.mak"
+ ;; Install to lib directory, not to e.g. 'linux/lib64'.
+ (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
+ (string-append #$output "/lib"))
+ ;; Do not install license file, already done by the gnu build
+ ;; system.
+ ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
+ (delete 'configure)
+ (add-after 'install 'install-druntime
+ (lambda args
+ (chdir "../druntime")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir "..")))
+ (add-after 'install-druntime 'install-includes
+ (lambda _
+ ;; Normalize the include files prefix to include/dmd.
+ (let ((include-dir (string-append #$output "/include/dmd")))
+ (mkdir-p include-dir)
+ (rename-file (string-append #$output "/src/phobos")
+ (string-append include-dir))
+ (copy-recursively "druntime/import" include-dir))
+ (delete-file-recursively (string-append #$output "/src"))))
+ (add-after 'install-druntime 'install-dmd
+ (assoc-ref %standard-phases 'install))
+ (add-after 'install-license-files 'refine-install-layout
+ (lambda _
+ (let* ((docdir (string-append #$output "/share/doc/"
+ (strip-store-file-name #$output)))
+ ;; The dmd binary gets installed to
+ ;; e.g. /linux/bin64/dmd.
+ (dmd (car (find-files #$output "^dmd$")))
+ (dmd.conf (car (find-files #$output "^dmd.conf$")))
+ (os-dir (dirname (dirname dmd))))
+ ;; Move samples from root to the doc directory.
+ (rename-file (string-append #$output "/samples")
+ (string-append docdir "/samples"))
+ ;; Remove duplicate license file.
+ (delete-file (string-append #$output
+ "/dmd-boostlicense.txt"))
+ ;; Move dmd binary and dmd.conf.
+ (install-file dmd (string-append #$output "/bin"))
+ (install-file dmd.conf (string-append #$output "/etc"))
+ (delete-file-recursively os-dir))))
+ (add-after 'refine-install-layout 'patch-dmd.conf
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (search-input-file outputs "etc/dmd.conf")
+ (("lib(32|64)")
+ "lib")
+ (("\\.\\./src/(phobos|druntime/import)")
+ "include/dmd")))))))
+ (native-inputs (list gdmd which))
+ (home-page "https://github.com/dlang/dmd")
+ (synopsis "Reference D Programming Language compiler")
+ (description "@acronym{DMD, Digital Mars D compiler} is the reference
+compiler for the D programming language.")
+ (license license:boost1.0)))
+
+;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared
+;;; libraries preserved.
+(define-public dmd
+ (package
+ (inherit dmd-bootstrap)
+ (arguments
+ (substitute-keyword-arguments
+ (strip-keyword-arguments
+ '(#:tests?) ;reinstate tests
+ (package-arguments dmd-bootstrap))
+ ((#:disallowed-references _ ''())
+ (list dmd-bootstrap))
+ ((#:modules _ ''())
+ '((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))) ;for fold
+ ((#:make-flags flags ''())
+ #~(fold delete #$flags '("DFLAGS=-L--allow-multiple-definition"
+ "HOST_DMD=gdmd"
+ "SHARED=0")))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap
+ ;; DMD keeps references to include files used to build a
+ ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce
+ ;; its closure size.
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (let ((dmd (search-input-file outputs "bin/dmd"))
+ (dmd-bootstrap (dirname
+ (dirname
+ (search-input-file
+ (or native-inputs inputs)
+ "bin/dmd")))))
+ ;; XXX: Use sed, as replace-store-references wouldn't
+ ;; replace the references, while substitute* throws an
+ ;; error.
+ (invoke "sed" "-i"
+ (format #f "s,~a,~a,g" dmd-bootstrap #$output)
+ dmd))))))))
+ (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap)
+ (replace "gdmd" dmd-bootstrap)))))
+
(define-public dub
(package
(name "dub")
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
` (3 preceding siblings ...)
2024-01-18 3:28 ` [bug#68554] [PATCH v2 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 1/6] gnu: Add gdc alias Maxim Cournoyer
` (5 more replies)
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
5 siblings, 6 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554
Cc: Maxim Cournoyer, Andreas Enge, Maxim Cournoyer,
宋文武
This series adds DMD, bootstrapped via GDC.
Changes in v3:
- Add packages built from dmd and D demangling support to qt-creator
Changes in v2:
- Build make flags via inheritance...
- Fixing the missing SYSCONFDIR make flag
Maxim Cournoyer (6):
gnu: Add gdc alias.
gnu: gdmd: Replace gdc-11 with gdc alias.
gnu: Add dmd.
gnu: Add rust-rustc-demangle-capi-0.1.
gnu: Add d-demangler.
gnu: qt-creator: Add support for demangling D and Rust symbols.
gnu/packages/crates-io.scm | 31 ++++++
gnu/packages/dlang.scm | 202 ++++++++++++++++++++++++++++++++++++-
gnu/packages/gcc.scm | 6 ++
gnu/packages/qt.scm | 4 +
4 files changed, 240 insertions(+), 3 deletions(-)
base-commit: 0eadd486484fcf9a234758842f74ba28361640db
--
2.41.0
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 1/6] gnu: Add gdc alias.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-24 17:20 ` Ludovic Courtès
2024-01-19 4:40 ` [bug#68554] [PATCH v3 2/6] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
` (4 subsequent siblings)
5 siblings, 1 reply; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Ludovic Courtès
* gnu/packages/gcc.scm (gdc): New variable.
Change-Id: I38447e46ffba44d3a9d3757d34fe9ff081803457
---
(no changes since v1)
gnu/packages/gcc.scm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 6eb01f33a6..5344278174 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1124,6 +1124,12 @@ (define-public gdc-11
(custom-gcc gcc-11 "gdc" '("d")
%generic-search-paths)))
+;;; Alias tracking the latest GDC version.
+(define-public gdc
+ (hidden-package
+ (custom-gcc gcc "gdc" '("d")
+ %generic-search-paths)))
+
(define-public (make-libgccjit gcc)
(package
(inherit gcc)
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 2/6] gnu: gdmd: Replace gdc-11 with gdc alias.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 1/6] gnu: Add gdc alias Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 3/6] gnu: Add dmd Maxim Cournoyer
` (3 subsequent siblings)
5 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
* gnu/packages/dlang.scm (gdmd) [inputs]: Replace gdc-11 with gdc.
Change-Id: Ie035bb79c128c266cee85cf11bf79216f4f8b454
---
(no changes since v1)
gnu/packages/dlang.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 61823714f6..5c9766110d 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -136,8 +136,7 @@ (define-public gdmd
(string-append "my $gdc_dir = \""
(dirname (search-input-file inputs "/bin/gdc"))
"\";\n"))))))))
- (inputs
- (list gdc-11 perl))
+ (inputs (list gdc perl))
(home-page "https://github.com/D-Programming-GDC/gdmd")
(synopsis "DMD-like wrapper for GDC")
(description "This package provides a DMD-like wrapper for the
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 3/6] gnu: Add dmd.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 1/6] gnu: Add gdc alias Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 2/6] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 9:38 ` Efraim Flashner
2024-01-19 4:40 ` [bug#68554] [PATCH v3 4/6] gnu: Add rust-rustc-demangle-capi-0.1 Maxim Cournoyer
` (2 subsequent siblings)
5 siblings, 1 reply; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
* gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
---
Changes in v3:
- Add packages built from dmd and D demangling support to qt-creator
Changes in v2:
- Build make flags via inheritance...
- Fixing the missing SYSCONFDIR make flag
gnu/packages/dlang.scm | 165 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 165 insertions(+)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 5c9766110d..f8060fa0c3 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -358,6 +358,171 @@ (define-public ldc
`(("clang" ,clang-14) ;propagates llvm and clang-runtime
("python-lit" ,python-lit))))))
+;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
+;;; library.
+(define dmd-bootstrap
+ (package
+ ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
+ ;; as the final dmd package rewrites references from this one to itself,
+ ;; and their names must have the same length to avoid corrupting the
+ ;; binary.
+ (name "dmd")
+ (version "2.106.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/dmd")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name "dmd" version))
+ (sha256
+ (base32
+ "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:disallowed-references (list (gexp-input (canonical-package gcc)
+ "lib"))
+ ;; Disable tests, as gdmd cannot cope with some arguments used such as
+ ;; '-conf'.
+ #:tests? #f
+ #:test-target "test"
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ ;; XXX: Proceed despite conflicts from symbols provided by both
+ ;; the source built and GDC.
+ "DFLAGS=-L--allow-multiple-definition"
+ "ENABLE_RELEASE=1"
+ (string-append "HOST_CXX=" #$(cxx-for-target))
+ "HOST_DMD=gdmd"
+ (string-append "INSTALL_DIR=" #$output)
+ ;; Do not build the shared libphobos2.so library, to avoid
+ ;; retaining a reference to gcc:lib.
+ "SHARED=0"
+ (string-append "SYSCONFDIR=" #$output "/etc")
+ "VERBOSE=1"
+ "-f" "posix.mak")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'copy-phobos-source-and-chdir
+ ;; Start with building phobos, which in turns will automatically
+ ;; build druntime and dmd. A minimal dmd command is still
+ ;; required to do so, which is why we need dmd-bootstrap-0.
+ (lambda _
+ (symlink "." "dmd") ;to please the build system expected layout
+ (copy-recursively
+ #$(origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/phobos")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
+ "phobos")
+ (chdir "phobos")))
+ (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
+ (lambda _
+ (substitute* "posix.mak"
+ ;; Install to lib directory, not to e.g. 'linux/lib64'.
+ (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
+ (string-append #$output "/lib"))
+ ;; Do not install license file, already done by the gnu build
+ ;; system.
+ ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
+ (delete 'configure)
+ (add-after 'install 'install-druntime
+ (lambda args
+ (chdir "../druntime")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir "..")))
+ (add-after 'install-druntime 'install-includes
+ (lambda _
+ ;; Normalize the include files prefix to include/dmd.
+ (let ((include-dir (string-append #$output "/include/dmd")))
+ (mkdir-p include-dir)
+ (rename-file (string-append #$output "/src/phobos")
+ (string-append include-dir))
+ (copy-recursively "druntime/import" include-dir))
+ (delete-file-recursively (string-append #$output "/src"))))
+ (add-after 'install-druntime 'install-dmd
+ (assoc-ref %standard-phases 'install))
+ (add-after 'install-license-files 'refine-install-layout
+ (lambda _
+ (let* ((docdir (string-append #$output "/share/doc/"
+ (strip-store-file-name #$output)))
+ ;; The dmd binary gets installed to
+ ;; e.g. /linux/bin64/dmd.
+ (dmd (car (find-files #$output "^dmd$")))
+ (dmd.conf (car (find-files #$output "^dmd.conf$")))
+ (os-dir (dirname (dirname dmd))))
+ ;; Move samples from root to the doc directory.
+ (rename-file (string-append #$output "/samples")
+ (string-append docdir "/samples"))
+ ;; Remove duplicate license file.
+ (delete-file (string-append #$output
+ "/dmd-boostlicense.txt"))
+ ;; Move dmd binary and dmd.conf.
+ (install-file dmd (string-append #$output "/bin"))
+ (install-file dmd.conf (string-append #$output "/etc"))
+ (delete-file-recursively os-dir))))
+ (add-after 'refine-install-layout 'patch-dmd.conf
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (search-input-file outputs "etc/dmd.conf")
+ (("lib(32|64)")
+ "lib")
+ (("\\.\\./src/(phobos|druntime/import)")
+ "include/dmd")))))))
+ (native-inputs (list gdmd which))
+ (home-page "https://github.com/dlang/dmd")
+ (synopsis "Reference D Programming Language compiler")
+ (description "@acronym{DMD, Digital Mars D compiler} is the reference
+compiler for the D programming language.")
+ (license license:boost1.0)))
+
+;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared
+;;; libraries preserved.
+(define-public dmd
+ (package
+ (inherit dmd-bootstrap)
+ (arguments
+ (substitute-keyword-arguments
+ (strip-keyword-arguments
+ '(#:tests?) ;reinstate tests
+ (package-arguments dmd-bootstrap))
+ ((#:disallowed-references _ ''())
+ (list dmd-bootstrap))
+ ((#:modules _ ''())
+ '((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))) ;for fold
+ ((#:make-flags flags ''())
+ #~(fold delete #$flags '("DFLAGS=-L--allow-multiple-definition"
+ "HOST_DMD=gdmd"
+ "SHARED=0")))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap
+ ;; DMD keeps references to include files used to build a
+ ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce
+ ;; its closure size.
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (let ((dmd (search-input-file outputs "bin/dmd"))
+ (dmd-bootstrap (dirname
+ (dirname
+ (search-input-file
+ (or native-inputs inputs)
+ "bin/dmd")))))
+ ;; XXX: Use sed, as replace-store-references wouldn't
+ ;; replace the references, while substitute* throws an
+ ;; error.
+ (invoke "sed" "-i"
+ (format #f "s,~a,~a,g" dmd-bootstrap #$output)
+ dmd))))))))
+ (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap)
+ (replace "gdmd" dmd-bootstrap)))))
+
(define-public dub
(package
(name "dub")
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 3/6] gnu: Add dmd.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 3/6] gnu: Add dmd Maxim Cournoyer
@ 2024-01-19 9:38 ` Efraim Flashner
2024-01-20 4:15 ` Maxim Cournoyer
0 siblings, 1 reply; 29+ messages in thread
From: Efraim Flashner @ 2024-01-19 9:38 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 68554
[-- Attachment #1: Type: text/plain, Size: 10190 bytes --]
On Thu, Jan 18, 2024 at 11:40:41PM -0500, Maxim Cournoyer wrote:
> * gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
>
> Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
> ---
>
> Changes in v3:
> - Add packages built from dmd and D demangling support to qt-creator
>
> Changes in v2:
> - Build make flags via inheritance...
> - Fixing the missing SYSCONFDIR make flag
>
> gnu/packages/dlang.scm | 165 +++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 165 insertions(+)
>
> diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
> index 5c9766110d..f8060fa0c3 100644
> --- a/gnu/packages/dlang.scm
> +++ b/gnu/packages/dlang.scm
> @@ -358,6 +358,171 @@ (define-public ldc
> `(("clang" ,clang-14) ;propagates llvm and clang-runtime
> ("python-lit" ,python-lit))))))
>
> +;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
> +;;; library.
> +(define dmd-bootstrap
> + (package
> + ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
> + ;; as the final dmd package rewrites references from this one to itself,
> + ;; and their names must have the same length to avoid corrupting the
> + ;; binary.
> + (name "dmd")
> + (version "2.106.1")
> + (source (origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/dlang/dmd")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name "dmd" version))
> + (sha256
> + (base32
> + "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
> + (build-system gnu-build-system)
> + (arguments
> + (list
> + #:disallowed-references (list (gexp-input (canonical-package gcc)
> + "lib"))
> + ;; Disable tests, as gdmd cannot cope with some arguments used such as
> + ;; '-conf'.
> + #:tests? #f
> + #:test-target "test"
> + #:make-flags
> + #~(list (string-append "CC=" #$(cc-for-target))
> + ;; XXX: Proceed despite conflicts from symbols provided by both
> + ;; the source built and GDC.
> + "DFLAGS=-L--allow-multiple-definition"
> + "ENABLE_RELEASE=1"
> + (string-append "HOST_CXX=" #$(cxx-for-target))
> + "HOST_DMD=gdmd"
> + (string-append "INSTALL_DIR=" #$output)
> + ;; Do not build the shared libphobos2.so library, to avoid
> + ;; retaining a reference to gcc:lib.
> + "SHARED=0"
> + (string-append "SYSCONFDIR=" #$output "/etc")
> + "VERBOSE=1"
> + "-f" "posix.mak")
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'unpack 'copy-phobos-source-and-chdir
> + ;; Start with building phobos, which in turns will automatically
> + ;; build druntime and dmd. A minimal dmd command is still
> + ;; required to do so, which is why we need dmd-bootstrap-0.
> + (lambda _
> + (symlink "." "dmd") ;to please the build system expected layout
> + (copy-recursively
> + #$(origin
> + (method git-fetch)
> + (uri (git-reference
> + (url "https://github.com/dlang/phobos")
> + (commit (string-append "v" version))))
> + (file-name (git-file-name name version))
you should probably switch name to "phobos", otherwise I assume it'll be
added as dmd. Also, is this the right way to add phobos as an input?
> + (sha256
> + (base32
> + "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
> + "phobos")
> + (chdir "phobos")))
> + (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
> + (lambda _
> + (substitute* "posix.mak"
> + ;; Install to lib directory, not to e.g. 'linux/lib64'.
> + (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
> + (string-append #$output "/lib"))
> + ;; Do not install license file, already done by the gnu build
> + ;; system.
> + ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
> + (delete 'configure)
> + (add-after 'install 'install-druntime
> + (lambda args
> + (chdir "../druntime")
> + (apply (assoc-ref %standard-phases 'install) args)
> + (chdir "..")))
Can this one be:
(with-directory-excursion "../druntime"
(apply (assoc-ref %standard-phases 'install) args))
> + (add-after 'install-druntime 'install-includes
> + (lambda _
> + ;; Normalize the include files prefix to include/dmd.
> + (let ((include-dir (string-append #$output "/include/dmd")))
> + (mkdir-p include-dir)
> + (rename-file (string-append #$output "/src/phobos")
> + (string-append include-dir))
> + (copy-recursively "druntime/import" include-dir))
> + (delete-file-recursively (string-append #$output "/src"))))
> + (add-after 'install-druntime 'install-dmd
> + (assoc-ref %standard-phases 'install))
Is this different than the regular install phase?
> + (add-after 'install-license-files 'refine-install-layout
> + (lambda _
> + (let* ((docdir (string-append #$output "/share/doc/"
> + (strip-store-file-name #$output)))
is strip-store-file-name better than #$name "-" #$version ?
> + ;; The dmd binary gets installed to
> + ;; e.g. /linux/bin64/dmd.
> + (dmd (car (find-files #$output "^dmd$")))
> + (dmd.conf (car (find-files #$output "^dmd.conf$")))
> + (os-dir (dirname (dirname dmd))))
> + ;; Move samples from root to the doc directory.
> + (rename-file (string-append #$output "/samples")
> + (string-append docdir "/samples"))
> + ;; Remove duplicate license file.
> + (delete-file (string-append #$output
> + "/dmd-boostlicense.txt"))
> + ;; Move dmd binary and dmd.conf.
> + (install-file dmd (string-append #$output "/bin"))
> + (install-file dmd.conf (string-append #$output "/etc"))
> + (delete-file-recursively os-dir))))
> + (add-after 'refine-install-layout 'patch-dmd.conf
> + (lambda* (#:key outputs #:allow-other-keys)
> + (substitute* (search-input-file outputs "etc/dmd.conf")
I only see 1 output, so this should probably be
(string-append #$output "/etc/dmd.conf")
> + (("lib(32|64)")
> + "lib")
> + (("\\.\\./src/(phobos|druntime/import)")
> + "include/dmd")))))))
> + (native-inputs (list gdmd which))
> + (home-page "https://github.com/dlang/dmd")
> + (synopsis "Reference D Programming Language compiler")
> + (description "@acronym{DMD, Digital Mars D compiler} is the reference
> +compiler for the D programming language.")
> + (license license:boost1.0)))
> +
> +;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared
> +;;; libraries preserved.
> +(define-public dmd
> + (package
> + (inherit dmd-bootstrap)
> + (arguments
> + (substitute-keyword-arguments
> + (strip-keyword-arguments
> + '(#:tests?) ;reinstate tests
> + (package-arguments dmd-bootstrap))
> + ((#:disallowed-references _ ''())
> + (list dmd-bootstrap))
> + ((#:modules _ ''())
> + '((guix build gnu-build-system)
> + (guix build utils)
> + (srfi srfi-1))) ;for fold
> + ((#:make-flags flags ''())
> + #~(fold delete #$flags '("DFLAGS=-L--allow-multiple-definition"
> + "HOST_DMD=gdmd"
> + "SHARED=0")))
> + ((#:phases phases '%standard-phases)
> + #~(modify-phases #$phases
> + (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap
> + ;; DMD keeps references to include files used to build a
> + ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce
> + ;; its closure size.
> + (lambda* (#:key native-inputs inputs outputs
> + #:allow-other-keys)
> + (let ((dmd (search-input-file outputs "bin/dmd"))
> + (dmd-bootstrap (dirname
> + (dirname
> + (search-input-file
> + (or native-inputs inputs)
> + "bin/dmd")))))
> + ;; XXX: Use sed, as replace-store-references wouldn't
> + ;; replace the references, while substitute* throws an
> + ;; error.
> + (invoke "sed" "-i"
> + (format #f "s,~a,~a,g" dmd-bootstrap #$output)
> + dmd))))))))
> + (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap)
> + (replace "gdmd" dmd-bootstrap)))))
> +
> (define-public dub
> (package
> (name "dub")
> --
> 2.41.0
>
>
>
>
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 3/6] gnu: Add dmd.
2024-01-19 9:38 ` Efraim Flashner
@ 2024-01-20 4:15 ` Maxim Cournoyer
0 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:15 UTC (permalink / raw)
To: Efraim Flashner; +Cc: 68554
Hello!
Efraim Flashner <efraim@flashner.co.il> writes:
> On Thu, Jan 18, 2024 at 11:40:41PM -0500, Maxim Cournoyer wrote:
>> * gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
>>
>> Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
[...]
>> +;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
>> +;;; library.
>> +(define dmd-bootstrap
>> + (package
>> + ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
>> + ;; as the final dmd package rewrites references from this one to itself,
>> + ;; and their names must have the same length to avoid corrupting the
>> + ;; binary.
>> + (name "dmd")
>> + (version "2.106.1")
>> + (source (origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://github.com/dlang/dmd")
>> + (commit (string-append "v" version))))
>> + (file-name (git-file-name "dmd" version))
>> + (sha256
>> + (base32
>> + "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
>> + (build-system gnu-build-system)
>> + (arguments
>> + (list
>> + #:disallowed-references (list (gexp-input (canonical-package gcc)
>> + "lib"))
>> + ;; Disable tests, as gdmd cannot cope with some arguments used such as
>> + ;; '-conf'.
>> + #:tests? #f
>> + #:test-target "test"
>> + #:make-flags
>> + #~(list (string-append "CC=" #$(cc-for-target))
>> + ;; XXX: Proceed despite conflicts from symbols provided by both
>> + ;; the source built and GDC.
>> + "DFLAGS=-L--allow-multiple-definition"
>> + "ENABLE_RELEASE=1"
>> + (string-append "HOST_CXX=" #$(cxx-for-target))
>> + "HOST_DMD=gdmd"
>> + (string-append "INSTALL_DIR=" #$output)
>> + ;; Do not build the shared libphobos2.so library, to avoid
>> + ;; retaining a reference to gcc:lib.
>> + "SHARED=0"
>> + (string-append "SYSCONFDIR=" #$output "/etc")
>> + "VERBOSE=1"
>> + "-f" "posix.mak")
>> + #:phases
>> + #~(modify-phases %standard-phases
>> + (add-after 'unpack 'copy-phobos-source-and-chdir
>> + ;; Start with building phobos, which in turns will automatically
>> + ;; build druntime and dmd. A minimal dmd command is still
>> + ;; required to do so, which is why we need dmd-bootstrap-0.
>> + (lambda _
>> + (symlink "." "dmd") ;to please the build system expected layout
>> + (copy-recursively
>> + #$(origin
>> + (method git-fetch)
>> + (uri (git-reference
>> + (url "https://github.com/dlang/phobos")
>> + (commit (string-append "v" version))))
>> + (file-name (git-file-name name version))
>
> you should probably switch name to "phobos", otherwise I assume it'll be
> added as dmd.
Good catch, done.
> Also, is this the right way to add phobos as an input?
It's the gexp way to add extra source files to a package workspace. We
used to do this via labeled origins, but this is not possible in the
label-less new world. I think it'd be cool to have a procedure that
would take multiple source and merge them into one, possible using a
copy-build-system like "plan" for the layout.
Note: I tried building phobos separately at first, but that was a world
of hurt, and the end result was a seg faulting dmd :-(.
>> + (sha256
>> + (base32
>> + "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
>> + "phobos")
>> + (chdir "phobos")))
>> + (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
>> + (lambda _
>> + (substitute* "posix.mak"
>> + ;; Install to lib directory, not to e.g. 'linux/lib64'.
>> + (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
>> + (string-append #$output "/lib"))
>> + ;; Do not install license file, already done by the gnu build
>> + ;; system.
>> + ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
>> + (delete 'configure)
>> + (add-after 'install 'install-druntime
>> + (lambda args
>> + (chdir "../druntime")
>> + (apply (assoc-ref %standard-phases 'install) args)
>> + (chdir "..")))
>
> Can this one be:
> (with-directory-excursion "../druntime"
> (apply (assoc-ref %standard-phases 'install) args))
Confusingly, no, as what I'm doing here is moving from ./phobos to
./druntime and finally to "."; i.e. the starting directory for the
'install-druntime phase is './phobos', not '.'
Does that make some sense (writing it I'm doubtful, eh) ?
>
>> + (add-after 'install-druntime 'install-includes
>> + (lambda _
>> + ;; Normalize the include files prefix to include/dmd.
>> + (let ((include-dir (string-append #$output "/include/dmd")))
>> + (mkdir-p include-dir)
>> + (rename-file (string-append #$output "/src/phobos")
>> + (string-append include-dir))
>> + (copy-recursively "druntime/import" include-dir))
>> + (delete-file-recursively (string-append #$output "/src"))))
>> + (add-after 'install-druntime 'install-dmd
>> + (assoc-ref %standard-phases 'install))
>
> Is this different than the regular install phase?
I the install phase of druntime doesn't install its import includes, for
some reason, and the install phase of phobos puts them under src/phobos
instead of include/dmd.
>> + (add-after 'install-license-files 'refine-install-layout
>> + (lambda _
>> + (let* ((docdir (string-append #$output "/share/doc/"
>> + (strip-store-file-name #$output)))
>
> is strip-store-file-name better than #$name "-" #$version ?
I got bit by gexps being expanded in-place and not being rewritten in
the inherited package, so to reuse that phase I had to use dynamic
alternatives.
>> + ;; The dmd binary gets installed to
>> + ;; e.g. /linux/bin64/dmd.
>> + (dmd (car (find-files #$output "^dmd$")))
>> + (dmd.conf (car (find-files #$output "^dmd.conf$")))
>> + (os-dir (dirname (dirname dmd))))
>> + ;; Move samples from root to the doc directory.
>> + (rename-file (string-append #$output "/samples")
>> + (string-append docdir "/samples"))
>> + ;; Remove duplicate license file.
>> + (delete-file (string-append #$output
>> + "/dmd-boostlicense.txt"))
>> + ;; Move dmd binary and dmd.conf.
>> + (install-file dmd (string-append #$output "/bin"))
>> + (install-file dmd.conf (string-append #$output "/etc"))
>> + (delete-file-recursively os-dir))))
>> + (add-after 'refine-install-layout 'patch-dmd.conf
>> + (lambda* (#:key outputs #:allow-other-keys)
>> + (substitute* (search-input-file outputs "etc/dmd.conf")
>
> I only see 1 output, so this should probably be
> (string-append #$output "/etc/dmd.conf")
The search-input-file on outputs is a defensive trick: it fails with a
clear error message when the file isn't found (I can't say that much
about substitute* ^^'). So it's used here to test the file got
installed there as expected.
Thanks for taking a look!
--
Maxim
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 4/6] gnu: Add rust-rustc-demangle-capi-0.1.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
` (2 preceding siblings ...)
2024-01-19 4:40 ` [bug#68554] [PATCH v3 3/6] gnu: Add dmd Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 9:38 ` Efraim Flashner
2024-01-19 4:40 ` [bug#68554] [PATCH v3 5/6] gnu: Add d-demangler Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols Maxim Cournoyer
5 siblings, 1 reply; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer, Efraim Flashner
* gnu/packages/crates-io.scm (rust-rustc-demangle-capi-0.1): New variable.
Change-Id: I98afb19ed4bdbcb9107a1ab30af49b055802b8b0
---
(no changes since v1)
gnu/packages/crates-io.scm | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 1bfd8fb143..43d9e3cd60 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -64836,6 +64836,37 @@ (define-public rust-rustc-demangle-0.1
(license (list license:asl2.0
license:expat))))
+(define-public rust-rustc-demangle-capi-0.1
+ (package
+ (name "rust-rustc-demangle-capi")
+ (version "0.1.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (crate-uri "rustc-demangle-capi" version))
+ (file-name (string-append name "-" version ".tar.gz"))
+ (sha256
+ (base32 "1s2g4z1yrh1sxl4qkmpd19ss3x2lr9115vbir7pnhgy63r1d63yv"))))
+ (build-system cargo-build-system)
+ (arguments
+ (list
+ #:cargo-inputs `(("rust-rustc-demangle" ,rust-rustc-demangle-0.1))
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'install 'install-c-library
+ (lambda _
+ (install-file
+ (car (find-files "." "^rustc_demangle\\.h$"))
+ (string-append #$output "/include"))
+ (install-file
+ (car (find-files "." "^librustc_demangle.so$"))
+ (string-append #$output "/lib")))))))
+ (home-page "https://github.com/alexcrichton/rustc-demangle")
+ (synopsis "C API for the @code{rustc-demangle} crate")
+ (description "This package provides a C API library for the
+@code{rustc-demangle} crate.")
+ (license (list license:expat license:asl2.0))))
+
(define-public rust-rustc-hash-1
(package
(name "rust-rustc-hash")
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 4/6] gnu: Add rust-rustc-demangle-capi-0.1.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 4/6] gnu: Add rust-rustc-demangle-capi-0.1 Maxim Cournoyer
@ 2024-01-19 9:38 ` Efraim Flashner
2024-01-20 4:03 ` Maxim Cournoyer
0 siblings, 1 reply; 29+ messages in thread
From: Efraim Flashner @ 2024-01-19 9:38 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: 68554
[-- Attachment #1: Type: text/plain, Size: 2364 bytes --]
This package looks good to me
On Thu, Jan 18, 2024 at 11:40:42PM -0500, Maxim Cournoyer wrote:
> * gnu/packages/crates-io.scm (rust-rustc-demangle-capi-0.1): New variable.
>
> Change-Id: I98afb19ed4bdbcb9107a1ab30af49b055802b8b0
> ---
>
> (no changes since v1)
>
> gnu/packages/crates-io.scm | 31 +++++++++++++++++++++++++++++++
> 1 file changed, 31 insertions(+)
>
> diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
> index 1bfd8fb143..43d9e3cd60 100644
> --- a/gnu/packages/crates-io.scm
> +++ b/gnu/packages/crates-io.scm
> @@ -64836,6 +64836,37 @@ (define-public rust-rustc-demangle-0.1
> (license (list license:asl2.0
> license:expat))))
>
> +(define-public rust-rustc-demangle-capi-0.1
> + (package
> + (name "rust-rustc-demangle-capi")
> + (version "0.1.0")
> + (source
> + (origin
> + (method url-fetch)
> + (uri (crate-uri "rustc-demangle-capi" version))
> + (file-name (string-append name "-" version ".tar.gz"))
> + (sha256
> + (base32 "1s2g4z1yrh1sxl4qkmpd19ss3x2lr9115vbir7pnhgy63r1d63yv"))))
> + (build-system cargo-build-system)
> + (arguments
> + (list
> + #:cargo-inputs `(("rust-rustc-demangle" ,rust-rustc-demangle-0.1))
> + #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'install 'install-c-library
> + (lambda _
> + (install-file
> + (car (find-files "." "^rustc_demangle\\.h$"))
> + (string-append #$output "/include"))
> + (install-file
> + (car (find-files "." "^librustc_demangle.so$"))
> + (string-append #$output "/lib")))))))
> + (home-page "https://github.com/alexcrichton/rustc-demangle")
> + (synopsis "C API for the @code{rustc-demangle} crate")
> + (description "This package provides a C API library for the
> +@code{rustc-demangle} crate.")
> + (license (list license:expat license:asl2.0))))
> +
> (define-public rust-rustc-hash-1
> (package
> (name "rust-rustc-hash")
> --
> 2.41.0
>
>
>
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 5/6] gnu: Add d-demangler.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
` (3 preceding siblings ...)
2024-01-19 4:40 ` [bug#68554] [PATCH v3 4/6] gnu: Add rust-rustc-demangle-capi-0.1 Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 4:40 ` [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols Maxim Cournoyer
5 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554; +Cc: Maxim Cournoyer
* gnu/packages/dlang.scm (d-demangler): New variable.
Change-Id: Ic1dc8fb8adc1b4be859552e4add074a35bdfc6d0
---
(no changes since v1)
gnu/packages/dlang.scm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index f8060fa0c3..cf9d2208d7 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -6,7 +6,7 @@
;;; Copyright © 2017, 2019, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
;;; Copyright © 2021-2023 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2022 ( <paren@disroot.org>
;;; Copyright © 2022 Esther Flashner <esther@flashner.co.il>
;;;
@@ -617,3 +617,35 @@ (define-public gtkd
(synopsis "D binding and OO wrapper of GTK+")
(description "This package provides bindings to GTK+ for D.")
(license license:lgpl2.1)))
+
+(define-public d-demangler
+ (package
+ (name "d-demangler")
+ (version "0.0.2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/lievenhey/d_demangler")
+ (commit (string-append "version-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "13lbbxlaa1mffjs57xchl1g6kyr5lxi0z5x7snyvym0knslxwx2g"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:tests? #f ;no test suite
+ #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
+ "d_demangle")
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'install
+ (lambda _
+ (install-file "libd_demangle.so"
+ (string-append #$output "/lib")))))))
+ (native-inputs (list dmd))
+ (home-page "https://github.com/lievenhey/d_demangler")
+ (synopsis "Utility to demangle D symbols")
+ (description "@command{d_demangle} is a small utility that can be used to
+demangle D symbols. A shared library is also provided.")
+ (license license:gpl3+)))
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
` (4 preceding siblings ...)
2024-01-19 4:40 ` [bug#68554] [PATCH v3 5/6] gnu: Add d-demangler Maxim Cournoyer
@ 2024-01-19 4:40 ` Maxim Cournoyer
2024-01-19 9:38 ` Efraim Flashner
5 siblings, 1 reply; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-19 4:40 UTC (permalink / raw)
To: 68554
Cc: Maxim Cournoyer, Andreas Enge, Maxim Cournoyer,
宋文武
* gnu/packages/qt.scm (qt-creator) [inputs]: Add d-demangler and
rust-rustc-demangle-capi-0.1.
Change-Id: I13122c0d148f283268d59919ade1459b5c7012a5
---
(no changes since v1)
gnu/packages/qt.scm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index a6bbc2429a..ca935ba403 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -71,9 +71,11 @@ (define-module (gnu packages qt)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
+ #:use-module (gnu packages crates-io)
#:use-module (gnu packages cups)
#:use-module (gnu packages curl)
#:use-module (gnu packages databases)
+ #:use-module (gnu packages dlang)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages enchant)
@@ -5150,6 +5152,7 @@ (define-public qt-creator
coreutils-minimal
clang
clazy
+ d-demangler
elfutils
gdb
kcachegrind
@@ -5159,6 +5162,7 @@ (define-public qt-creator
qtdeclarative
qtshadertools
qtsvg
+ rust-rustc-demangle-capi-0.1
yaml-cpp
valgrind
vulkan-loader
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols.
2024-01-19 4:40 ` [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols Maxim Cournoyer
@ 2024-01-19 9:38 ` Efraim Flashner
2024-01-20 4:20 ` Maxim Cournoyer
0 siblings, 1 reply; 29+ messages in thread
From: Efraim Flashner @ 2024-01-19 9:38 UTC (permalink / raw)
To: Maxim Cournoyer; +Cc: Andreas Enge, 宋文武, 68554
[-- Attachment #1: Type: text/plain, Size: 1868 bytes --]
I'm pretty sure dmd would be supported everywhere qtbase is, but
rust-rustc-demangle-capi-0.1 should be wrapped with supported-package?
On Thu, Jan 18, 2024 at 11:40:44PM -0500, Maxim Cournoyer wrote:
> * gnu/packages/qt.scm (qt-creator) [inputs]: Add d-demangler and
> rust-rustc-demangle-capi-0.1.
>
> Change-Id: I13122c0d148f283268d59919ade1459b5c7012a5
> ---
>
> (no changes since v1)
>
> gnu/packages/qt.scm | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
> index a6bbc2429a..ca935ba403 100644
> --- a/gnu/packages/qt.scm
> +++ b/gnu/packages/qt.scm
> @@ -71,9 +71,11 @@ (define-module (gnu packages qt)
> #:use-module (gnu packages cmake)
> #:use-module (gnu packages compression)
> #:use-module (gnu packages cpp)
> + #:use-module (gnu packages crates-io)
> #:use-module (gnu packages cups)
> #:use-module (gnu packages curl)
> #:use-module (gnu packages databases)
> + #:use-module (gnu packages dlang)
> #:use-module (gnu packages documentation)
> #:use-module (gnu packages elf)
> #:use-module (gnu packages enchant)
> @@ -5150,6 +5152,7 @@ (define-public qt-creator
> coreutils-minimal
> clang
> clazy
> + d-demangler
> elfutils
> gdb
> kcachegrind
> @@ -5159,6 +5162,7 @@ (define-public qt-creator
> qtdeclarative
> qtshadertools
> qtsvg
> + rust-rustc-demangle-capi-0.1
> yaml-cpp
> valgrind
> vulkan-loader
> --
> 2.41.0
>
>
>
>
--
Efraim Flashner <efraim@flashner.co.il> רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v3 6/6] gnu: qt-creator: Add support for demangling D and Rust symbols.
2024-01-19 9:38 ` Efraim Flashner
@ 2024-01-20 4:20 ` Maxim Cournoyer
0 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:20 UTC (permalink / raw)
To: Efraim Flashner; +Cc: Andreas Enge, 宋文武, 68554
Hello,
Efraim Flashner <efraim@flashner.co.il> writes:
> I'm pretty sure dmd would be supported everywhere qtbase is, but
> rust-rustc-demangle-capi-0.1 should be wrapped with supported-package?
OK! I wasn't aware of supported-package?, thanks for suggesting.
Should be in v4.
--
Thanks,
Maxim
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler.
2024-01-17 22:41 [bug#68554] [PATCH 0/3] Add DMD, the D language reference compiler Maxim Cournoyer
` (4 preceding siblings ...)
2024-01-19 4:40 ` [bug#68554] [PATCH v3 0/6] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 1/5] gnu: Add gdc alias Maxim Cournoyer
` (4 more replies)
5 siblings, 5 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554
Cc: efraim, Maxim Cournoyer, Andreas Enge, Maxim Cournoyer,
宋文武
This series adds DMD, bootstrapped via GDC.
Changes in v4:
- Name phobos source as "phobos" (thanks to Efraim)
- Only add rust-rustc-demangle-capi-0.1 input if supported
Changes in v3:
- Add packages built from dmd and D demangling support to qt-creator
Changes in v2:
- Build make flags via inheritance...
- Fixing the missing SYSCONFDIR make flag
Maxim Cournoyer (5):
gnu: Add gdc alias.
gnu: gdmd: Replace gdc-11 with gdc alias.
gnu: Add dmd.
gnu: Add d-demangler.
gnu: qt-creator: Add support for demangling D and Rust symbols.
gnu/packages/dlang.scm | 202 ++++++++++++++++++++++++++++++++++++++++-
gnu/packages/gcc.scm | 6 ++
gnu/packages/qt.scm | 41 +++++----
3 files changed, 229 insertions(+), 20 deletions(-)
base-commit: 9c367ee1967b213b507a8bf041ea6c2623ceea96
--
2.41.0
^ permalink raw reply [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 1/5] gnu: Add gdc alias.
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 2/5] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
` (3 subsequent siblings)
4 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554; +Cc: efraim, Maxim Cournoyer, Ludovic Courtès
* gnu/packages/gcc.scm (gdc): New variable.
Change-Id: I38447e46ffba44d3a9d3757d34fe9ff081803457
---
(no changes since v1)
gnu/packages/gcc.scm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 6eb01f33a6..5344278174 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -1124,6 +1124,12 @@ (define-public gdc-11
(custom-gcc gcc-11 "gdc" '("d")
%generic-search-paths)))
+;;; Alias tracking the latest GDC version.
+(define-public gdc
+ (hidden-package
+ (custom-gcc gcc "gdc" '("d")
+ %generic-search-paths)))
+
(define-public (make-libgccjit gcc)
(package
(inherit gcc)
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 2/5] gnu: gdmd: Replace gdc-11 with gdc alias.
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 1/5] gnu: Add gdc alias Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 3/5] gnu: Add dmd Maxim Cournoyer
` (2 subsequent siblings)
4 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554; +Cc: efraim, Maxim Cournoyer
* gnu/packages/dlang.scm (gdmd) [inputs]: Replace gdc-11 with gdc.
Change-Id: Ie035bb79c128c266cee85cf11bf79216f4f8b454
---
(no changes since v1)
gnu/packages/dlang.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 61823714f6..5c9766110d 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -136,8 +136,7 @@ (define-public gdmd
(string-append "my $gdc_dir = \""
(dirname (search-input-file inputs "/bin/gdc"))
"\";\n"))))))))
- (inputs
- (list gdc-11 perl))
+ (inputs (list gdc perl))
(home-page "https://github.com/D-Programming-GDC/gdmd")
(synopsis "DMD-like wrapper for GDC")
(description "This package provides a DMD-like wrapper for the
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 3/5] gnu: Add dmd.
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 1/5] gnu: Add gdc alias Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 2/5] gnu: gdmd: Replace gdc-11 with " Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 4/5] gnu: Add d-demangler Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 5/5] gnu: qt-creator: Add support for demangling D and Rust symbols Maxim Cournoyer
4 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554; +Cc: efraim, Maxim Cournoyer
* gnu/packages/dlang.scm (dmd-bootstrap, dmd): New variables.
Change-Id: I53e00a429e2084a392341ef1bc7ea63f0fcaaab4
---
Changes in v4:
- Name phobos source as "phobos" (thanks to Efraim)
Changes in v3:
- Add packages built from dmd and D demangling support to qt-creator
Changes in v2:
- Build make flags via inheritance...
- Fixing the missing SYSCONFDIR make flag
gnu/packages/dlang.scm | 165 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 165 insertions(+)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 5c9766110d..58411166b7 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -358,6 +358,171 @@ (define-public ldc
`(("clang" ,clang-14) ;propagates llvm and clang-runtime
("python-lit" ,python-lit))))))
+;;; Bootstrap version of phobos that is built with GDC, using GDC's standard
+;;; library.
+(define dmd-bootstrap
+ (package
+ ;; This package is purposefully named just "dmd" and not "dmd-bootstrap",
+ ;; as the final dmd package rewrites references from this one to itself,
+ ;; and their names must have the same length to avoid corrupting the
+ ;; binary.
+ (name "dmd")
+ (version "2.106.1")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dlang/dmd")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name "dmd" version))
+ (sha256
+ (base32
+ "1bq4jws1vns2jjzfz7biyngrx9y5pvvgklymhrvb5kvbzky1ldmy"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:disallowed-references (list (gexp-input (canonical-package gcc)
+ "lib"))
+ ;; Disable tests, as gdmd cannot cope with some arguments used such as
+ ;; '-conf'.
+ #:tests? #f
+ #:test-target "test"
+ #:make-flags
+ #~(list (string-append "CC=" #$(cc-for-target))
+ ;; XXX: Proceed despite conflicts from symbols provided by both
+ ;; the source built and GDC.
+ "DFLAGS=-L--allow-multiple-definition"
+ "ENABLE_RELEASE=1"
+ (string-append "HOST_CXX=" #$(cxx-for-target))
+ "HOST_DMD=gdmd"
+ (string-append "INSTALL_DIR=" #$output)
+ ;; Do not build the shared libphobos2.so library, to avoid
+ ;; retaining a reference to gcc:lib.
+ "SHARED=0"
+ (string-append "SYSCONFDIR=" #$output "/etc")
+ "VERBOSE=1"
+ "-f" "posix.mak")
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'copy-phobos-source-and-chdir
+ ;; Start with building phobos, which in turns will automatically
+ ;; build druntime and dmd. A minimal dmd command is still
+ ;; required to do so, which is why we need dmd-bootstrap-0.
+ (lambda _
+ (symlink "." "dmd") ;to please the build system expected layout
+ (copy-recursively
+ #$(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
+ "1yw7nb5d78cx9m7sfibv7rfc7wj3w0dw9mfk3d269qpfpnwzs4n9")))
+ "phobos")
+ (chdir "phobos")))
+ (add-after 'copy-phobos-source-and-chdir 'adjust-phobos-install-dirs
+ (lambda _
+ (substitute* "posix.mak"
+ ;; Install to lib directory, not to e.g. 'linux/lib64'.
+ (("\\$\\(INSTALL_DIR)/\\$\\(OS)/\\$\\(lib_dir)")
+ (string-append #$output "/lib"))
+ ;; Do not install license file, already done by the gnu build
+ ;; system.
+ ((".*\\$\\(INSTALL_DIR)/phobos-LICENSE.txt.*") ""))))
+ (delete 'configure)
+ (add-after 'install 'install-druntime
+ (lambda args
+ (chdir "../druntime")
+ (apply (assoc-ref %standard-phases 'install) args)
+ (chdir "..")))
+ (add-after 'install-druntime 'install-includes
+ (lambda _
+ ;; Normalize the include files prefix to include/dmd.
+ (let ((include-dir (string-append #$output "/include/dmd")))
+ (mkdir-p include-dir)
+ (rename-file (string-append #$output "/src/phobos")
+ (string-append include-dir))
+ (copy-recursively "druntime/import" include-dir))
+ (delete-file-recursively (string-append #$output "/src"))))
+ (add-after 'install-druntime 'install-dmd
+ (assoc-ref %standard-phases 'install))
+ (add-after 'install-license-files 'refine-install-layout
+ (lambda _
+ (let* ((docdir (string-append #$output "/share/doc/"
+ (strip-store-file-name #$output)))
+ ;; The dmd binary gets installed to
+ ;; e.g. /linux/bin64/dmd.
+ (dmd (car (find-files #$output "^dmd$")))
+ (dmd.conf (car (find-files #$output "^dmd.conf$")))
+ (os-dir (dirname (dirname dmd))))
+ ;; Move samples from root to the doc directory.
+ (rename-file (string-append #$output "/samples")
+ (string-append docdir "/samples"))
+ ;; Remove duplicate license file.
+ (delete-file (string-append #$output
+ "/dmd-boostlicense.txt"))
+ ;; Move dmd binary and dmd.conf.
+ (install-file dmd (string-append #$output "/bin"))
+ (install-file dmd.conf (string-append #$output "/etc"))
+ (delete-file-recursively os-dir))))
+ (add-after 'refine-install-layout 'patch-dmd.conf
+ (lambda* (#:key outputs #:allow-other-keys)
+ (substitute* (search-input-file outputs "etc/dmd.conf")
+ (("lib(32|64)")
+ "lib")
+ (("\\.\\./src/(phobos|druntime/import)")
+ "include/dmd")))))))
+ (native-inputs (list gdmd which))
+ (home-page "https://github.com/dlang/dmd")
+ (synopsis "Reference D Programming Language compiler")
+ (description "@acronym{DMD, Digital Mars D compiler} is the reference
+compiler for the D programming language.")
+ (license license:boost1.0)))
+
+;;; Second bootstrap of DMD, built using dmd-bootstrap, with its shared
+;;; libraries preserved.
+(define-public dmd
+ (package
+ (inherit dmd-bootstrap)
+ (arguments
+ (substitute-keyword-arguments
+ (strip-keyword-arguments
+ '(#:tests?) ;reinstate tests
+ (package-arguments dmd-bootstrap))
+ ((#:disallowed-references _ ''())
+ (list dmd-bootstrap))
+ ((#:modules _ ''())
+ '((guix build gnu-build-system)
+ (guix build utils)
+ (srfi srfi-1))) ;for fold
+ ((#:make-flags flags ''())
+ #~(fold delete #$flags '("DFLAGS=-L--allow-multiple-definition"
+ "HOST_DMD=gdmd"
+ "SHARED=0")))
+ ((#:phases phases '%standard-phases)
+ #~(modify-phases #$phases
+ (add-after 'patch-dmd.conf 'rewrite-references-to-bootstrap
+ ;; DMD keeps references to include files used to build a
+ ;; binary. Rewrite those of dmd-bootstrap to itself, to reduce
+ ;; its closure size.
+ (lambda* (#:key native-inputs inputs outputs
+ #:allow-other-keys)
+ (let ((dmd (search-input-file outputs "bin/dmd"))
+ (dmd-bootstrap (dirname
+ (dirname
+ (search-input-file
+ (or native-inputs inputs)
+ "bin/dmd")))))
+ ;; XXX: Use sed, as replace-store-references wouldn't
+ ;; replace the references, while substitute* throws an
+ ;; error.
+ (invoke "sed" "-i"
+ (format #f "s,~a,~a,g" dmd-bootstrap #$output)
+ dmd))))))))
+ (native-inputs (modify-inputs (package-native-inputs dmd-bootstrap)
+ (replace "gdmd" dmd-bootstrap)))))
+
(define-public dub
(package
(name "dub")
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 4/5] gnu: Add d-demangler.
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
` (2 preceding siblings ...)
2024-01-20 4:37 ` [bug#68554] [PATCH v4 3/5] gnu: Add dmd Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
2024-01-20 4:37 ` [bug#68554] [PATCH v4 5/5] gnu: qt-creator: Add support for demangling D and Rust symbols Maxim Cournoyer
4 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554; +Cc: efraim, Maxim Cournoyer
* gnu/packages/dlang.scm (d-demangler): New variable.
Change-Id: Ic1dc8fb8adc1b4be859552e4add074a35bdfc6d0
---
(no changes since v1)
gnu/packages/dlang.scm | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/dlang.scm b/gnu/packages/dlang.scm
index 58411166b7..e3052cc032 100644
--- a/gnu/packages/dlang.scm
+++ b/gnu/packages/dlang.scm
@@ -6,7 +6,7 @@
;;; Copyright © 2017, 2019, 2022 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
;;; Copyright © 2021-2023 Efraim Flashner <efraim@flashner.co.il>
-;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
+;;; Copyright © 2021, 2024 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2022 ( <paren@disroot.org>
;;; Copyright © 2022 Esther Flashner <esther@flashner.co.il>
;;;
@@ -617,3 +617,35 @@ (define-public gtkd
(synopsis "D binding and OO wrapper of GTK+")
(description "This package provides bindings to GTK+ for D.")
(license license:lgpl2.1)))
+
+(define-public d-demangler
+ (package
+ (name "d-demangler")
+ (version "0.0.2")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/lievenhey/d_demangler")
+ (commit (string-append "version-" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "13lbbxlaa1mffjs57xchl1g6kyr5lxi0z5x7snyvym0knslxwx2g"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:tests? #f ;no test suite
+ #:make-flags #~(list (string-append "CC=" #$(cc-for-target))
+ "d_demangle")
+ #:phases #~(modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'install
+ (lambda _
+ (install-file "libd_demangle.so"
+ (string-append #$output "/lib")))))))
+ (native-inputs (list dmd))
+ (home-page "https://github.com/lievenhey/d_demangler")
+ (synopsis "Utility to demangle D symbols")
+ (description "@command{d_demangle} is a small utility that can be used to
+demangle D symbols. A shared library is also provided.")
+ (license license:gpl3+)))
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread
* [bug#68554] [PATCH v4 5/5] gnu: qt-creator: Add support for demangling D and Rust symbols.
2024-01-20 4:37 ` [bug#68554] [PATCH v4 0/5] Add DMD, the D language reference compiler Maxim Cournoyer
` (3 preceding siblings ...)
2024-01-20 4:37 ` [bug#68554] [PATCH v4 4/5] gnu: Add d-demangler Maxim Cournoyer
@ 2024-01-20 4:37 ` Maxim Cournoyer
4 siblings, 0 replies; 29+ messages in thread
From: Maxim Cournoyer @ 2024-01-20 4:37 UTC (permalink / raw)
To: 68554
Cc: efraim, Maxim Cournoyer, Andreas Enge, Maxim Cournoyer,
宋文武
* gnu/packages/qt.scm (qt-creator) [inputs]: Add d-demangler and
rust-rustc-demangle-capi-0.1 (where supported).
Change-Id: I13122c0d148f283268d59919ade1459b5c7012a5
---
Changes in v4:
- Only add rust-rustc-demangle-capi-0.1 input if supported
gnu/packages/qt.scm | 41 ++++++++++++++++++++++++-----------------
1 file changed, 24 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm
index a6bbc2429a..e3c9f1accd 100644
--- a/gnu/packages/qt.scm
+++ b/gnu/packages/qt.scm
@@ -71,9 +71,11 @@ (define-module (gnu packages qt)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages cpp)
+ #:use-module (gnu packages crates-io)
#:use-module (gnu packages cups)
#:use-module (gnu packages curl)
#:use-module (gnu packages databases)
+ #:use-module (gnu packages dlang)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages enchant)
@@ -5146,23 +5148,28 @@ (define-public qt-creator
vulkan-headers
xvfb-run))
(inputs
- (list bash-minimal
- coreutils-minimal
- clang
- clazy
- elfutils
- gdb
- kcachegrind
- libxkbcommon
- llvm
- qt5compat
- qtdeclarative
- qtshadertools
- qtsvg
- yaml-cpp
- valgrind
- vulkan-loader
- `(,zstd "lib")))
+ (append
+ (list bash-minimal
+ coreutils-minimal
+ clang
+ clazy
+ d-demangler
+ elfutils
+ gdb
+ kcachegrind
+ libxkbcommon
+ llvm
+ qt5compat
+ qtdeclarative
+ qtshadertools
+ qtsvg
+ yaml-cpp
+ valgrind
+ vulkan-loader
+ `(,zstd "lib"))
+ (if (supported-package? rust-rustc-demangle-capi-0.1)
+ (list rust-rustc-demangle-capi-0.1)
+ '())))
(home-page "https://www.qt.io/")
(synopsis "Integrated development environment (IDE) for Qt")
(description "Qt Creator is an IDE tailored to the needs of Qt developers.
--
2.41.0
^ permalink raw reply related [flat|nested] 29+ messages in thread