rosenthal: alloy-bin: Switch to gnu-build-system for proper cross build support.

This commit is contained in:
Hilton Chain 2026-02-13 15:27:44 +08:00
parent 9f069f714d
commit a42b6b4d24
No known key found for this signature in database
GPG Key ID: ACC66D09CA528292

View File

@ -17,6 +17,7 @@
;; Guix origin methods ;; Guix origin methods
#:use-module (guix download) #:use-module (guix download)
;; Guix build systems ;; Guix build systems
#:use-module (guix build-system gnu)
#:use-module (guix build-system copy) #:use-module (guix build-system copy)
;; Guix packages ;; Guix packages
#:use-module (gnu packages base) #:use-module (gnu packages base)
@ -491,37 +492,47 @@ rather a set of labels for each log stream.")
(name "alloy-bin") (name "alloy-bin")
(version "") (version "")
(source #f) (source #f)
(build-system copy-build-system) (build-system gnu-build-system)
(arguments (arguments
(list (list
#:install-plan
(match (or (and=> (%current-target-system) platform-target->system)
(%current-system))
("aarch64-linux"
#~'(("alloy-linux-arm64" "bin/alloy")))
(_
#~'(("alloy-linux-amd64" "bin/alloy"))))
#:modules #:modules
'((ice-9 match) `((ice-9 match)
(guix build copy-build-system) ,@%default-gnu-modules)
(guix build utils))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'install 'patch-elf (delete 'bootstrap)
(delete 'configure)
(delete 'build)
(delete 'check)
(replace 'install
(lambda _ (lambda _
(let ((name "alloy") (let ((src
(match #$(or (and=> (%current-target-system)
platform-target->system)
(%current-system))
("aarch64-linux"
"alloy-linux-arm64")
(_
"alloy-linux-amd64")))
(dst (in-vicinity #$output "bin/alloy")))
(mkdir-p (dirname dst))
(copy-file src dst))))
(add-after 'install 'patch-elf
(lambda* (#:key inputs #:allow-other-keys)
(let ((ld.so (search-input-file inputs #$(glibc-dynamic-linker)))
(dest (in-vicinity #$output "bin")) (dest (in-vicinity #$output "bin"))
(ld.so #$(file-append glibc (glibc-dynamic-linker)))) (name "alloy"))
(with-directory-excursion dest (with-directory-excursion dest
(invoke "patchelf" "--set-interpreter" ld.so name) (invoke "patchelf" "--set-interpreter" ld.so name)
(chmod name #o555))))) (chmod name #o555)))))
(add-after 'patch-elf 'install-extras (add-after 'patch-elf 'install-extras
(lambda* (#:key native-inputs inputs #:allow-other-keys) (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
(let ((alloy (let ((alloy
(search-input-file
(if #$(%current-target-system) (if #$(%current-target-system)
(search-input-file (or native-inputs inputs) native-inputs
"bin/alloy") outputs)
(in-vicinity #$output "bin/alloy")))) "bin/alloy")))
(for-each (for-each
(match-lambda (match-lambda
((shell . file) ((shell . file)