Hi Noé,
On Tue, 03 Dec 2024 05:15:44 +0800,
Noé Lopez wrote:
>
> [1 <text/plain; utf-8 (quoted-printable)>]
> Hi,
>
> I got my hands on packaging liskvork, a gomoku server. The build fails
> because dependencies of dependencies are not added to the zig cache, and so
> can’t be found correctly by the zig build system.
>
> I attached a patch that reproduces this, a workaround when reproducing the
> steps in a local checkout is to call “zig fetch” on the missing dependencies:
>
> $ zig fetch
> /gnu/store/j0x1vl6w2vgr3fz60l4jgyx5gx53af61-zig-httpz-0-0.7d2ddae/src/zig-httpz-0-0.7d2ddae
> --save=httpz
> warning: overwriting existing dependency named 'httpz'
> $ zig build --summary all
> /home/noe/.cache/zig/p/1220476906a8f57d6cbaaaeb05d44a41311a5bb6ca74bb86bc3aa1467506c241b29b/build.zig.zon:7:20:
> error: invalid URI: UnexpectedCharacter
> $ zig fetch
> /gnu/store/59w4s1g1y4vy4gw3mwn9fjsfcqc5454i-zig-metrics-0-0.fcf9e94/src/zig-metrics-0-0.fcf9e94
> --save=metrics
> $ zig fetch
> /gnu/store/izxqkxplp7alrh0n3c8j8cv277nqa04a-zig-websocket-0-0.cf89cb8/src/zig-websocket-0-0.cf89cb8
> --save=websocket
> $ zig build --summary all
> Build Summary: 5/5 steps succeeded
> install success
> +- install liskvork success
> +- zig build-exe liskvork Debug native-native success 3s MaxRSS:276M
> +- options cached
> +- options cached
>
> This has the issue of adding the packages to build.zig.zon, so a better
> solution is required.
>
> I’m attaching the patch with the liskvork package and dependencies. The error
> can be reproduced with “./pre-inst-env guix build liskvork”.
>
> Have a nice day,
> Noé
Good example, that's the current limitation of #:zig-inputs, and I'm planning to
remove it.
Please apply the attached patch onto your change.
Thanks
diff --git a/gnu/packages/zig-xyz.scm b/gnu/packages/zig-xyz.scm
index 027377fa1b..b98a160e27 100644
--- a/gnu/packages/zig-xyz.scm
+++ b/gnu/packages/zig-xyz.scm
@@ -186,11 +186,20 @@ (define-public zig-logz
(file-name (git-file-name name version))
(sha256
(base32
- "01xihyvyx3rpv0kvjh6mg1b99d6agq683q4iyn39nwqb6ma0i0sz"))))
+ "01xihyvyx3rpv0kvjh6mg1b99d6agq683q4iyn39nwqb6ma0i0sz"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(for-each
+ (lambda (dep)
+ (substitute* "build.zig"
+ (((string-append "(b\\.dependency.\")" (car dep)) _
prefix)
+ (string-append prefix (cdr dep))))
+ (substitute* "build.zig.zon"
+ (((string-append "\\." (car dep)))
+ (format #f ".@\"~a\"" (cdr dep)))))
+ '(("metrics" . "zig-metrics"))))))
(build-system zig-build-system)
- (arguments
- (list
- #:zig-inputs `(("metrics" ,zig-metrics))))
+ (propagated-inputs (list zig-metrics))
(home-page "https://github.com/karlseguin/log.zig")
(synopsis "Structured Logging for Zig")
(description "logz is an opinionated structured logger that outputs to
stdout,
@@ -265,12 +274,21 @@ (define-public zig-httpz
(file-name (git-file-name name version))
(sha256
(base32
- "02hixvyx1r04lg0nzvhkyrqwcwm8m8rs8hm01n2nzw6jv935frh8"))))
+ "02hixvyx1r04lg0nzvhkyrqwcwm8m8rs8hm01n2nzw6jv935frh8"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(for-each
+ (lambda (dep)
+ (substitute* "build.zig"
+ (((string-append "(b\\.dependency.\")" (car dep)) _
prefix)
+ (string-append prefix (cdr dep))))
+ (substitute* "build.zig.zon"
+ (((string-append "\\." (car dep)))
+ (format #f ".@\"~a\"" (cdr dep)))))
+ '(("metrics" . "zig-metrics")
+ ("websocket" . "zig-websocket"))))))
(build-system zig-build-system)
- (arguments
- (list #:zig-inputs
- `(("metrics" ,zig-metrics)
- ("websocket" ,zig-websocket))))
+ (propagated-inputs (list zig-metrics zig-websocket))
(home-page "https://github.com/karlseguin/http.zig")
(synopsis "HTTP/1.1 server for Zig")
(description "")
@@ -288,16 +306,26 @@ (define-public liskvork
(file-name (git-file-name name version))
(sha256
(base32
- "1x7cif9wpaq7mk1pqmixq3flymrradb6zpx5qnmiihw699zr2xhw"))))
+ "1x7cif9wpaq7mk1pqmixq3flymrradb6zpx5qnmiihw699zr2xhw"))
+ (modules '((guix build utils)))
+ (snippet
+ #~(for-each
+ (lambda (dep)
+ (substitute* "build.zig"
+ (((string-append "(b\\.dependency.\")" (car dep)) _
prefix)
+ (string-append prefix (cdr dep))))
+ (substitute* "build.zig.zon"
+ (((string-append "\\." (car dep)))
+ (format #f ".@\"~a\"" (cdr dep)))))
+ '(("ini" . "zig-ini")
+ ("logz" . "zig-logz")
+ ("zul" . "zig-zul")
+ ("httpz" . "zig-httpz"))))))
(build-system zig-build-system)
(arguments
(list #:install-source? #f
- #:zig-release-type "safe"
- #:zig-inputs
- `(("ini" ,zig-ini)
- ("logz" ,zig-logz)
- ("zul" ,zig-zul)
- ("httpz" ,zig-httpz))))
+ #:zig-release-type "safe"))
+ (inputs (list zig-httpz zig-ini zig-logz zig-zul))
(home-page "https://liskvork.org")
(synopsis "Modern multi-platform gomoku game server.")
(description "liskvork is a modern Gomoku game server that is
purpose-built for