summaryrefslogtreecommitdiff
path: root/module
diff options
context:
space:
mode:
authorTaylor R Campbell <campbell+guile@mumble.net>2022-04-13 09:51:08 +0000
committerLudovic Courtès <ludo@gnu.org>2022-06-16 09:42:05 +0200
commite4e8afd6c8eeb9be1564e1be8e33362e7e987a3c (patch)
tree24fc8218a2d8f04f846118d9422288f3b4915c46 /module
parent158da6966b9ea2e949ae714863861d4f5bc5a56e (diff)
downloadguile-e4e8afd6c8eeb9be1564e1be8e33362e7e987a3c.tar.gz
Allow empty vendor string in GNU target triplets.
NetBSD and pkgsrc have been using an empty vendor string since the mid-'90s, such as x86_64--netbsd. pkgsrc has been carrying around a workaround just the guile build for a long time. (Before that, NetBSD omitted the vendor altogether, so if x86_64 existed then it might have been `x86_64-netbsd', but that caused more problems.) This change makes Guile accept an empty vendor string so workarounds are no longer necessary. * module/system/base/target.scm (validate-target): Allow empty vendor string in GNU target triplets. * test-suite/tests/cross-compilation.test ("cross-compilation"): Add tests for "x86_64--netbsd". Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'module')
-rw-r--r--module/system/base/target.scm9
1 files changed, 8 insertions, 1 deletions
diff --git a/module/system/base/target.scm b/module/system/base/target.scm
index 74af64b9d..87ab5b0c4 100644
--- a/module/system/base/target.scm
+++ b/module/system/base/target.scm
@@ -53,7 +53,14 @@
(if (or (not (string? target))
(let ((parts (string-split target #\-)))
(or (< (length parts) 3)
- (or-map string-null? parts))))
+ (let ((cpu (list-ref parts 0))
+ (os (list-ref parts 2)))
+ (or (string-null? cpu)
+ ;; vendor (parts[1]) may be empty
+ (string-null? os)
+ ;; optional components (ABI) should be nonempty if
+ ;; specified
+ (or-map string-null? (list-tail parts 3)))))))
(error "invalid target" target)))
(define (with-target target thunk)