gnu: rust: Use platform-rust-target.
* gnu/packages/rust.scm (nix-system->gnu-triplet-for-rust): Remove procedure. (rust-bootstrap)[arguments]: Adjust make-flags, custom 'install phase to use platform-rust-target. (rust-1.55)[arguments]: Adjust custom 'configure and 'install phases to use platform-rust-target. (make-rust-sysroot)[arguments]: Adjust custom 'configure phase to use platform-rust-target. Change-Id: I102d44231c1411ea14ca75170f4884304d11bee1master
parent
4bf325381f
commit
3a076fc06e
|
@ -64,6 +64,7 @@
|
||||||
#: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 packages)
|
#:use-module (guix packages)
|
||||||
|
#:use-module (guix platform)
|
||||||
#:use-module ((guix build utils) #:select (alist-replace))
|
#:use-module ((guix build utils) #:select (alist-replace))
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
|
@ -101,21 +102,6 @@
|
||||||
(define %cargo-reference-hash
|
(define %cargo-reference-hash
|
||||||
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
||||||
|
|
||||||
(define* (nix-system->gnu-triplet-for-rust
|
|
||||||
#:optional (system (%current-system)))
|
|
||||||
(match system
|
|
||||||
("x86_64-linux" "x86_64-unknown-linux-gnu")
|
|
||||||
("i686-linux" "i686-unknown-linux-gnu")
|
|
||||||
("armhf-linux" "armv7-unknown-linux-gnueabihf")
|
|
||||||
("aarch64-linux" "aarch64-unknown-linux-gnu")
|
|
||||||
("mips64el-linux" "mips64el-unknown-linux-gnuabi64")
|
|
||||||
("riscv64-linux" "riscv64gc-unknown-linux-gnu")
|
|
||||||
("i586-gnu" "i686-unknown-hurd-gnu")
|
|
||||||
("i686-gnu" "i686-unknown-hurd-gnu")
|
|
||||||
("i686-mingw" "i686-pc-windows-gnu")
|
|
||||||
("x86_64-mingw" "x86_64-pc-windows-gnu")
|
|
||||||
(_ (nix-system->gnu-triplet system))))
|
|
||||||
|
|
||||||
(define* (rust-uri version #:key (dist "static"))
|
(define* (rust-uri version #:key (dist "static"))
|
||||||
(string-append "https://" dist ".rust-lang.org/dist/"
|
(string-append "https://" dist ".rust-lang.org/dist/"
|
||||||
"rustc-" version "-src.tar.gz"))
|
"rustc-" version "-src.tar.gz"))
|
||||||
|
@ -216,8 +202,10 @@
|
||||||
#:parallel-build? ,(target-x86-64?)
|
#:parallel-build? ,(target-x86-64?)
|
||||||
#:make-flags
|
#:make-flags
|
||||||
(list ,(string-append "RUSTC_TARGET="
|
(list ,(string-append "RUSTC_TARGET="
|
||||||
|
(platform-rust-target
|
||||||
|
(lookup-platform-by-target-or-system
|
||||||
(or (%current-target-system)
|
(or (%current-target-system)
|
||||||
(nix-system->gnu-triplet-for-rust)))
|
(%current-system)))))
|
||||||
,(string-append "RUSTC_VERSION=" version)
|
,(string-append "RUSTC_VERSION=" version)
|
||||||
,(string-append "MRUSTC_TARGET_VER="
|
,(string-append "MRUSTC_TARGET_VER="
|
||||||
(version-major+minor version))
|
(version-major+minor version))
|
||||||
|
@ -354,10 +342,12 @@
|
||||||
(rustc (string-append bin "/rustc"))
|
(rustc (string-append bin "/rustc"))
|
||||||
(cargo-bin (string-append cargo "/bin"))
|
(cargo-bin (string-append cargo "/bin"))
|
||||||
(lib (string-append out "/lib"))
|
(lib (string-append out "/lib"))
|
||||||
(gnu-triplet ,(or (%current-target-system)
|
(system-lib-prefix
|
||||||
(nix-system->gnu-triplet-for-rust)))
|
(string-append lib "/rustlib/"
|
||||||
(system-lib-prefix (string-append lib "/rustlib/"
|
,(platform-rust-target
|
||||||
gnu-triplet "/lib")))
|
(lookup-platform-by-target-or-system
|
||||||
|
(or (%current-target-system)
|
||||||
|
(%current-system)))) "/lib")))
|
||||||
(mkdir-p (dirname rustc))
|
(mkdir-p (dirname rustc))
|
||||||
(copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc)
|
(copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc)
|
||||||
(wrap-program rustc
|
(wrap-program rustc
|
||||||
|
@ -481,7 +471,7 @@ jemalloc=true
|
||||||
default-linker = \"" gcc "/bin/gcc" "\"
|
default-linker = \"" gcc "/bin/gcc" "\"
|
||||||
channel = \"stable\"
|
channel = \"stable\"
|
||||||
rpath = true
|
rpath = true
|
||||||
[target." ,(nix-system->gnu-triplet-for-rust) "]
|
[target." ,(platform-rust-target (lookup-platform-by-system (%current-system))) "]
|
||||||
llvm-config = \"" llvm "/bin/llvm-config" "\"
|
llvm-config = \"" llvm "/bin/llvm-config" "\"
|
||||||
cc = \"" gcc "/bin/gcc" "\"
|
cc = \"" gcc "/bin/gcc" "\"
|
||||||
cxx = \"" gcc "/bin/g++" "\"
|
cxx = \"" gcc "/bin/g++" "\"
|
||||||
|
@ -502,9 +492,11 @@ ar = \"" binutils "/bin/ar" "\"
|
||||||
(lambda* (#:key outputs #:allow-other-keys)
|
(lambda* (#:key outputs #:allow-other-keys)
|
||||||
(let* ((out (assoc-ref outputs "out"))
|
(let* ((out (assoc-ref outputs "out"))
|
||||||
(cargo-out (assoc-ref outputs "cargo"))
|
(cargo-out (assoc-ref outputs "cargo"))
|
||||||
(gnu-triplet ,(or (%current-target-system)
|
(build (string-append "build/"
|
||||||
(nix-system->gnu-triplet-for-rust)))
|
,(platform-rust-target
|
||||||
(build (string-append "build/" gnu-triplet)))
|
(lookup-platform-by-target-or-system
|
||||||
|
(or (%current-target-system)
|
||||||
|
(%current-system)))))))
|
||||||
;; Manually do the installation instead of calling './x.py
|
;; Manually do the installation instead of calling './x.py
|
||||||
;; install', as that is slow and needlessly rebuilds some
|
;; install', as that is slow and needlessly rebuilds some
|
||||||
;; things.
|
;; things.
|
||||||
|
@ -1187,7 +1179,7 @@ docs = false
|
||||||
python = \"" (which "python") "\"
|
python = \"" (which "python") "\"
|
||||||
vendor = true
|
vendor = true
|
||||||
submodules = false
|
submodules = false
|
||||||
target = [\"" ,(nix-system->gnu-triplet-for-rust (gnu-triplet->nix-system target)) "\"]
|
target = [\"" ,(platform-rust-target (lookup-platform-by-target target)) "\"]
|
||||||
[install]
|
[install]
|
||||||
prefix = \"" out "\"
|
prefix = \"" out "\"
|
||||||
sysconfdir = \"etc\"
|
sysconfdir = \"etc\"
|
||||||
|
@ -1196,14 +1188,14 @@ debug = false
|
||||||
jemalloc = false
|
jemalloc = false
|
||||||
default-linker = \"" target-cc "\"
|
default-linker = \"" target-cc "\"
|
||||||
channel = \"stable\"
|
channel = \"stable\"
|
||||||
[target." ,(nix-system->gnu-triplet-for-rust) "]
|
[target." ,(platform-rust-target (lookup-platform-by-system (%current-system))) "]
|
||||||
# These are all native tools
|
# These are all native tools
|
||||||
llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
||||||
linker = \"" (which "gcc") "\"
|
linker = \"" (which "gcc") "\"
|
||||||
cc = \"" (which "gcc") "\"
|
cc = \"" (which "gcc") "\"
|
||||||
cxx = \"" (which "g++") "\"
|
cxx = \"" (which "g++") "\"
|
||||||
ar = \"" (which "ar") "\"
|
ar = \"" (which "ar") "\"
|
||||||
[target." ,(nix-system->gnu-triplet-for-rust (gnu-triplet->nix-system target)) "]
|
[target." ,(platform-rust-target (lookup-platform-by-target target)) "]
|
||||||
llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
||||||
linker = \"" target-cc "\"
|
linker = \"" target-cc "\"
|
||||||
cc = \"" target-cc "\"
|
cc = \"" target-cc "\"
|
||||||
|
|
Reference in New Issue