gnu: zig: Fix build.
* gnu/packages/patches/zig-do-not-link-against-librt.patch: New file. * gnu/local.mk (dist_patch_DATA): Register it. * gnu/packages/zig.scm (zig-0.10): Use it. Also force LLVM to be dynamically linked, and set up the CC env variable. (zig-0.9): Also use the above patch. Signed-off-by: Andreas Enge <andreas@enge.fr>
This commit is contained in:
parent
5569971659
commit
228c9308ff
3 changed files with 22 additions and 4 deletions
|
@ -2058,6 +2058,7 @@ dist_patch_DATA = \
|
||||||
%D%/packages/patches/xterm-370-explicit-xcursor.patch \
|
%D%/packages/patches/xterm-370-explicit-xcursor.patch \
|
||||||
%D%/packages/patches/xygrib-fix-finding-data.patch \
|
%D%/packages/patches/xygrib-fix-finding-data.patch \
|
||||||
%D%/packages/patches/yggdrasil-extra-config.patch \
|
%D%/packages/patches/yggdrasil-extra-config.patch \
|
||||||
|
%D%/packages/patches/zig-do-not-link-against-librt.patch \
|
||||||
%D%/packages/patches/zig-use-system-paths.patch \
|
%D%/packages/patches/zig-use-system-paths.patch \
|
||||||
%D%/packages/patches/zsh-egrep-failing-test.patch
|
%D%/packages/patches/zsh-egrep-failing-test.patch
|
||||||
|
|
||||||
|
|
10
gnu/packages/patches/zig-do-not-link-against-librt.patch
Normal file
10
gnu/packages/patches/zig-do-not-link-against-librt.patch
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
--- a/src/target.zig 2023-04-22 11:44:47.917416658 +0200
|
||||||
|
+++ b/src/target.zig 2023-04-22 11:45:04.577465352 +0200
|
||||||
|
@@ -478,7 +478,6 @@
|
||||||
|
"-lpthread",
|
||||||
|
"-lc",
|
||||||
|
"-ldl",
|
||||||
|
- "-lrt",
|
||||||
|
"-lutil",
|
||||||
|
},
|
||||||
|
},
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
(define-module (gnu packages zig)
|
(define-module (gnu packages zig)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix utils)
|
||||||
#:use-module (guix git-download)
|
#:use-module (guix git-download)
|
||||||
#:use-module ((guix licenses) #:prefix license:)
|
#:use-module ((guix licenses) #:prefix license:)
|
||||||
#:use-module (guix build-system cmake)
|
#:use-module (guix build-system cmake)
|
||||||
|
@ -40,7 +41,8 @@
|
||||||
(commit version)))
|
(commit version)))
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "1sh5xjsksl52i4cfv1qj36sz5h0ln7cq4pdhgs3960mk8a90im7b"))))
|
(base32 "1sh5xjsksl52i4cfv1qj36sz5h0ln7cq4pdhgs3960mk8a90im7b"))
|
||||||
|
(patches (search-patches "zig-do-not-link-against-librt.patch"))))
|
||||||
(build-system cmake-build-system)
|
(build-system cmake-build-system)
|
||||||
(inputs
|
(inputs
|
||||||
(list clang-15 ; Clang propagates llvm.
|
(list clang-15 ; Clang propagates llvm.
|
||||||
|
@ -57,14 +59,18 @@
|
||||||
(%current-target-system))
|
(%current-target-system))
|
||||||
'())
|
'())
|
||||||
(string-append "-DZIG_TARGET_MCPU=baseline")
|
(string-append "-DZIG_TARGET_MCPU=baseline")
|
||||||
|
"-DZIG_SHARED_LLVM=ON"
|
||||||
(string-append "-DZIG_LIB_DIR=" (assoc-ref %outputs "out")
|
(string-append "-DZIG_LIB_DIR=" (assoc-ref %outputs "out")
|
||||||
"/lib/zig"))
|
"/lib/zig"))
|
||||||
#:validate-runpath? #f ; TODO: zig binary can't find ld-linux.
|
#:validate-runpath? #f ; TODO: zig binary can't find ld-linux.
|
||||||
#:out-of-source? #f ; for tests
|
#:out-of-source? #f ; for tests
|
||||||
#:phases
|
#:phases
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(add-after 'configure 'set-cache-dir
|
(add-after 'unpack 'set-env-variables
|
||||||
(lambda _
|
(lambda* (#:key inputs native-inputs #:allow-other-keys)
|
||||||
|
;; Set CC, since the stage 2 zig relies on it to find the libc
|
||||||
|
;; installation, and otherwise silently links against its own.
|
||||||
|
(setenv "CC" ,(cc-for-target))
|
||||||
;; Set cache dir, otherwise Zig looks for `$HOME/.cache'.
|
;; Set cache dir, otherwise Zig looks for `$HOME/.cache'.
|
||||||
(setenv "ZIG_GLOBAL_CACHE_DIR"
|
(setenv "ZIG_GLOBAL_CACHE_DIR"
|
||||||
(string-append (getcwd) "/zig-cache"))))
|
(string-append (getcwd) "/zig-cache"))))
|
||||||
|
@ -130,7 +136,8 @@ toolchain. Among other features it provides
|
||||||
(file-name (git-file-name name version))
|
(file-name (git-file-name name version))
|
||||||
(sha256
|
(sha256
|
||||||
(base32 "0nfvgg23sw50ksy0z0ml6lkdsvmd0278mq29m23dbb2jsirkhry7"))
|
(base32 "0nfvgg23sw50ksy0z0ml6lkdsvmd0278mq29m23dbb2jsirkhry7"))
|
||||||
(patches (search-patches "zig-use-system-paths.patch"))))
|
(patches (search-patches "zig-use-system-paths.patch"
|
||||||
|
"zig-do-not-link-against-librt.patch"))))
|
||||||
(inputs
|
(inputs
|
||||||
(list clang-13 ; Clang propagates llvm.
|
(list clang-13 ; Clang propagates llvm.
|
||||||
lld-13))
|
lld-13))
|
||||||
|
|
Reference in a new issue