diff options
| author | Efraim Flashner <efraim@flashner.co.il> | 2024-11-24 10:15:32 +0200 |
|---|---|---|
| committer | Janneke Nieuwenhuizen <janneke@gnu.org> | 2026-01-28 21:47:40 +0100 |
| commit | 37461278d172bf1f5577f6951a41afb7ac394942 (patch) | |
| tree | fab8d0c78c404b1dd842cfc4568e875be60dcac1 | |
| parent | 064c31578c2081c083e367360a9f4b3e63290bc0 (diff) | |
gnu: musl-boot0: Improve the install phase.
* gnu/packages/commencement.scm (musl-boot0)[arguments]: Adjust the
custom 'install phase to support more architectures.
Change-Id: I86759eb5813441fa3ebff1222de2fe8ffa69e8ba
| -rw-r--r-- | gnu/packages/commencement.scm | 49 |
1 files changed, 31 insertions, 18 deletions
diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index 322e00f664c..7e2574b3f26 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm | |||
| @@ -960,13 +960,41 @@ MesCC-Tools), and finally M2-Planet.") | |||
| 960 | (add-after 'configure 'remove-complex | 960 | (add-after 'configure 'remove-complex |
| 961 | (lambda _ | 961 | (lambda _ |
| 962 | (delete-file-recursively "src/complex"))) | 962 | (delete-file-recursively "src/complex"))) |
| 963 | (add-after 'unpack 'remove-optimized-math | ||
| 964 | ;; TCC does not support the extended asm for float registers. | ||
| 965 | ;; All src/math/{i386,x86_64}/*.c files make use of it. Luckily | ||
| 966 | ;; musl has an automatic fallback to generic C implementations | ||
| 967 | ;; in src/math. Therefore we can simply delete these files. | ||
| 968 | (lambda _ | ||
| 969 | (for-each (lambda (path) | ||
| 970 | (for-each delete-file (find-files path "\\.c$"))) | ||
| 971 | '("src/math/i386" "src/math/x86_64")))) | ||
| 972 | (add-after 'unpack 'adjust-i386-setjmp | ||
| 973 | (lambda _ | ||
| 974 | ;; We can't just delete the file or we get: | ||
| 975 | ;; tcc: error: undefined symbol 'sigsetjmp' | ||
| 976 | (substitute* "src/signal/i386/sigsetjmp.s" | ||
| 977 | ;; TCC has a bug with forward referencing numeric labels. We | ||
| 978 | ;; move the label and its code to the top. | ||
| 979 | (("^1:[\t ]*jmp ___setjmp") "") | ||
| 980 | (("^sigsetjmp:") "1:\tjmp ___setjmp\nsigsetjmp:") | ||
| 981 | ;; And we turn the forward into a backward reference. | ||
| 982 | (("jecxz 1f") "jecxz 1b")))) | ||
| 963 | ;; We can't use the install script since it doesn't play well with gash. | 983 | ;; We can't use the install script since it doesn't play well with gash. |
| 964 | (replace 'install | 984 | (replace 'install |
| 965 | (lambda* (#:key outputs #:allow-other-keys) | 985 | (lambda* (#:key outputs #:allow-other-keys) |
| 966 | (let* ((out (assoc-ref outputs "out")) | 986 | (let* ((out (assoc-ref outputs "out")) |
| 967 | (bin (string-append out "/bin")) | 987 | (bin (string-append out "/bin")) |
| 968 | (lib (string-append out "/lib")) | 988 | (lib (string-append out "/lib")) |
| 969 | (incl (string-append out "/include"))) | 989 | (incl (string-append out "/include")) |
| 990 | ;; Taken from the ARCH variable in configure. | ||
| 991 | (arch #$(cond ((target-x86-32?) "i386") | ||
| 992 | ((target-x32?) "x32") | ||
| 993 | ((target-arm32?) "arm") | ||
| 994 | ((target-ppc64le?) "powerpc64") | ||
| 995 | (#t (string-take | ||
| 996 | (%current-system) | ||
| 997 | (string-index (%current-system) #\-)))))) | ||
| 970 | (for-each (lambda (file) | 998 | (for-each (lambda (file) |
| 971 | (when (file-exists? file) | 999 | (when (file-exists? file) |
| 972 | (install-file file bin))) | 1000 | (install-file file bin))) |
| @@ -982,27 +1010,12 @@ MesCC-Tools), and finally M2-Planet.") | |||
| 982 | (for-each (lambda (file) | 1010 | (for-each (lambda (file) |
| 983 | (install-file file (string-append incl "/bits"))) | 1011 | (install-file file (string-append incl "/bits"))) |
| 984 | (append | 1012 | (append |
| 985 | (find-files | 1013 | (find-files (string-append "arch/" arch "/bits")) |
| 986 | (string-append "arch/" | ||
| 987 | #$(cond | ||
| 988 | ((target-x86-32?) "x86") | ||
| 989 | ((target-x86-64?) "x86_64") | ||
| 990 | ((target-aarch64?) "aarch64") | ||
| 991 | ((target-riscv64?) "riscv64") | ||
| 992 | (#t "")) | ||
| 993 | "/bits")) | ||
| 994 | (find-files "arch/generic/bits") | 1014 | (find-files "arch/generic/bits") |
| 995 | (find-files "obj/include/bits"))) | 1015 | (find-files "obj/include/bits"))) |
| 996 | (when (file-exists? (string-append lib "/libc.so")) | 1016 | (when (file-exists? (string-append lib "/libc.so")) |
| 997 | (symlink "libc.so" | 1017 | (symlink "libc.so" |
| 998 | (string-append lib "/ld-musl-" | 1018 | (string-append lib "/ld-musl-" arch ".so.1"))))))))))) |
| 999 | #$(cond | ||
| 1000 | ((target-x86-32?) "x86") | ||
| 1001 | ((target-x86-64?) "x86_64") | ||
| 1002 | ((target-aarch64?) "aarch64") | ||
| 1003 | ((target-riscv64?) "riscv64") | ||
| 1004 | (#t "")) | ||
| 1005 | ".so.1"))))))))))) | ||
| 1006 | 1019 | ||
| 1007 | (define tcc-boot-musl | 1020 | (define tcc-boot-musl |
| 1008 | (package | 1021 | (package |
