diff mbox series

[bug#54335,v3,08/10] gnu: Add go-google-golang-org-protobuf.

Message ID 20220404193208.27634-9-dom@dominicm.dev
State New
Headers show
Series gnu: Add nebula. | expand

Commit Message

Dominic Martinez April 4, 2022, 7:32 p.m. UTC
* gnu/packages/golang.scm (go-google-golang-org-protobuf): New variable.
---

I took this go-google-golang-org-protobuf definition from #54560. I had
disabled builds/tests before because this package has many subpackages and no
top-level files, which the go-build-system doesn't directly support, so this
modifications builds and tests all the subpackages.

 gnu/packages/golang.scm | 43 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 23543a0c2b..db1ea44d8c 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -9954,3 +9954,46 @@  (define-public go-github-com-songgao-water
 library for Go that efficiently works with standard packages like io, bufio,
 etc..  Use waterutil with it to work with TUN/TAP packets/frames.")
     (license license:bsd-3)))
+
+(define-public go-google-golang-org-protobuf
+  (package
+    (name "go-google-golang-org-protobuf")
+    (version "1.28.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://go.googlesource.com/protobuf")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+          (base32 "1nzcc4qc00afi24nb7nlnwyzvvr6b8s8qdrn1sw085nygh2y2x8r"))))
+    (build-system go-build-system)
+    (arguments
+     '(#:import-path "google.golang.org/protobuf"
+       #:phases
+       ;; Build and test all sub-packages
+       (let ((glob-path "google.golang.org/protobuf/..."))
+         (modify-phases %standard-phases
+           (replace 'build
+             (lambda args
+               (apply (assoc-ref %standard-phases
+                                 'build)
+                      `(,@args #:import-path
+                               ,glob-path))))
+           (replace 'check
+             (lambda args
+               (apply (assoc-ref %standard-phases
+                                 'check)
+                      `(,@args #:import-path
+                               ,glob-path))))))))
+    (native-inputs (list go-github-com-google-go-cmp-cmp))
+    (synopsis "Go support for Google's protocol buffers")
+    (description
+     "Go implementation for protocol buffers, which is a
+language-neutral, platform-neutral, extensible mechanism for serializing
+structured data.  The protocol buffer language is a language for
+specifying the schema for structured data.  This schema is compiled into
+language specific bindings.")
+    (home-page "https://go.googlesource.com/protobuf")
+    (license license:bsd-3)))