guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 974b312d93b92cf4d2e6f9b0fc09bb9205298fc2
Author: Sharlatan Hellseher <[email protected]>
AuthorDate: Wed Oct 29 12:49:11 2025 +0000

    gnu: Add go-modernc-org-cc.
    
    * gnu/packages/golang-check.scm (go-modernc-org-ccorpus2): Add a remark
    about provided assets.
    (go-modernc-org-cc-v3, go-modernc-org-cc-v4, go-modernc-org-cc-v5): New
    variables.
    
    Change-Id: Id908e989a752b1e0f8116762641b1c24ab5174ba
---
 gnu/packages/golang-check.scm |  2 ++
 gnu/packages/golang-xyz.scm   | 82 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 84 insertions(+)

diff --git a/gnu/packages/golang-check.scm b/gnu/packages/golang-check.scm
index b05aa5242c..78920ba5b8 100644
--- a/gnu/packages/golang-check.scm
+++ b/gnu/packages/golang-check.scm
@@ -3058,6 +3058,8 @@ advanced Go linter.")
     (synopsis "Continuation of ccorpus using @code{embed.FS}")
     (description
      "This package provides a test corpus of C code.")
+    ;; TODO: assets directory provides a lot of example sources for testing
+    ;; taken from other projects, check it covered by the licenses.
     (license license:bsd-3)))
 
 (define-public go-modernc-org-scannertest
diff --git a/gnu/packages/golang-xyz.scm b/gnu/packages/golang-xyz.scm
index 8a7f8ea23e..64d50fcd67 100644
--- a/gnu/packages/golang-xyz.scm
+++ b/gnu/packages/golang-xyz.scm
@@ -24362,6 +24362,88 @@ follows the GNU
 Program Argument Syntax Conventions}.")
     (license license:gpl3)))
 
+(define-public go-modernc-org-cc-v3
+  ;; XXX: Project distributes v2, v3, v4 and v5 as the same source without 
Golang
+  ;; subdir tags.
+  (package
+    (name "go-modernc-org-cc-v3")
+    (version "4.27.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+              (url "https://gitlab.com/cznic/cc";)
+              (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0hdaaksa2lkad6hfqxcmmmni8pagd8qd5w73gncrr45sj6cj5cg6"))))
+    (build-system go-build-system)
+    (arguments
+     (list
+      #:import-path "modernc.org/cc/v3"
+      #:unpack-path "modernc.org/cc"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'remove-submodules
+            (lambda* (#:key unpack-path #:allow-other-keys)
+              (with-directory-excursion (string-append "src/" unpack-path)
+                (for-each delete-file-recursively
+                          (list "v2" "v4" "v5"))))))))
+    (native-inputs
+     (list go-github-com-dustin-go-humanize
+           go-github-com-google-go-cmp))
+    (propagated-inputs
+     (list go-lukechampine-com-uint128
+           go-modernc-org-mathutil
+           go-modernc-org-strutil
+           go-modernc-org-token))
+    (home-page "https://gitlab.com/cznic/cc";)
+    (synopsis "C99 compiler front end for Golang")
+    (description
+     "This package provides a C99 compiler front end.")
+    (license license:bsd-3)))
+
+(define-public go-modernc-org-cc-v4
+  (package/inherit go-modernc-org-cc-v3
+    (name "go-modernc-org-cc-v4")
+    (arguments
+     (list
+      #:import-path "modernc.org/cc/v4"
+      #:unpack-path "modernc.org/cc"
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'copy-source-assets
+            ;; TODO: Implement in go-build-system to embed the whole
+            ;; directory (fix-embed-files procedure).
+            (lambda _
+              ;; Remove symlinks, to resolve embed files.
+              (delete-file-recursively "src/modernc.org/ccorpus2/assets")
+              (copy-recursively
+               (string-append #$(this-package-native-input
+                                 "go-modernc-org-ccorpus2")
+                              "/src/modernc.org/ccorpus2/assets")
+               "src/modernc.org/ccorpus2/assets"))))))
+    (native-inputs
+     (list go-github-com-dustin-go-humanize
+           go-github-com-pbnjay-memory
+           go-github-com-pmezard-go-difflib
+           go-modernc-org-ccorpus2))
+    (propagated-inputs
+     (list go-modernc-org-mathutil
+           go-modernc-org-opt
+           go-modernc-org-sortutil
+           go-modernc-org-strutil
+           go-modernc-org-token))))
+
+(define-public go-modernc-org-cc-v5
+  (package/inherit go-modernc-org-cc-v4
+    (name "go-modernc-org-cc-v5")
+    (arguments
+     (list
+      #:tests? #f ;XXX: tests compile a lot of extra.
+      #:import-path "modernc.org/cc/v5"
+      #:unpack-path "modernc.org/cc"))))
+
 (define-public go-modernc-org-ebnf
   (package
     (name "go-modernc-org-ebnf")

Reply via email to