diff options
author | Christopher Baines <mail@cbaines.net> | 2024-05-16 16:06:06 +0100 |
---|---|---|
committer | Guix Patches Tester <> | 2024-05-16 19:25:43 +0200 |
commit | e3ecb1b9258ee821abbd016c3f5b8551fdeb7719 (patch) | |
tree | 702006bb4edf8543c0b2c2508ae3ab2c9d3c00cd | |
parent | a94d255caddbac29c0c3b3792bfcf04b780d490b (diff) | |
download | guix-patches-issue-70985.tar guix-patches-issue-70985.tar.gz |
guix: build-system: meson: Don't error on unsupported targets.issue-70985
Rather than raising generic errors.
* guix/build-system/meson.scm (make-machine-alist): Return #f if the triplet
is unsupported.
(lower): Return #f if the machine alist is #f.
Change-Id: If6a1f8d1c2073e43107406ac186aa9c845005a95
-rw-r--r-- | guix/build-system/meson.scm | 115 |
1 files changed, 62 insertions, 53 deletions
diff --git a/guix/build-system/meson.scm b/guix/build-system/meson.scm index bf9ca15ecc..b321417773 100644 --- a/guix/build-system/meson.scm +++ b/guix/build-system/meson.scm @@ -46,39 +46,46 @@ "Make an association list describing what should go into the ‘host_machine’ section of the cross file when cross-compiling for TRIPLET." - `((system . ,(cond ((target-hurd? triplet) "gnu") - ((target-linux? triplet) "linux") - ((target-mingw? triplet) "windows") - ((target-avr? triplet) "none") - (#t (error "meson: unknown operating system")))) - (cpu_family . ,(cond ((target-x86-32? triplet) "x86") + (let ((system + (cond + ((target-hurd? triplet) "gnu") + ((target-linux? triplet) "linux") + ((target-mingw? triplet) "windows") + ((target-avr? triplet) "none") + (else #f))) + (cpu-family + (cond ((target-x86-32? triplet) "x86") + ((target-x86-64? triplet) "x86_64") + ((target-arm32? triplet) "arm") + ((target-aarch64? triplet) "aarch64") + ((target-avr? triplet) "avr") + ((target-mips64el? triplet) "mips64") + ((target-powerpc? triplet) + (if (target-64bit? triplet) + "ppc64" + "ppc")) + ((target-riscv64? triplet) "riscv64") + (else #f)))) + (and system + cpu-family + `((system . ,system) + (cpu_family . ,cpu-family) + (cpu . ,(cond ((target-x86-32? triplet) ; i386, ..., i686 + (substring triplet 0 4)) ((target-x86-64? triplet) "x86_64") - ((target-arm32? triplet) "arm") - ((target-aarch64? triplet) "aarch64") + ((target-aarch64? triplet) "armv8-a") + ((target-arm32? triplet) "armv7") ((target-avr? triplet) "avr") - ((target-mips64el? triplet) "mips64") - ((target-powerpc? triplet) - (if (target-64bit? triplet) - "ppc64" - "ppc")) - ((target-riscv64? triplet) "riscv64") - (#t (error "meson: unknown architecture")))) - (cpu . ,(cond ((target-x86-32? triplet) ; i386, ..., i686 - (substring triplet 0 4)) - ((target-x86-64? triplet) "x86_64") - ((target-aarch64? triplet) "armv8-a") - ((target-arm32? triplet) "armv7") - ((target-avr? triplet) "avr") - ;; According to #mesonbuild on OFTC, there does not appear - ;; to be an official-ish list of CPU types recognised by - ;; Meson, the "cpu" field is not used by Meson itself and - ;; most software doesn't look at this field, except perhaps - ;; for selecting optimisations, so set it to something - ;; arbitrary. - (#t "strawberries"))) - (endian . ,(if (target-little-endian? triplet) - "little" - "big")))) + ;; According to #mesonbuild on OFTC, there does not appear + ;; to be an official-ish list of CPU types recognised by + ;; Meson, the "cpu" field is not used by Meson itself and + ;; most software doesn't look at this field, except perhaps + ;; for selecting optimisations, so set it to something + ;; arbitrary. + (#t "strawberries"))) + (endian . ,(if (target-little-endian? triplet) + "little" + "big")))))) (define (make-binaries-alist triplet) "Make an associatoin list describing what should go into @@ -146,29 +153,31 @@ TRIPLET." '() '(#:target)))) - (bag - (name name) - (system system) (target target) - (build-inputs `(("meson" ,meson) - ("ninja" ,ninja) - ,@native-inputs - ,@(if target '() inputs) - ;; Keep the standard inputs of 'gnu-build-system'. - ,@(if target - (standard-cross-packages target 'host) + (and + (make-machine-alist target) + (bag + (name name) + (system system) (target target) + (build-inputs `(("meson" ,meson) + ("ninja" ,ninja) + ,@native-inputs + ,@(if target '() inputs) + ;; Keep the standard inputs of 'gnu-build-system'. + ,@(if target + (standard-cross-packages target 'host) + '()) + ,@(standard-packages))) + (host-inputs `(,@(if source + `(("source" ,source)) '()) - ,@(standard-packages))) - (host-inputs `(,@(if source - `(("source" ,source)) - '()) - ,@(if target inputs '()))) - ;; Keep the standard inputs of 'gnu-buid-system'. - (target-inputs (if target - (standard-cross-packages target 'target) - '())) - (outputs outputs) - (build (if target meson-cross-build meson-build)) - (arguments (strip-keyword-arguments private-keywords arguments)))) + ,@(if target inputs '()))) + ;; Keep the standard inputs of 'gnu-buid-system'. + (target-inputs (if target + (standard-cross-packages target 'target) + '())) + (outputs outputs) + (build (if target meson-cross-build meson-build)) + (arguments (strip-keyword-arguments private-keywords arguments))))) (define* (meson-build name inputs #:key |