mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
build-system: zig: Support Zig package manager.
* guix/build-system/zig.scm (zig-build,zig-cross-build) [#:install-source?,#:skip-build?]: New arguments. [#:tests?]: Honor #:skip-build?. * guix/build/zig-build-system.scm (zig-source-install-path) (zig-input-install-path,unpack-dependencies): New procedures. (%standard-phases): Add 'unpack-dependencies. (build,install): Honor #:skip-build?. * doc/guix.texi (Build Systems)[zig-build-system]: Update documentation. * gnu/packages/zig.scm (zig-0.9)[native-search-paths]: Add GUIX_ZIG_PACKAGE_PATH. Use search paths defined in (guix search-paths). (add-build.zig.zon,rename-zig-dependencies): New procedures. * gnu/packages/ncdu.scm (ncdu)[arguments]: Don't install source. * gnu/packages/zig-xyz.scm (river,tigerbeetle,zig-zls)[arguments]: Likewise.
This commit is contained in:
parent
3ef8c9307c
commit
5ce59e0413
6 changed files with 196 additions and 48 deletions
|
@ -24,6 +24,7 @@
|
|||
#:use-module (guix gexp)
|
||||
#:use-module (guix packages)
|
||||
#:use-module (guix platform)
|
||||
#:use-module (guix search-paths)
|
||||
#:use-module (guix utils)
|
||||
#:use-module (guix download)
|
||||
#:use-module (guix git-download)
|
||||
|
@ -33,7 +34,51 @@
|
|||
#:use-module (gnu packages compression)
|
||||
#:use-module (gnu packages llvm)
|
||||
#:use-module (gnu packages llvm-meta)
|
||||
#:use-module (gnu packages web))
|
||||
#:use-module (gnu packages web)
|
||||
#:export (add-build.zig.zon
|
||||
rename-zig-dependencies))
|
||||
|
||||
(define* (add-build.zig.zon name version dependencies #:optional (paths '("")))
|
||||
"Snippet to generate build.zig.zon of DEPENDENCIES for package NAME@VERSION."
|
||||
`(let ((port (open-file "build.zig.zon" "w" #:encoding "utf8")))
|
||||
(format port "\
|
||||
.{
|
||||
.name = \"~a\",
|
||||
.version = \"~a\",
|
||||
.paths = .{
|
||||
~{\
|
||||
\"~a\",
|
||||
~}\
|
||||
},
|
||||
.dependencies = .{
|
||||
~{\
|
||||
.@\"~a\" = .{
|
||||
.url = \"\",
|
||||
},
|
||||
~}\
|
||||
},
|
||||
}~%" ,name ,version (quote ,paths) (quote ,dependencies))
|
||||
(close-port port)))
|
||||
|
||||
(define* (rename-zig-dependencies mapping #:optional (directories '(".")))
|
||||
"Snippet to rename Zig dependencies in build.zig and build.zig.zon."
|
||||
`(begin
|
||||
(use-modules (ice-9 match)
|
||||
(guix build utils))
|
||||
(for-each
|
||||
(lambda (directory)
|
||||
(for-each
|
||||
(match-lambda
|
||||
((old-name . new-name)
|
||||
(with-directory-excursion directory
|
||||
(substitute* "build.zig"
|
||||
(((string-append "([Dd]ependency.\")" old-name) _ prefix)
|
||||
(string-append prefix new-name)))
|
||||
(substitute* "build.zig.zon"
|
||||
(((format #f "\\.(@\")?~a\"?" old-name))
|
||||
(format #f ".@\"~a\"" new-name))))))
|
||||
(quote ,mapping)))
|
||||
(quote ,directories))))
|
||||
|
||||
(define (zig-source version commit hash)
|
||||
(origin
|
||||
|
@ -169,16 +214,12 @@
|
|||
(list llvm-13
|
||||
zig-0.9-glibc-abi-tool))
|
||||
(native-search-paths
|
||||
(list
|
||||
(search-path-specification
|
||||
(variable "C_INCLUDE_PATH")
|
||||
(files '("include")))
|
||||
(search-path-specification
|
||||
(variable "CPLUS_INCLUDE_PATH")
|
||||
(files '("include/c++" "include")))
|
||||
(search-path-specification
|
||||
(variable "LIBRARY_PATH")
|
||||
(files '("lib" "lib64")))))
|
||||
(list $C_INCLUDE_PATH
|
||||
$CPLUS_INCLUDE_PATH
|
||||
$LIBRARY_PATH
|
||||
(search-path-specification
|
||||
(variable "GUIX_ZIG_PACKAGE_PATH")
|
||||
(files '("src/zig")))))
|
||||
(synopsis "General purpose programming language and toolchain")
|
||||
(description "Zig is a general-purpose programming language and
|
||||
toolchain. Among other features it provides
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue