[PATCH 0/9] Target check fixes and cleanups

  • Open
  • quality assurance status badge
Details
2 participants
  • Thiago Jung Bauermann
  • Maxime Devos
Owner
unassigned
Submitted by
Thiago Jung Bauermann
Severity
normal
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 02:46
(address . guix-patches@gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721004615.631777-1-bauermann@kolabnow.com
Hello,

I recently had a closer look at uses of ‘%current-target-system’ and
‘%current-system’ and noticed a few bugs to fix and also cleanups that can
be done.

They mostly stem from the fact that ‘%current-system’ holds a Nix system
identifier, while ‘%current-target-system’ holds a GNU triplet identifier.
A few parts of the code are confused about that and make the wrong check.
The individual patch descriptions have the details.

The last two patches are just cleanups and not bug fixes. I’m on the fence
about the merits of the last patch. It can reasonably be seen as either a
worthwhile cleanup or needless code churn. I’m sending it anyway, and I’m
fine with either dropping or applying it.

The series applies on today’s master branch, as of commit:

e644e45aec26 gnu: pipe-viewer: Correct references to youtube-dl program.

The only testing I did was running `make` on each patch in the series and
checking if there’s any new Guile warnings or errors (there isn’t), and
running `make check`. The testsuite results are:

============================================================================
Testsuite summary for GNU Guix UNKNOWN
============================================================================
# TOTAL: 1935
# PASS: 1903
# SKIP: 27
# XFAIL: 2
# FAIL: 3
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log
Please report to bug-guix@gnu.org
============================================================================

The failures are in tests/publish.scm, tests/guix-describe.sh and
tests/guix-package.sh. Compared to the master branch,
tests/guix-describe.sh is the only new failure. The test is skipped in the
master branch. This is because I ran the master branch tests on a git
worktree, where ‘.git’ is a file rather than a directory, causing the test
to be skipped. If I change the `if [ -d "…/.git" ]` line to
`if [ -e "…/.git" ]`, then the test also fails on master and I have the same
testsuite results with and without the patches.

Thiago Jung Bauermann (9):
gnu: Fix check of ‘%current-system’ and ‘%current-target-system’
utils: Add ‘current-target-nix-system’ helper
gnu: Query membership in ‘supported-systems’ list with Nix identifier
gnu: Use ‘current-target-nix-system’ in pattern matches
gnu: Use ‘current-target-nix-system’ in prefix checks
gnu: Fix GNU/Linux system detection
bootloader: grub: Fix mix of GNU triplet and Nix system identifier
gnu: ustr: Don’t pass default argument
gnu: Use existing target helpers from ‘(guix utils)’

gnu/bootloader/grub.scm | 5 +----
gnu/packages/algebra.scm | 3 +--
gnu/packages/astronomy.scm | 4 ++--
gnu/packages/bdw-gc.scm | 4 ++--
gnu/packages/boost.scm | 4 ++--
gnu/packages/bootloaders.scm | 22 ++++++----------------
gnu/packages/bootstrap.scm | 6 ++----
gnu/packages/c.scm | 3 +--
gnu/packages/ci.scm | 6 ++----
gnu/packages/compression.scm | 6 ++----
gnu/packages/crypto.scm | 4 ++--
gnu/packages/databases.scm | 3 +--
gnu/packages/debug.scm | 6 ++----
gnu/packages/digest.scm | 3 +--
gnu/packages/firmware.scm | 4 ++--
gnu/packages/gcc.scm | 5 +----
gnu/packages/golang.scm | 6 ++----
gnu/packages/gstreamer.scm | 6 ++----
gnu/packages/java.scm | 16 +++++++---------
gnu/packages/julia.scm | 3 +--
gnu/packages/linux.scm | 4 +---
gnu/packages/lisp.scm | 3 +--
gnu/packages/llvm.scm | 4 +---
gnu/packages/make-bootstrap.scm | 2 +-
gnu/packages/mes.scm | 3 +--
gnu/packages/messaging.scm | 12 ++++++------
gnu/packages/multiprecision.scm | 4 +---
gnu/packages/ntp.scm | 4 ++--
gnu/packages/pascal.scm | 6 ++----
gnu/packages/pciutils.scm | 3 +--
gnu/packages/photo.scm | 4 ++--
gnu/packages/php.scm | 3 +--
gnu/packages/python.scm | 26 ++++++++++----------------
gnu/packages/rust.scm | 4 +---
gnu/packages/sdl.scm | 4 ++--
gnu/packages/syncthing.scm | 4 ++--
gnu/packages/telephony.scm | 4 ++--
gnu/packages/textutils.scm | 3 +--
gnu/packages/valgrind.scm | 4 ++--
gnu/packages/video.scm | 7 ++-----
gnu/packages/web.scm | 9 +++------
guix/utils.scm | 14 ++++++++++++++
42 files changed, 101 insertions(+), 149 deletions(-)
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 1/9] gnu: Fix check of ‘%current -system’ and ‘%current-target-system ’
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-1-bauermann@kolabnow.com
The order of the check is important because ‘%current-system’ is always
defined, while ‘%current-target-system’ is only defined when
cross-building.

Therefore, it’s important to check ‘%current-target-system’ first,
otherwise the cross-build target is never considered.

* gnu/packages/bdw-gc.scm (libgc)[arguments]<#:configure-flags>: Check
‘%current-target-system’ first.
* gnu/packages/crypto.scm (libb2)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/golang.scm (go-1.4)[arguments]<#:system>: Likewise.
(go-1.14)[arguments]<#:system>: Likewise.
* gnu/packages/java.scm (jamvm-1-bootstrap)[arguments]<#:phases>: Likewise.
[native-inputs]: Likewise.
(ant-bootstrap)[arguments]<#:phases>: Likewise.
(classpath-jamvm-wrappers)[arguments]<#:builder>: Likewise.
* gnu/packages/lisp.scm (clisp)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/photo.scm (lensfun)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/php.scm (php)[arguments]<#:phases>: Likewise.
* gnu/packages/sdl.scm (sdl-gfx)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/telephony.scm (pjproject)[arguments]<#:configure-flags>: Likewise.
---
gnu/packages/bdw-gc.scm | 4 ++--
gnu/packages/crypto.scm | 4 ++--
gnu/packages/golang.scm | 8 ++++----
gnu/packages/java.scm | 16 ++++++++--------
gnu/packages/lisp.scm | 4 ++--
gnu/packages/photo.scm | 4 ++--
gnu/packages/php.scm | 4 ++--
gnu/packages/sdl.scm | 4 ++--
gnu/packages/telephony.scm | 4 ++--
9 files changed, 26 insertions(+), 26 deletions(-)

Toggle diff (179 lines)
diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index ecac5b93687e..cd834ff11031 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -52,8 +52,8 @@
;; to configure script. See bug report and discussion:
;; <https://lists.opendylan.org/pipermail/bdwgc/2017-April/006275.html>
;; <https://lists.gnu.org/archive/html/bug-hurd/2017-01/msg00008.html>
- ,@(if (hurd-triplet? (or (%current-system)
- (%current-target-system)))
+ ,@(if (hurd-triplet? (or (%current-target-system)
+ (%current-system)))
'("--disable-gcj-support")
'()))))
(native-inputs `(("pkg-config" ,pkg-config)))
diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index fe2cec045d6c..dff9584e07b3 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -867,8 +867,8 @@ data on your platform, so the seed itself will be as random as possible.
(arguments
`(#:configure-flags
(list
- ,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ ,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; fat only checks for Intel optimisations
'("--enable-fat")
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index a830afa022a6..58688687bba3 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -1046,8 +1046,8 @@ your Go binary to be later served from an http.FileSystem.")
(guix build utils)
(srfi srfi-1))
#:tests? #f ; Tests are run by the all.bash script.
- ,@(if (string-prefix? "aarch64-linux" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "aarch64-linux" (or (%current-target-system)
+ (%current-system)))
'(#:system "armhf-linux")
'())
#:phases
@@ -1199,8 +1199,8 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(arguments
(substitute-keyword-arguments (package-arguments go-1.4)
((#:system system)
- (if (string-prefix? "aarch64-linux" (or (%current-system)
- (%current-target-system)))
+ (if (string-prefix? "aarch64-linux" (or (%current-target-system)
+ (%current-system)))
"aarch64-linux"
system))
((#:phases phases)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 64df5a2e24a2..e69d62be0802 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -315,8 +315,8 @@ language.")
"--enable-runtime-reloc-checks"
"--enable-ffi")
#:phases
- ,(if (string-prefix? "aarch64" (or (%current-system)
- (%current-target-system)))
+ ,(if (string-prefix? "aarch64" (or (%current-target-system)
+ (%current-system)))
;; Makefiles and the configure script need to be regenerated to
;; incorporate support for AArch64.
'(modify-phases %standard-phases
@@ -330,8 +330,8 @@ language.")
("zip" ,zip)
("zlib" ,zlib)))
(native-inputs
- (if (string-prefix? "aarch64" (or (%current-system)
- (%current-target-system)))
+ (if (string-prefix? "aarch64" (or (%current-target-system)
+ (%current-system)))
;; Additional packages needed for autoreconf.
`(("autoconf" ,autoconf)
("automake" ,automake)
@@ -401,8 +401,8 @@ JNI.")
;; Without these JamVM options the build may freeze.
(substitute* "bootstrap.sh"
(("^\"\\$\\{JAVACMD\\}\" " m)
- ,@(if (string-prefix? "armhf" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "armhf" (or (%current-target-system)
+ (%current-system)))
`((string-append m "-Xnocompact "))
`((string-append m "-Xnocompact -Xnoinlining ")))))
@@ -674,8 +674,8 @@ the standard javac executable.")))
(for-each (lambda (tool)
(with-output-to-file (string-append bin tool)
(lambda _
- ,@(if (string-prefix? "armhf" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "armhf" (or (%current-target-system)
+ (%current-system)))
`((format #t "#!~a/bin/sh
~a/bin/jamvm -Xnocompact -classpath ~a/share/classpath/tools.zip \
gnu.classpath.tools.~a.~a $@"
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index d8d7a7394c44..ee43226ff091 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -347,8 +347,8 @@ supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
("libsigsegv" ,libsigsegv)))
(arguments
`(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
- (or (%current-system)
- (%current-target-system)))
+ (or (%current-target-system)
+ (%current-system)))
'("CFLAGS=-falign-functions=4")
'())
"--with-dynamic-ffi"
diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm
index 673989e06b09..1b646497c91e 100644
--- a/gnu/packages/photo.scm
+++ b/gnu/packages/photo.scm
@@ -440,8 +440,8 @@ scene to produce an image that looks much like a tone-mapped image.")
"0cfk8jjhs9nbfjfdy98plrj9ayi59aph0nx6ppslgjhlcvacm2xf"))))
(build-system cmake-build-system)
(arguments
- `(,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ `(,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; SSE and SSE2 are supported only on Intel processors.
'()
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 4edff2cfd886..597494e8a94f 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -177,8 +177,8 @@
(substitute* "ext/standard/tests/streams/bug60602.phpt"
(("'ls'") (string-append "'" (which "ls") "'")))
- ,@(if (string-prefix? "arm" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "arm" (or (%current-target-system)
+ (%current-system)))
;; Drop tests known to fail on armhf.
'((for-each delete-file
(list
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 128bd95af881..bddc0bdbe990 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -200,8 +200,8 @@ system, such as sound redirection over the network.")
(build-system gnu-build-system)
(outputs '("out" "debug"))
(arguments
- `(,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ `(,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; mmx is supported only on Intel processors.
'()
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index f75a168948bb..4957ecca13a0 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -755,8 +755,8 @@ your calls and messages.")
"--with-external-srtp"
"--with-external-pa"
;; The following flag is Linux specific.
- ,@(if (string-contains (or (%current-system)
- (%current-target-system)) "linux")
+ ,@(if (string-contains (or (%current-target-system)
+ (%current-system)) "linux")
'("--enable-epoll")
'())
"--with-gnutls" ;disable OpenSSL checks
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 2/9] utils: Add ‘current-target-nix- system’ helper
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-2-bauermann@kolabnow.com
Many places check a Nix system identifier string against
‘%current-target-system’ and ‘%current-target’. This is problematic because
these parameters hold different kinds of identifiers. The former holds a
GNU triplet (or #f if not cross-compiling), while the latter holds a Nix
system identifier.

As a first step to solve the confusion, introduce the
‘current-target-nix-system’ procedure which looks at both parameters and
always returns a Nix system identifier. The code is factored out from
‘glibc-dynamic-linker’ and ‘system->llvm-target’.

* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Use result of
‘current-target-nix-system’ as default value for ‘system’ argument.
* gnu/packages/llvm.scm (system->llvm-target): Likewise.
* guix/utils.scm (current-target-nix-system): Define new procedure.
---
gnu/packages/bootstrap.scm | 6 ++----
gnu/packages/llvm.scm | 4 +---
guix/utils.scm | 7 +++++++
3 files changed, 10 insertions(+), 7 deletions(-)

Toggle diff (64 lines)
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index c598cedc0ae2..b7134653cfc4 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -35,7 +35,7 @@
#:select (run-with-store add-to-store add-text-to-store))
#:use-module ((guix derivations)
#:select (derivation derivation-input derivation->output-path))
- #:use-module ((guix utils) #:select (gnu-triplet->nix-system))
+ #:use-module (guix utils)
#:use-module ((guix gexp) #:select (lower-object))
#:use-module (guix memoization)
#:use-module (guix i18n)
@@ -286,9 +286,7 @@ or false to signal an error."
package-with-bootstrap-guile)))))
(define* (glibc-dynamic-linker
- #:optional (system (or (and=> (%current-target-system)
- gnu-triplet->nix-system)
- (%current-system))))
+ #:optional (system (current-target-nix-system)))
"Return the name of Glibc's dynamic linker for SYSTEM."
;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
(cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index 575c63c713e9..3c4e5930d044 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -66,9 +66,7 @@
#:export (system->llvm-target))
(define* (system->llvm-target #:optional
- (system (or (and=> (%current-target-system)
- gnu-triplet->nix-system)
- (%current-system))))
+ (system (current-target-nix-system)))
"Return the LLVM target name that corresponds to SYSTEM, a system type such
as \"x86_64-linux\"."
;; See the 'lib/Target' directory of LLVM for a list of supported targets.
diff --git a/guix/utils.scm b/guix/utils.scm
index 2c56c8b2e08b..4072dea89051 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -77,6 +77,7 @@
gnu-triplet->nix-system
%current-system
%current-target-system
+ current-target-nix-system
package-name->name+version
target-mingw?
target-arm32?
@@ -520,6 +521,12 @@ returned by `config.guess'."
;; cross-building to.
(make-parameter #f))
+(define (current-target-nix-system)
+ "Return the Nix system identifier for the current target, whether we are
+cross-building or not."
+ (or (and=> (%current-target-system) gnu-triplet->nix-system)
+ (%current-system)))
+
(define* (package-name->name+version spec
#:optional (delimiter #\@))
"Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 3/9] gnu: Query membership in ‘s upported-systems’ list with Nix identifier
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-3-bauermann@kolabnow.com
Packages’ ‘supported-systems’ list contains Nix system identifiers, while
‘%current-target-system’ contains a GNU triplet. We need to use
‘current-target-nix-system’ to query the list, which always returns a Nix
system identifier.

* gnu/packages/bootloaders.scm (grub)[inputs]: Use ‘current-target-nix-system’
to query membership in (package-supported-systems).
* gnu/packages/pciutils.scm (pciutils): Likewise.
---
gnu/packages/bootloaders.scm | 9 +++------
gnu/packages/pciutils.scm | 3 +--
2 files changed, 4 insertions(+), 8 deletions(-)

Toggle diff (47 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 742992a119b2..be51fb0c3de4 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -182,16 +182,14 @@
;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and
;; 'grub-install' to recognize mapped devices (LUKS, etc.)
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems lvm2))
`(("lvm2" ,lvm2))
'())
;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install'
;; to determine whether the root file system is RAID.
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems mdadm))
`(("mdadm" ,mdadm))
'())
@@ -202,8 +200,7 @@
;; Needed for ‘grub-mount’, the only reliable way to tell whether a given
;; file system will be readable by GRUB without rebooting.
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems fuse))
`(("fuse" ,fuse))
'())
diff --git a/gnu/packages/pciutils.scm b/gnu/packages/pciutils.scm
index d7d224b292f2..f2196c4e53ae 100644
--- a/gnu/packages/pciutils.scm
+++ b/gnu/packages/pciutils.scm
@@ -112,8 +112,7 @@
`(("which" ,which)
("pkg-config" ,pkg-config)))
(inputs
- `(,@(if (member (or (%current-target-system)
- (%current-system))
+ `(,@(if (member (current-target-nix-system)
(package-supported-systems kmod))
`(("kmod" ,kmod))
'())
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 4/9] gnu: Use ‘current-target-nix-sy stem’ in pattern matches
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-4-bauermann@kolabnow.com
Parts of the code try to match a Nix system identifier to either
‘%current-target-system’ or ‘%current-system’, but this won’t work for
cross-compiling because the former parameter contains a GNU triplet
identifier.

Fix the problem by matching against ‘current-target-nix-system’, which
always returns a Nix system identifier.

* gnu/packages/astronomy.scm (libpasastro)[arguments]<#:make-flags>: Use
‘current-target-nix-system’.
* gnu/packages/compression.scm (zpaq)[arguments]<#:make-flags>: Likewise.
* gnu/packages/digest.scm (xxhash)[arguments]<#:make-flags>: Likewise.
* gnu/packages/java.scm (java-swt)[source]: Likewise.
* gnu/packages/julia.scm (julia)[arguments]<#:make-flags>: Likewise.
* gnu/packages/make-bootstrap.scm (%bootstrap-tarballs)[inputs]: Likewise.
* gnu/packages/pascal.scm (fpc)[native-inputs]: Likewise.
[arguments]<#:phases>: Likewise.
* gnu/packages/video.scm (mplayer)[arguments]<#:phases>: Likewise.
* gnu/packages/web.scm (nginx)[arguments]<#:phases>: Likewise.
(nginx-accept-language-module)[arguments]<#:phases>: Likewise.
---
gnu/packages/astronomy.scm | 4 ++--
gnu/packages/compression.scm | 6 ++----
gnu/packages/digest.scm | 3 +--
gnu/packages/java.scm | 2 +-
gnu/packages/julia.scm | 3 +--
gnu/packages/make-bootstrap.scm | 2 +-
gnu/packages/pascal.scm | 6 ++----
gnu/packages/video.scm | 3 +--
gnu/packages/web.scm | 6 ++----
9 files changed, 13 insertions(+), 22 deletions(-)

Toggle diff (157 lines)
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index a3f7d5cbf456..8c4a759718e7 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -645,11 +645,11 @@ low quality ones")
`(#:tests? #f
#:make-flags
(list
- ,(match (or (%current-target-system) (%current-system))
+ ,(match (current-target-nix-system)
((or "aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")
"OS_TARGET=linux")
(_ #f))
- ,(match (or (%current-target-system) (%current-system))
+ ,(match (current-target-nix-system)
("i686-linux" "CPU_TARGET=i386")
("x86_64-linux" "CPU_TARGET=x86_64")
((or "armhf-linux" "aarch64-linux") "CPU_TARGET=armv7l")
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index cf4ec4e644a3..ac217e663f4c 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -1434,16 +1434,14 @@ functionality in a C++ iostream.")
#:make-flags
(list
(string-append "CPPFLAGS=-Dunix"
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux" "")
("i686-linux" "")
(_ " -DNOJIT")))
;; These should be safe, lowest-common-denominator instruction sets,
;; allowing for some optimisation while remaining reproducible.
(string-append "CXXFLAGS=-O3 -DNDEBUG"
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux" " -march=nocona -mtune=generic")
("i686-linux" " -march=i686 -mtune=generic")
("armhf-linux" " -mtune=generic-armv7-a")
diff --git a/gnu/packages/digest.scm b/gnu/packages/digest.scm
index 986e33586133..b1954221f261 100644
--- a/gnu/packages/digest.scm
+++ b/gnu/packages/digest.scm
@@ -77,8 +77,7 @@ Zig, V, and Nim programming language standard libraries.")
(arguments
`(#:make-flags
(list ,(string-append "CC=" (cc-for-target))
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
;; Detect vector instruction set at run time.
((or "i686-linux" "x86_64-linux") "DISPATCH=1")
(_ "DISPATCH=0"))
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index e69d62be0802..1c62f5d358e2 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3715,7 +3715,7 @@ specification.")
(file32 "x86")
(file64 "x86_64"))
(let-values (((hash file)
- (match (or (%current-target-system) (%current-system))
+ (match (current-target-nix-system)
("x86_64-linux" (values hash64 file64))
(_ (values hash32 file32)))))
(origin
diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index abefc388bc6e..b5e29c394532 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -373,8 +373,7 @@ libraries. It is also a bit like @code{ldd} and @code{otool -L}.")
;; Passing the MARCH flag is necessary to build binary substitutes for
;; the supported architectures.
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux" "MARCH=x86-64")
("i686-linux" "MARCH=pentium4")
("armhf-linux" "JULIA_CPU_TARGET=armv7-a,neon")
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index cdcb1dcaa295..fd656f9b8bfd 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -902,7 +902,7 @@ for `sh' in $PATH, and without nscd, and with static NSS modules."
%build-inputs)
#t)))
(inputs `(("guile-tarball" ,%guile-bootstrap-tarball)
- ,@(match (or (%current-target-system) (%current-system))
+ ,@(match (current-target-nix-system)
((or "i686-linux" "x86_64-linux")
`(("bootstrap-mescc-tools" ,%mescc-tools-bootstrap-tarball)
("bootstrap-mes" ,%mes-bootstrap-tarball)
diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
index 0fdbecf05c20..9169584558b0 100644
--- a/gnu/packages/pascal.scm
+++ b/gnu/packages/pascal.scm
@@ -89,8 +89,7 @@
(native-inputs
;; FPC is built with FPC, so we need bootstrap binaries.
`(("fpc-binary"
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("i686-linux" fpc-bootstrap-i386-3.0.4)
;("powerpc64le-linux" fpc-bootstrap-ppc64le-3.0.4)
;("powerpc-linux" fpc-bootstrap-ppc-3.0.4)
@@ -101,8 +100,7 @@
#:phases
(let ((fpc-bootstrap-path
(string-append (getcwd) "/" ,name "-" ,version "/fpc-bin"))
- (arch ,(match (or (%current-target-system)
- (%current-system))
+ (arch ,(match (current-target-nix-system)
("i686-linux" "i386")
("x86_64-linux" "x86_64")
(_ "unknown"))))
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 399327741f6b..6cf8b90ffa95 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2021,8 +2021,7 @@ streaming protocols.")
(string-append "--prefix=" out)
;; Enable runtime cpu detection where supported,
;; and choose a suitable target.
- ,@(match (or (%current-target-system)
- (%current-system))
+ ,@(match (current-target-nix-system)
("x86_64-linux"
'("--enable-runtime-cpudetection"
"--target=x86_64-linux"))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 2cc8619b19d9..b00c9aa3db5b 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -413,8 +413,7 @@ the same, being completely separated from the Internet.")
,(let ((system "Linux") ; uname -s
(release "3.2.0") ; uname -r
;; uname -m
- (machine (match (or (%current-target-system)
- (%current-system))
+ (machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i686")
("mips64el-linux" "mips64")
@@ -605,8 +604,7 @@ ngx_http_accept_language_module~%")
,(let ((system "Linux") ; uname -s
(release "3.2.0") ; uname -r
;; uname -m
- (machine (match (or (%current-target-system)
- (%current-system))
+ (machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i686")
("mips64el-linux" "mips64")
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 5/9] gnu: Use ‘current-target-nix-sy stem’ in prefix checks
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-5-bauermann@kolabnow.com
Some places check whether the system identifier starts with “<arch>-linux”,
which is a Nix system identifier. The GNU triplet identifier stored in
‘%current-target-system’ may not match the pattern if it includes a vendor
field.

Fix the problem by checking against ‘current-target-nix-system’, which
always returns a Nix system identifier.

* gnu/packages/bootloaders.scm (u-boot-tools)[arguments]<#:phases>: Use
‘current-target-nix-system’.
* gnu/packages/c.scm (tcc)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/databases.scm (rocksdb)[arguments]<#:tests>: Likewise.
* gnu/packages/debug.scm (american-fuzzy-lop): Likewise.
(qemu-for-american-fuzzy-lop): Likewise.
* gnu/packages/golang.scm (go-1.4)[arguments]<#:system>: Likewise.
(go-1.14)[arguments]<#:system>: Likewise.
* gnu/packages/lisp.scm (clisp)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/mes.scm (mes-0.19)[native-inputs]: Likewise.
---
gnu/packages/bootloaders.scm | 4 +---
gnu/packages/c.scm | 3 +--
gnu/packages/databases.scm | 3 +--
gnu/packages/debug.scm | 6 ++----
gnu/packages/golang.scm | 6 ++----
gnu/packages/lisp.scm | 3 +--
gnu/packages/mes.scm | 3 +--
7 files changed, 9 insertions(+), 19 deletions(-)

Toggle diff (119 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index be51fb0c3de4..669574468bd2 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -622,9 +622,7 @@ def test_ctrl_c"))
(invoke "test/image/test-imagetools.sh")))
;; Only run full test suite on x86_64 systems, as many tests
;; assume x86_64.
- ,@(if (string-match "^x86_64-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (string-match "^x86_64-linux" (current-target-nix-system))
'((add-after 'check 'check-x86
(lambda* (#:key make-flags test-target #:allow-other-keys)
(apply invoke "make" "mrproper" make-flags)
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index 1b9003ce09dd..f85bc2f4b6c9 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -88,8 +88,7 @@
(assoc-ref %build-inputs "libc")
"/lib")
,@(if (string-prefix? "armhf-linux"
- (or (%current-target-system)
- (%current-system)))
+ (current-target-nix-system))
`("--triplet=arm-linux-gnueabihf")
'()))
#:test-target "test"))
diff --git a/gnu/packages/databases.scm b/gnu/packages/databases.scm
index 7de85d10c148..14367bde82b5 100644
--- a/gnu/packages/databases.scm
+++ b/gnu/packages/databases.scm
@@ -1379,8 +1379,7 @@ including field and record folding.")))
#:test-target "check_some"
;; Many tests fail on 32-bit platforms. There are multiple reports about
;; this upstream, but it's not going to be supported any time soon.
- #:tests? (let ((system ,(or (%current-target-system)
- (%current-system))))
+ #:tests? (let ((system ,(current-target-nix-system)))
(or (string-prefix? "x86_64-linux" system)
(string-prefix? "aarch64-linux" system)))
#:phases
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 3a29886b0e40..c5fad64692ae 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -172,8 +172,7 @@ tools that process C/C++ code.")
(license license:ncsa)))
(define-public american-fuzzy-lop
- (let ((machine (match (or (%current-target-system)
- (%current-system))
+ (let ((machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i386")
("aarch64-linux" "aarch64")
@@ -248,8 +247,7 @@ down the road.")
(define-public qemu-for-american-fuzzy-lop
;; afl only supports using a single afl-qemu-trace executable, so
;; we only build qemu for the native target.
- (let ((machine (match (or (%current-target-system)
- (%current-system))
+ (let ((machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i386")
("aarch64-linux" "aarch64")
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index 58688687bba3..939dbc83ce71 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -1046,8 +1046,7 @@ your Go binary to be later served from an http.FileSystem.")
(guix build utils)
(srfi srfi-1))
#:tests? #f ; Tests are run by the all.bash script.
- ,@(if (string-prefix? "aarch64-linux" (or (%current-target-system)
- (%current-system)))
+ ,@(if (string-prefix? "aarch64-linux" (current-target-nix-system))
'(#:system "armhf-linux")
'())
#:phases
@@ -1199,8 +1198,7 @@ in the style of communicating sequential processes (@dfn{CSP}).")
(arguments
(substitute-keyword-arguments (package-arguments go-1.4)
((#:system system)
- (if (string-prefix? "aarch64-linux" (or (%current-target-system)
- (%current-system)))
+ (if (string-prefix? "aarch64-linux" (current-target-nix-system))
"aarch64-linux"
system))
((#:phases phases)
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index ee43226ff091..6fd1cd55e009 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -347,8 +347,7 @@ supporting ASDF, Sockets, Gray streams, MOP, and other useful components.")
("libsigsegv" ,libsigsegv)))
(arguments
`(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
- (or (%current-target-system)
- (%current-system)))
+ (current-target-nix-system))
'("CFLAGS=-falign-functions=4")
'())
"--with-dynamic-ffi"
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index c66751bc7c74..d4a8278697ca 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -174,8 +174,7 @@ parsers to allow execution with Guile as extension languages.")))
("nyacc" ,nyacc-0.86)))
(native-inputs
`(("guile" ,guile-2.2)
- ,@(let ((target-system (or (%current-target-system)
- (%current-system))))
+ ,@(let ((target-system (current-target-nix-system)))
(cond
((string-prefix? "x86_64-linux" target-system)
;; Use cross-compiler rather than #:system "i686-linux" to get
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 6/9] gnu: Fix GNU/Linux system detection
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-6-bauermann@kolabnow.com
The current code isn’t strictly correct because the GNU triplet in
‘%current-target-system’ could end in “linux-gnu”. Instead, check whether
either of the system identifiers contain the string “-linux”.

* gnu/packages/messaging.scm (ngircd)[inputs]: Use ‘string-contains’.
[arguments]<#:configure-flags>: Likewise.
* gnu/packages/ntp.scm (ntp)[inputs]: Likewise
---
gnu/packages/messaging.scm | 12 ++++++------
gnu/packages/ntp.scm | 4 ++--
2 files changed, 8 insertions(+), 8 deletions(-)

Toggle diff (43 lines)
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index e5ecdb889441..f18de2a1295d 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -781,17 +781,17 @@ dictionaries. HexChat can be extended with multiple addons.")
(inputs `(("zlib" ,zlib)
("libwrap" ,tcp-wrappers)
("gnutls" ,gnutls)
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (string-contains (or (%current-target-system)
+ (%current-system))
+ "-linux")
`(("linux-pam" ,linux-pam))
'())))
(arguments
`(#:configure-flags
'("--with-gnutls" "--with-iconv" "--enable-ipv6" "--with-tcp-wrappers"
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (string-contains (or (%current-target-system)
+ (%current-system))
+ "-linux")
'("--with-pam")
'()))
#:phases
diff --git a/gnu/packages/ntp.scm b/gnu/packages/ntp.scm
index 191eedd15875..de501199596c 100644
--- a/gnu/packages/ntp.scm
+++ b/gnu/packages/ntp.scm
@@ -154,8 +154,8 @@ time-stamping or reference clock, sub-microsecond accuracy is possible.")
("libevent" ,libevent)
;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd'
;; to run as non-root (when invoked with '-u'.)
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system) (%current-system)))
+ ,@(if (string-contains (or (%current-target-system) (%current-system))
+ "-linux")
`(("libcap" ,libcap))
'())))
(arguments
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 7/9] bootloader: grub: Fix mix of GNU triplet and Nix system identifier
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-7-bauermann@kolabnow.com
‘install-grub-efi-netboot’ calls ‘nix-system->gnu-triplet’ on
‘%current-target-system’, but that parameter already contains a GNU triplet
identifier.

There’s no bug in practice because ‘install-grub-efi-netboot’ only uses the
arch part of the identifier, which is the same for both. Nevertheless, it’s
best to fix the confusion.

Therefore, define a ‘current-target-gnu-triplet’ procedure which returns
the GNU triplet identifier for the current target – whether we are
cross-building or not – and use it in ‘install-grub-efi-netboot’.

Also take the opportunity to use the new procedure in packages ‘gcc-4.7’,
‘rust-1.19’ and ‘mplayer’, which have the same logic as the new procedure.

* gnu/bootloader/grub.scm (install-grub-efi-netboot): Use
‘current-target-gnu-triplet’.
* gnu/packages/gcc.scm (gcc-4.7)[configure-flags]: Likewise.
* gnu/packages/rust.scm (rust-1.19)[arguments]<#:phases>: Likewise.
* gnu/packages/video.scm (mplayer)[arguments]<#:phases>: Likewise.
* guix/utils.scm (current-target-gnu-triplet): Define new procedure.
---
gnu/bootloader/grub.scm | 5 +----
gnu/packages/gcc.scm | 5 +----
gnu/packages/rust.scm | 4 +---
gnu/packages/video.scm | 4 +---
guix/utils.scm | 7 +++++++
5 files changed, 11 insertions(+), 14 deletions(-)

Toggle diff (87 lines)
diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm
index ce146aba3c60..fe82a3c1e9ed 100644
--- a/gnu/bootloader/grub.scm
+++ b/gnu/bootloader/grub.scm
@@ -610,10 +610,7 @@ fi~%"))))
(define (install-grub-efi-netboot subdir)
"Define a grub-efi-netboot bootloader installer for installation in SUBDIR,
which is usually efi/Guix or efi/boot."
- (let* ((system (string-split (nix-system->gnu-triplet
- (or (%current-target-system)
- (%current-system)))
- #\-))
+ (let* ((system (string-split (current-target-gnu-triplet) #\-))
(arch (first system))
(boot-efi-link (match system
;; These are the supportend systems and the names
diff --git a/gnu/packages/gcc.scm b/gnu/packages/gcc.scm
index 2fe30b13210e..4adcb5fc0d69 100644
--- a/gnu/packages/gcc.scm
+++ b/gnu/packages/gcc.scm
@@ -138,10 +138,7 @@ where the OS part is overloaded to denote a specific ABI---into GCC
"--without-headers")))
;; Pass the right options for the target triplet.
- (let ((triplet
- (or (%current-target-system)
- (nix-system->gnu-triplet (%current-system)))))
- (gcc-configure-flags-for-triplet triplet))
+ (gcc-configure-flags-for-triplet (current-target-gnu-triplet))
(maybe-target-tools))))))
(hidden-package
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index 73f94a3929bd..c8bb4d158711 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -402,9 +402,7 @@ test = { path = \"../libtest\" }
(replace 'install
(lambda* (#:key inputs outputs #:allow-other-keys)
(let* ((out (assoc-ref outputs "out"))
- (target-system ,(or (%current-target-system)
- (nix-system->gnu-triplet
- (%current-system))))
+ (target-system ,(current-target-gnu-triplet))
(out-libs (string-append out "/lib/rustlib/"
target-system "/lib")))
;(setenv "CFG_PREFIX" out)
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 6cf8b90ffa95..375e2297b889 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2032,9 +2032,7 @@ streaming protocols.")
'("--target=mips3-linux"))
(_ (list (string-append
"--target="
- (or (%current-target-system)
- (nix-system->gnu-triplet
- (%current-system)))))))
+ (current-target-gnu-triplet)))))
"--disable-iwmmxt")))))))
(home-page "https://www.mplayerhq.hu")
(synopsis "Audio and video player")
diff --git a/guix/utils.scm b/guix/utils.scm
index 4072dea89051..61da05137186 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -78,6 +78,7 @@
%current-system
%current-target-system
current-target-nix-system
+ current-target-gnu-triplet
package-name->name+version
target-mingw?
target-arm32?
@@ -527,6 +528,12 @@ cross-building or not."
(or (and=> (%current-target-system) gnu-triplet->nix-system)
(%current-system)))
+(define (current-target-gnu-triplet)
+ "Return the GNU triplet identifier for the current target, whether we are
+cross-building or not."
+ (or (%current-target-system)
+ (nix-system->gnu-triplet (%current-system))))
+
(define* (package-name->name+version spec
#:optional (delimiter #\@))
"Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 8/9] gnu: ustr: Don’t pass defau lt argument
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-8-bauermann@kolabnow.com
The default argument to ‘target-64bit?’ already is
`(or (%current-target-system) (%current-system))`, so there’s no need to
duplicate code.

* gnu/packages/textutils.scm (ustr)[arguments]<#:phases>: Don’t pass default
argument to ‘target-64bit?’.
---
gnu/packages/textutils.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Toggle diff (14 lines)
diff --git a/gnu/packages/textutils.scm b/gnu/packages/textutils.scm
index c3f4580a47c7..0f23a166e7c0 100644
--- a/gnu/packages/textutils.scm
+++ b/gnu/packages/textutils.scm
@@ -331,8 +331,7 @@ input bits thoroughly but are not suitable for cryptography.")
(lambda _
(substitute* "Makefile"
(("\\./autoconf_64b")
- ,(if (target-64bit? (or (%current-target-system)
- (%current-system)))
+ ,(if (target-64bit?)
"echo 1"
"echo 0"))
(("\\./autoconf_vsnprintf") "echo 0"))))
T
T
Thiago Jung Bauermann wrote on 21 Jul 2021 03:00
[PATCH 9/9] gnu: Use existing target helpers from ‘(guix utils)’
(address . 49672@debbugs.gnu.org)(name . Thiago Jung Bauermann)(address . bauermann@kolabnow.com)
20210721010043.632012-9-bauermann@kolabnow.com
These are equivalent to existing code and shouldn't lead to any behaviour
change. The objective of the change is to make the code easier to read.

* gnu/packages/algebra.scm (fftwf)[arguments]<#:configure-flags>: Use
‘target-arm32?’.
* gnu/packages/boost.scm (boost)[arguments]<#:make-flags>: Use
‘target-arm32?’ and ‘target-aarch64?’.
* gnu/packages/bootloaders.scm (grub)[arguments]<#:tests>: Use
‘target-arm?’.
(vboot-utils)[arguments]<#:make-flags>: Use ‘target-arm32?’.
* gnu/packages/ci.scm (cuirass)[arguments]<#:tests>: Use ‘target-aarch64?’.
* gnu/packages/firmware.scm (ovmf-aarch64)[native-inputs]: Use ‘target-aarch64?’.
[arguments]<#:phases>: Likewise.
* gnu/packages/gstreamer.scm (gst-plugins-base)[propagated-inputs]: Use
‘target-arm32?’.
(gst-plugins-bad)[arguments]<#:phases>: Likewise.
* gnu/packages/java.scm (jamvm-1-bootstrap)[arguments]<#:phases>: Use
‘target-aarch64?’.
[native-inputs]: Likewise.
* gnu/packages/linux.scm (proot)[arguments]<#:tests>: Use ‘target-arm?’.
* gnu/packages/multiprecision.scm (qd)[arguments]<#:configure-flags>: Use
‘target-aarch64?’.
* gnu/packages/php.scm (php)[arguments]<#:phases>: Use ‘target-arm32?’.
* gnu/packages/python.scm (python-3.8)[arguments]<#:phases>: Use ‘target-arm?’.
[native-inputs]: Likewise.
* gnu/packages/syncthing.scm (go-github-com-rcrowley-go-metrics)[arguments]
<#:tests>: Use ‘target-aarch64?’.
* gnu/packages/valgrind.scm (valgrind)[arguments]<#:make-flags>: Use
‘target-powerpc?’.
* gnu/packages/web.scm (rapidjson)[arguments]<#:phases>: Use ‘target-aarch64?’.
---
gnu/packages/algebra.scm | 3 +--
gnu/packages/boost.scm | 4 ++--
gnu/packages/bootloaders.scm | 9 ++-------
gnu/packages/ci.scm | 6 ++----
gnu/packages/firmware.scm | 4 ++--
gnu/packages/gstreamer.scm | 6 ++----
gnu/packages/java.scm | 6 ++----
gnu/packages/linux.scm | 4 +---
gnu/packages/multiprecision.scm | 4 +---
gnu/packages/php.scm | 3 +--
gnu/packages/python.scm | 26 ++++++++++----------------
gnu/packages/syncthing.scm | 4 ++--
gnu/packages/valgrind.scm | 4 ++--
gnu/packages/web.scm | 3 +--
14 files changed, 31 insertions(+), 55 deletions(-)

Toggle diff (299 lines)
diff --git a/gnu/packages/algebra.scm b/gnu/packages/algebra.scm
index 533b1f09e023..f51bd69a4230 100644
--- a/gnu/packages/algebra.scm
+++ b/gnu/packages/algebra.scm
@@ -802,8 +802,7 @@ cosine/ sine transforms or DCT/DST).")
(substitute-keyword-arguments (package-arguments fftw)
((#:configure-flags fftw-configure-flags)
`(cons* "--enable-single"
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-arm32?)
;; fftw supports NEON on 32-bit ARM only when compiled
;; for single-precision, so add it here.
'("--enable-neon")
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index e05a3c32fe11..67d452e925e1 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -108,11 +108,11 @@
"binary-format=elf"
"target-os=linux"
,@(cond
- ((string-prefix? "arm" (%current-target-system))
+ ((target-arm32?)
'("abi=aapcs"
"address-model=32"
"architecture=arm"))
- ((string-prefix? "aarch64" (%current-target-system))
+ ((target-aarch64?)
'("abi=aapcs"
"address-model=64"
"architecture=arm"))
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 669574468bd2..6912cffa38be 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -173,10 +173,7 @@
"test_unset"))
#t)))
;; Disable tests on ARM and AARCH64 platforms or when cross-compiling.
- #:tests? ,(not (or (any (cute string-prefix? <> (or (%current-target-system)
- (%current-system)))
- '("arm" "aarch64"))
- (%current-target-system)))))
+ #:tests? ,(not (or (target-arm?) (%current-target-system)))))
(inputs
`(("gettext" ,gettext-minimal)
@@ -988,9 +985,7 @@ to Novena upstream, does not load u-boot.img from the first partition.")
;; "armv7l", the value of `uname -m`, and will not
;; match ${ARCH}, which will make the tests require
;; QEMU for testing.
- ,@(if (string-prefix? "arm"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-arm32?)
'("HOST_ARCH=arm")
'())
(string-append "DESTDIR=" (assoc-ref %outputs "out")))
diff --git a/gnu/packages/ci.scm b/gnu/packages/ci.scm
index 0bcde0fad515..bddc1e8386c2 100644
--- a/gnu/packages/ci.scm
+++ b/gnu/packages/ci.scm
@@ -27,7 +27,7 @@
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
- #:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (gnu packages autotools)
#:use-module (gnu packages base)
#:use-module (gnu packages boost)
@@ -97,9 +97,7 @@
#:configure-flags '("--localstatedir=/var") ;for /var/log/cuirass
;; XXX: HTTP tests fail on aarch64 due to Fibers errors, disable them
;; on that architecture for now.
- #:tests? ,(let ((s (or (%current-target-system)
- (%current-system))))
- (not (string-prefix? "aarch64" s)))
+ #:tests? ,(not (target-aarch64?))
#:parallel-tests? #f
#:phases
(modify-phases %standard-phases
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index ebcb89923cee..b569bc288949 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -398,7 +398,7 @@ Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
(name "ovmf-aarch64")
(native-inputs
`(,@(package-native-inputs ovmf)
- ,@(if (not (string-prefix? "aarch64" (%current-system)))
+ ,@(if (not (target-aarch64? (%current-system)))
`(("cross-gcc" ,(cross-gcc "aarch64-linux-gnu"))
("cross-binutils" ,(cross-binutils "aarch64-linux-gnu")))
'())))
@@ -408,7 +408,7 @@ Virtual Machines. OVMF contains a sample UEFI firmware for QEMU and KVM.")
`(modify-phases ,phases
(add-before 'configure 'set-env
(lambda _
- ,@(if (not (string-prefix? "aarch64" (%current-system)))
+ ,@(if (not (target-aarch64? (%current-system)))
`((setenv "GCC49_AARCH64_PREFIX" "aarch64-linux-gnu-"))
'())
#t))
diff --git a/gnu/packages/gstreamer.scm b/gnu/packages/gstreamer.scm
index 3047773e0f07..488417c39773 100644
--- a/gnu/packages/gstreamer.scm
+++ b/gnu/packages/gstreamer.scm
@@ -539,8 +539,7 @@ This package provides the core library and elements.")
;; XXX: Do not enable Orc optimizations on ARM systems because
;; it leads to two test failures.
;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/683
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-arm32?)
'()
`(("orc" ,orc))))) ;required by gstreamer-audio-1.0.pc
(inputs
@@ -691,8 +690,7 @@ model to base your own plug-in on, here it is.")
`(#:phases
(modify-phases %standard-phases
,@%common-gstreamer-phases
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-arm32?)
;; Disable test that fails on ARMv7.
;; https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1188
`((add-after 'unpack 'disable-asfmux-test
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index 1c62f5d358e2..5b5d5afed945 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -315,8 +315,7 @@ language.")
"--enable-runtime-reloc-checks"
"--enable-ffi")
#:phases
- ,(if (string-prefix? "aarch64" (or (%current-target-system)
- (%current-system)))
+ ,(if (target-aarch64?)
;; Makefiles and the configure script need to be regenerated to
;; incorporate support for AArch64.
'(modify-phases %standard-phases
@@ -330,8 +329,7 @@ language.")
("zip" ,zip)
("zlib" ,zlib)))
(native-inputs
- (if (string-prefix? "aarch64" (or (%current-target-system)
- (%current-system)))
+ (if (target-aarch64?)
;; Additional packages needed for autoreconf.
`(("autoconf" ,autoconf)
("automake" ,automake)
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index 0d695950d101..c6b7c0a403ef 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -6890,9 +6890,7 @@ userspace queueing component and the logging subsystem.")
;; Disable the test suite on ARM platforms, as there are too many
;; failures to keep track of (see for example:
;; https://github.com/proot-me/proot/issues/263).
- `(#:tests? ,(not (string-match "^(arm|aarch64)"
- (or (%current-target-system)
- (%current-system))))
+ `(#:tests? ,(not (target-arm?))
#:make-flags '("-C" "src")
#:phases (modify-phases %standard-phases
(add-after 'unpack 'patch-sources
diff --git a/gnu/packages/multiprecision.scm b/gnu/packages/multiprecision.scm
index 733e6548b992..53b1e3c55ca7 100644
--- a/gnu/packages/multiprecision.scm
+++ b/gnu/packages/multiprecision.scm
@@ -235,9 +235,7 @@ error. Additionally, iRRAM uses the concept of multi-valued functions.")
(arguments
`(#:configure-flags `("--disable-enable_fma" ;weird :/
"--enable-shared"
- ,,@(if (string-prefix? "aarch64"
- (or (%current-target-system)
- (%current-system)))
+ ,,@(if (target-aarch64?)
;; XXX: The qd_test test fails numerical
;; accuracy checks for 'dd_real::exp()' on
;; aarch64 with GCC 5.4 at -O2. Disabling
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 597494e8a94f..36a4527aad67 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -177,8 +177,7 @@
(substitute* "ext/standard/tests/streams/bug60602.phpt"
(("'ls'") (string-append "'" (which "ls") "'")))
- ,@(if (string-prefix? "arm" (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-arm32?)
;; Drop tests known to fail on armhf.
'((for-each delete-file
(list
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index e694321e173e..c1a486b9f21f 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -488,16 +488,13 @@ data types.")
#t)))
;; XXX: Apply patch on ARM platforms only to avoid a full rebuild.
;; Remove this phase in the next rebuild cycle.
- ,@(let ((system (or (%current-target-system)
- (%current-system))))
- (if (any (cute string-prefix? <> system)
- '("arm" "aarch64"))
- '((add-after 'unpack 'apply-alignment-patch
- (lambda* (#:key native-inputs inputs #:allow-other-keys)
- (invoke "patch" "-p1" "--force" "--input"
- (assoc-ref (or native-inputs inputs)
- "arm-alignment.patch")))))
- '()))))))
+ ,@(if (target-arm?)
+ '((add-after 'unpack 'apply-alignment-patch
+ (lambda* (#:key native-inputs inputs #:allow-other-keys)
+ (invoke "patch" "-p1" "--force" "--input"
+ (assoc-ref (or native-inputs inputs)
+ "arm-alignment.patch")))))
+ '())))))
(native-inputs
`(("tzdata" ,tzdata-for-tests)
@@ -505,12 +502,9 @@ data types.")
;; it causes a test failure when building 32-bit Python on a
;; 64-bit kernel. See <https://bugs.python.org/issue36515>.
;; TODO: make this a regular patch in the next rebuild cycle.
- ,@(let ((system (or (%current-target-system)
- (%current-system))))
- (if (any (cute string-prefix? <> system)
- '("arm" "aarch64"))
- `(("arm-alignment.patch" ,(search-patch "python-3-arm-alignment.patch")))
- '()))
+ ,@(if (target-arm?)
+ `(("arm-alignment.patch" ,(search-patch "python-3-arm-alignment.patch")))
+ '())
,@(if (%current-target-system)
`(("python3" ,this-package))
diff --git a/gnu/packages/syncthing.scm b/gnu/packages/syncthing.scm
index 5cb8449e448e..b23fcea24096 100644
--- a/gnu/packages/syncthing.scm
+++ b/gnu/packages/syncthing.scm
@@ -30,6 +30,7 @@
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix licenses)
+ #:use-module (guix utils)
#:use-module (gnu packages)
#:use-module (gnu packages freedesktop)
#:use-module (gnu packages glib)
@@ -568,8 +569,7 @@ higher-level API for doing so.")
(arguments
;; Arbitrary precision tests are known to be broken on aarch64, ppc64le
;; and s390x. See: https://github.com/rcrowley/go-metrics/issues/249
- `(#:tests? ,(not (string-prefix? "aarch64" (or (%current-target-system)
- (%current-system))))
+ `(#:tests? ,(not (target-aarch64?))
#:import-path "github.com/rcrowley/go-metrics"))
(propagated-inputs
`(("go-github-com-stathat-go" ,go-github-com-stathat-go)))
diff --git a/gnu/packages/valgrind.scm b/gnu/packages/valgrind.scm
index 4036bd461bc5..24b422c2c52c 100644
--- a/gnu/packages/valgrind.scm
+++ b/gnu/packages/valgrind.scm
@@ -26,6 +26,7 @@
#:use-module (guix download)
#:use-module (guix build-system gnu)
#:use-module (guix licenses)
+ #:use-module (guix utils)
#:use-module (gnu packages gdb)
#:use-module (gnu packages perl)
#:use-module (gnu packages))
@@ -50,8 +51,7 @@
(outputs '("doc" ;16 MB
"out"))
(arguments
- `(,@(if (string-prefix? "powerpc" (or (%current-target-system)
- (%current-system)))
+ `(,@(if (target-powerpc?)
`(#:make-flags '("CFLAGS+=-maltivec"))
'())
#:phases
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index b00c9aa3db5b..a6812699d77b 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -1322,8 +1322,7 @@ current version of any major web browser.")
#t))))
(build-system cmake-build-system)
(arguments
- (if (string-prefix? "aarch64" (or (%current-target-system)
- (%current-system)))
+ (if (target-aarch64?)
'(#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-aarch-march-detection
M
M
Maxime Devos wrote on 7 Nov 2021 12:23
Re: [PATCH 0/9] Target check fixes and cleanups
(address . 49672@debbugs.gnu.org)
ad520bfa130edb60767b90cc7cd58f819a00d234.camel@telenet.be
Hi,

I looked over the patch series, and almost all seems reasonable to me.
though I would split patch 7/9 into a patch defining
current-target-gnu-triplet and into a patch using current-target-gnu-
triplet,
and possibly a rebase might be neccesary.

Warning: I only looked at the patches, I didn't apply them for testing.

I don't think the following change is necessary though:

-           ,@(if (string-match "^x86_64-linux"
-                               (or (%current-target-system)
-                                   (%current-system)))
+           ,@(if (string-match "^x86_64-linux" (current-target-nix-
system))

because the regex ^x86_64-linux would match both the nix system and GNU
triplet
IIUC.

Greetings,
Maxime.
T
T
Thiago Jung Bauermann wrote on 12 Nov 2021 01:56
Re: [bug#49672] [PATCH 0/9] Target check fixes and cleanups
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 49672@debbugs.gnu.org)
2451084.S0jLYT9aXA@popigai
Hello Maxime,

Em domingo, 7 de novembro de 2021, às 08:23:37 -03, Maxime Devos escreveu:
Toggle quote (2 lines)
> I looked over the patch series, and almost all seems reasonable to me.

Thank you for reviewing the patches! I will work on a second version
addressing your comments.

Toggle quote (4 lines)
> though I would split patch 7/9 into a patch defining
> current-target-gnu-triplet and into a patch using current-target-gnu-
> triplet,

Ok, I will do this.

Toggle quote (2 lines)
> and possibly a rebase might be neccesary.

I will do this as well.

Toggle quote (2 lines)
> Warning: I only looked at the patches, I didn't apply them for testing.

I don’t recall how thoroughly I tested these patches. I’ll try to do more
extensive testing on v2.

Toggle quote (12 lines)
> I don't think the following change is necessary though:
>
> - ,@(if (string-match "^x86_64-linux"
> - (or (%current-target-system)
> - (%current-system)))
> + ,@(if (string-match "^x86_64-linux" (current-target-nix-
> system))
>
> because the regex ^x86_64-linux would match both the nix system and GNU
> triplet
> IIUC.

Maybe in the way Guix uses GNU triplets the regex would match (I don’t
actually know) but in theory at least it wouldn’t, because “x86_64-linux”
isn’t a complete GNU triplet: it’s missing the vendor field. A complete
triplet would be “x86_64-unknown-linux-gnu”, or “x86_64-pc-linux-gnu”.

There’s a bit more information here: https://wiki.osdev.org/Target_Triplet

This is actually one of the main reasons why I decided to clean up the
handling of Nix system identifiers and GNU triplet identifiers.

--
Thanks,
Thiago
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 0/6] Target check fixes for cross compilation
(address . 49672@debbugs.gnu.org)
20220327214026.102723-1-bauermann@kolabnow.com
Hello,

I've been working on and off on this fixes and cleanups series for a long
time now, but it became a bit unwieldy and overwhelming so in the interest
of shipping something I decided to split the fixes from the cleanups. This
way I can at least submit the former, and leave the latter for an
unspecified, uncertain future.

I tested that on x86_64-linux the build derivations of all packages modified
by these packages are unchanged. They only affect (for the better!) cross
builds. This means that this patch series can go to master.

I don't mind rebasing it if by the time the series is approved, it doesn't
cleanly apply anymore.

Changes since v1:

- Patch “gnu: Fix GNU/Linux system detection”
- Use ‘target-linux?’ helper rather than ‘string-contains’.

- Patch “gnu: libgc: Use default argument in ‘target-hurd?’ call”
- New patch.

- Patch “utils: Introduce the ‘current-target-nix-system’ procedure”
- Reworded commit message.

- Patch “gnu: Use ‘current-target-nix-system’ for matches”
- Reworded commit message.
- Squashed with patch “gnu: Use ‘current-target-nix-system’ in prefix checks”
- Found more packages where these changes were needed.

- Patch “bootloader: grub: Fix mix of GNU triplet and Nix system identifier”
- Patch dropped. It was a cleanup, not a bug fix.

- Patch “gnu: ustr: Don’t pass default argument”
- Patch dropped. It was a cleanup, not a bug fix.

- Patch “gnu: Use existing target helpers from ‘(guix utils)’”
- Patch dropped. It was a cleanup, not a bug fix.

Thiago Jung Bauermann (6):
gnu: Fix GNU/Linux system detection
gnu: libgc: Use default argument in ‘target-hurd?’ call
utils: Introduce the ‘current-target-nix-system’ procedure
gnu: Use ‘current-target-nix-system’ for matches
gnu: Query membership in ‘supported-systems’ list with Nix identifier
gnu: Fix check of ‘%current-system’ and ‘%current-target-system’

gnu/packages/astronomy.scm | 4 ++--
gnu/packages/bdw-gc.scm | 3 +--
gnu/packages/bootloaders.scm | 13 ++++---------
gnu/packages/bootstrap.scm | 4 +---
gnu/packages/c.scm | 3 +--
gnu/packages/compression.scm | 6 ++----
gnu/packages/crypto.scm | 4 ++--
gnu/packages/debug.scm | 6 ++----
gnu/packages/digest.scm | 3 +--
gnu/packages/golang.scm | 6 ++----
gnu/packages/java.scm | 20 ++++++++++----------
gnu/packages/julia.scm | 3 +--
gnu/packages/lisp.scm | 3 +--
gnu/packages/llvm.scm | 4 +---
gnu/packages/make-bootstrap.scm | 2 +-
gnu/packages/mes.scm | 3 +--
gnu/packages/messaging.scm | 8 ++------
gnu/packages/ntp.scm | 3 +--
gnu/packages/pascal.scm | 6 ++----
gnu/packages/photo.scm | 4 ++--
gnu/packages/php.scm | 4 ++--
gnu/packages/sdl.scm | 4 ++--
gnu/packages/telephony.scm | 4 ++--
gnu/packages/video.scm | 3 +--
gnu/packages/web.scm | 6 ++----
guix/utils.scm | 7 +++++++
26 files changed, 56 insertions(+), 80 deletions(-)


base-commit: ff4585d147ef3bb55c6cbbd86ca8fc582ad6b561
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 1/6] gnu: Fix GNU/Linux system detection
(address . 49672@debbugs.gnu.org)
20220327214026.102723-2-bauermann@kolabnow.com
The current code isn’t strictly correct because the GNU triplet in
‘%current-target-system’ could end in “linux-gnu”. The helper works in all
cases.

* gnu/packages/messaging.scm (ngircd)[inputs]: Use ‘target-linux?’.
[arguments]<#:configure-flags>: Likewise.
* gnu/packages/ntp.scm (ntp)[inputs]: Likewise
---
gnu/packages/messaging.scm | 8 ++------
gnu/packages/ntp.scm | 3 +--
2 files changed, 3 insertions(+), 8 deletions(-)

Toggle diff (38 lines)
diff --git a/gnu/packages/messaging.scm b/gnu/packages/messaging.scm
index f40c3a7e2ccb..44809754212a 100644
--- a/gnu/packages/messaging.scm
+++ b/gnu/packages/messaging.scm
@@ -899,17 +899,13 @@ (define-public ngircd
(inputs `(("zlib" ,zlib)
("libwrap" ,tcp-wrappers)
("gnutls" ,gnutls)
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-linux?)
`(("linux-pam" ,linux-pam))
'())))
(arguments
`(#:configure-flags
'("--with-gnutls" "--with-iconv" "--enable-ipv6" "--with-tcp-wrappers"
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (target-linux?)
'("--with-pam")
'()))
#:phases
diff --git a/gnu/packages/ntp.scm b/gnu/packages/ntp.scm
index 7a3c033b2e12..d7f99c614ed8 100644
--- a/gnu/packages/ntp.scm
+++ b/gnu/packages/ntp.scm
@@ -148,8 +148,7 @@ (define-public ntp
("libevent" ,libevent)
;; Build with POSIX capabilities support on GNU/Linux. This allows 'ntpd'
;; to run as non-root (when invoked with '-u'.)
- ,@(if (string-suffix? "-linux"
- (or (%current-target-system) (%current-system)))
+ ,@(if (target-linux?)
`(("libcap" ,libcap))
'())))
(arguments
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 2/6] gnu: libgc: Use default argument in ‘target-hurd?’ call
(address . 49672@debbugs.gnu.org)
20220327214026.102723-3-bauermann@kolabnow.com
‘%current-system’ is always defined, so the expression
“(or (%current-system) (%current-target-system))” is equivalent to
“(%current-system)”, which is unlikely to be the intent of the code.

The default argument for ‘target-hurd?’ has the ‘or’ expression in the
correct order, so just use that.

* gnu/packages/bdw-gc.scm (libgc)[arguments]<#:configure-flags>: Omit
argument in call to ‘target-hurd?’.
---
gnu/packages/bdw-gc.scm | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

Toggle diff (14 lines)
diff --git a/gnu/packages/bdw-gc.scm b/gnu/packages/bdw-gc.scm
index 2698d56da00b..13a6691db4b2 100644
--- a/gnu/packages/bdw-gc.scm
+++ b/gnu/packages/bdw-gc.scm
@@ -56,8 +56,7 @@ (define-public libgc
;; to configure script. See bug report and discussion:
;; <https://lists.opendylan.org/pipermail/bdwgc/2017-April/006275.html>
;; <https://lists.gnu.org/archive/html/bug-hurd/2017-01/msg00008.html>
- ,@(if (target-hurd? (or (%current-system)
- (%current-target-system)))
+ ,@(if (target-hurd?)
'("--disable-gcj-support")
'()))))
(native-inputs (list pkg-config))
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 4/6] gnu: Use ‘current-target-nix -system’ for matches
(address . 49672@debbugs.gnu.org)
20220327214026.102723-5-bauermann@kolabnow.com
Several packages try to match both ‘%current-target-system’ and
‘%current-system’ against lists of Nix system identifiers.

This is a bug because while ‘%current-system’ does contain a Nix system
identifier, ‘%current-target-system’ contains a GNU triplet, which is
different.

Some places also check whether the system identifier starts with
“<arch>-linux”, which is a Nix system identifier. The GNU triplet identifier
stored in ‘%current-target-system’ may not match the pattern if it includes a
vendor field (e.g., “x86_64-unknown-linux-gnu”, or "i586-pc-gnu”).

To fix these problems make these places use the function
‘current-target-nix-system’, which always returns a Nix system identifier.

In the case of the “go” and “clisp” packages, this also fixes a bug where
‘%current-system’ and ‘%current-target-system’ were being checked in the
wrong order.

* gnu/packages/astronomy.scm (libpasastro)[arguments]<#:make-flags>: Use
‘current-target-nix-system’ to match list of Nix system identifiers.
* gnu/packages/bootloaders.scm (u-boot-tools)[arguments]<#:phases>: Likewise.
* gnu/packages/c.scm (tcc)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/compression.scm (zpaq)[arguments]<#:make-flags>: Likewise.
* gnu/packages/debug.scm (american-fuzzy-lop): Likewise.
(qemu-for-american-fuzzy-lop): Likewise.
* gnu/packages/digest.scm (xxhash)[arguments]<#:make-flags>: Likewise.
* gnu/packages/golang.scm (go-1.4)[arguments]<#:system>: Likewise.
(go-1.14)[arguments]<#:system>: Likewise.
* gnu/packages/java.scm (java-swt)[source]: Likewise.
(java-jansi)[arguments]<#:phases>: Likewise.
* gnu/packages/julia.scm (julia)[arguments]<#:make-flags>: Likewise.
* gnu/packages/lisp.scm (clisp)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/make-bootstrap.scm (%bootstrap-tarballs)[arguments]
<#:builder>: Likewise
* gnu/packages/mes.scm (mes)[native-inputs]: Likewise.
* gnu/packages/pascal.scm (fpc)[native-inputs]: Likewise.
[arguments]<#:phases>: Likewise.
* gnu/packages/video.scm (mplayer)[arguments]<#:phases>: Likewise.
* gnu/packages/web.scm (nginx)[arguments]<#:phases>: Likewise.
* gnu/packages/web.scm (nginx-accept-language-module)[arguments]
<#:phases>: Likewise.
---
gnu/packages/astronomy.scm | 4 ++--
gnu/packages/bootloaders.scm | 4 +---
gnu/packages/c.scm | 3 +--
gnu/packages/compression.scm | 6 ++----
gnu/packages/debug.scm | 6 ++----
gnu/packages/digest.scm | 3 +--
gnu/packages/golang.scm | 6 ++----
gnu/packages/java.scm | 4 ++--
gnu/packages/julia.scm | 3 +--
gnu/packages/lisp.scm | 3 +--
gnu/packages/make-bootstrap.scm | 2 +-
gnu/packages/mes.scm | 3 +--
gnu/packages/pascal.scm | 6 ++----
gnu/packages/video.scm | 3 +--
gnu/packages/web.scm | 6 ++----
15 files changed, 22 insertions(+), 40 deletions(-)

Toggle diff (271 lines)
diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index c209b1538f72..baa48e382ba4 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -1021,11 +1021,11 @@ (define-public libpasastro
`(#:tests? #f
#:make-flags
(list
- ,(match (or (%current-target-system) (%current-system))
+ ,(match (current-target-nix-system)
((or "aarch64-linux" "armhf-linux" "i686-linux" "x86_64-linux")
"OS_TARGET=linux")
(_ #f))
- ,(match (or (%current-target-system) (%current-system))
+ ,(match (current-target-nix-system)
("i686-linux" "CPU_TARGET=i386")
("x86_64-linux" "CPU_TARGET=x86_64")
((or "armhf-linux" "aarch64-linux") "CPU_TARGET=armv7l")
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 798764103117..40dd38fdd28a 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -640,9 +640,7 @@ (define-public u-boot-tools
(invoke "test/image/test-imagetools.sh")))
;; Only run full test suite on x86_64 systems, as many tests
;; assume x86_64.
- ,@(if (string-match "^x86_64-linux"
- (or (%current-target-system)
- (%current-system)))
+ ,@(if (string-match "^x86_64-linux" (current-target-nix-system))
'((add-after 'check 'check-x86
(lambda* (#:key make-flags test-target #:allow-other-keys)
(apply invoke "make" "mrproper" make-flags)
diff --git a/gnu/packages/c.scm b/gnu/packages/c.scm
index d545d98938b0..f9e4c497de6a 100644
--- a/gnu/packages/c.scm
+++ b/gnu/packages/c.scm
@@ -90,8 +90,7 @@ (define-public tcc
(assoc-ref %build-inputs "libc")
"/lib")
,@(if (string-prefix? "armhf-linux"
- (or (%current-target-system)
- (%current-system)))
+ (current-target-nix-system))
`("--triplet=arm-linux-gnueabihf")
'()))
#:test-target "test"))
diff --git a/gnu/packages/compression.scm b/gnu/packages/compression.scm
index 3edaecd9518f..7e906eceda52 100644
--- a/gnu/packages/compression.scm
+++ b/gnu/packages/compression.scm
@@ -1449,16 +1449,14 @@ (define-public zpaq
#:make-flags
(list
(string-append "CPPFLAGS=-Dunix"
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux" "")
("i686-linux" "")
(_ " -DNOJIT")))
;; These should be safe, lowest-common-denominator instruction sets,
;; allowing for some optimisation while remaining reproducible.
(string-append "CXXFLAGS=-O3 -DNDEBUG"
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux" " -march=nocona -mtune=generic")
("i686-linux" " -march=i686 -mtune=generic")
("armhf-linux" " -mtune=generic-armv7-a")
diff --git a/gnu/packages/debug.scm b/gnu/packages/debug.scm
index 80685900ebb6..d96217c95b76 100644
--- a/gnu/packages/debug.scm
+++ b/gnu/packages/debug.scm
@@ -228,8 +228,7 @@ (define-public c-vise
(license license:ncsa)))
(define-public american-fuzzy-lop
- (let ((machine (match (or (%current-target-system)
- (%current-system))
+ (let ((machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i386")
("aarch64-linux" "aarch64")
@@ -304,8 +303,7 @@ (define-public american-fuzzy-lop
(define-public qemu-for-american-fuzzy-lop
;; afl only supports using a single afl-qemu-trace executable, so
;; we only build qemu for the native target.
- (let ((machine (match (or (%current-target-system)
- (%current-system))
+ (let ((machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i386")
("aarch64-linux" "aarch64")
diff --git a/gnu/packages/digest.scm b/gnu/packages/digest.scm
index 4211848fdb61..31e9d315cd07 100644
--- a/gnu/packages/digest.scm
+++ b/gnu/packages/digest.scm
@@ -82,8 +82,7 @@ (define-public xxhash
(arguments
(list #:make-flags
#~(list #$(string-append "CC=" (cc-for-target))
- #$(match (or (%current-target-system)
- (%current-system))
+ #$(match (current-target-nix-system)
;; Detect vector instruction set at run time.
((or "i686-linux" "x86_64-linux") "DISPATCH=1")
(_ "DISPATCH=0"))
diff --git a/gnu/packages/golang.scm b/gnu/packages/golang.scm
index a8b845e3012a..e7ebf09f1c46 100644
--- a/gnu/packages/golang.scm
+++ b/gnu/packages/golang.scm
@@ -114,8 +114,7 @@ (define-public go-1.4
(guix build utils)
(srfi srfi-1))
#:tests? #f ; Tests are run by the all.bash script.
- ,@(if (string-prefix? "aarch64-linux" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "aarch64-linux" (current-target-nix-system))
'(#:system "armhf-linux")
'())
#:phases
@@ -264,8 +263,7 @@ (define-public go-1.14
(arguments
(substitute-keyword-arguments (package-arguments go-1.4)
((#:system system)
- (if (string-prefix? "aarch64-linux" (or (%current-system)
- (%current-target-system)))
+ (if (string-prefix? "aarch64-linux" (current-target-nix-system))
"aarch64-linux"
system))
((#:phases phases)
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index b27892841ec6..aead02d93c31 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -3483,7 +3483,7 @@ (define-public java-swt
(file32 "x86")
(file64 "x86_64"))
(let-values (((hash file)
- (match (or (%current-target-system) (%current-system))
+ (match (current-target-nix-system)
("x86_64-linux" (values hash64 file64))
(_ (values hash32 file32)))))
(origin
@@ -12092,7 +12092,7 @@ (define-public java-jansi
(lambda _
(let ((dir (string-append "build/classes/org/fusesource/"
"jansi/internal/native/"
- ,(match (or (%current-target-system) (%current-system))
+ ,(match (current-target-nix-system)
("i686-linux" "Linux/x86")
("x86_64-linux" "Linux/x86_64")
("armhf-linux" "Linux/armv7")
diff --git a/gnu/packages/julia.scm b/gnu/packages/julia.scm
index 0bdac6617508..c1a1d185d544 100644
--- a/gnu/packages/julia.scm
+++ b/gnu/packages/julia.scm
@@ -452,8 +452,7 @@ (define-public julia
;; Passing the MARCH or JULIA_CPU_TARGET flag is necessary to build
;; binary substitutes for the supported architectures. See also
;; https://docs.julialang.org/en/v1/devdocs/sysimg/#Specifying-multiple-system-image-targets
- ,(match (or (%current-target-system)
- (%current-system))
+ ,(match (current-target-nix-system)
("x86_64-linux"
;; These are the flags that upstream uses for their binaries.
"JULIA_CPU_TARGET=generic;generic,-cx16,clone_all;sandybridge,-xsaveopt,clone_all;haswell,-rdrnd,base(1)")
diff --git a/gnu/packages/lisp.scm b/gnu/packages/lisp.scm
index 361d6409d43a..e6e1aada5b1c 100644
--- a/gnu/packages/lisp.scm
+++ b/gnu/packages/lisp.scm
@@ -356,8 +356,7 @@ (define-public clisp
(inputs (list libffcall ncurses readline libsigsegv))
(arguments
`(#:configure-flags '(,@(if (string-prefix? "armhf-linux"
- (or (%current-system)
- (%current-target-system)))
+ (current-target-nix-system))
'("CFLAGS=-falign-functions=4")
'())
"--with-dynamic-ffi"
diff --git a/gnu/packages/make-bootstrap.scm b/gnu/packages/make-bootstrap.scm
index 4ea97368a99e..595630d22b58 100644
--- a/gnu/packages/make-bootstrap.scm
+++ b/gnu/packages/make-bootstrap.scm
@@ -897,7 +897,7 @@ (define out #$output)
%build-inputs))))
(inputs
(append (list %guile-bootstrap-tarball)
- (match (or (%current-target-system) (%current-system))
+ (match (current-target-nix-system)
((or "i686-linux" "x86_64-linux")
(list %mescc-tools-bootstrap-tarball
%mes-bootstrap-tarball
diff --git a/gnu/packages/mes.scm b/gnu/packages/mes.scm
index a862d84fc8ce..e5e947cb4df9 100644
--- a/gnu/packages/mes.scm
+++ b/gnu/packages/mes.scm
@@ -179,8 +179,7 @@ (define-public mes
(propagated-inputs (list mescc-tools nyacc-1.00.2))
(native-inputs
(append (list guile-3.0)
- (let ((target-system (or (%current-target-system)
- (%current-system))))
+ (let ((target-system (current-target-nix-system)))
(cond
((string-prefix? "x86_64-linux" target-system)
;; Use cross-compiler rather than #:system "i686-linux" to get
diff --git a/gnu/packages/pascal.scm b/gnu/packages/pascal.scm
index af7857f08495..7a3260ccbbaf 100644
--- a/gnu/packages/pascal.scm
+++ b/gnu/packages/pascal.scm
@@ -89,8 +89,7 @@ (define-public fpc
(list expat glibc ld-wrapper ncurses zlib))
(native-inputs
;; FPC is built with FPC, so we need bootstrap binaries.
- `(("fpc-binary" ,(match (or (%current-target-system)
- (%current-system))
+ `(("fpc-binary" ,(match (current-target-nix-system)
("i686-linux" fpc-bootstrap-i386)
;;("powerpc64le-linux" fpc-bootstrap-ppc64le)
;;("powerpc-linux" fpc-bootstrap-ppc)
@@ -103,8 +102,7 @@ (define-public fpc
#:phases
(let ((fpc-bootstrap-path
(string-append (getcwd) "/" ,name "-" ,version "/fpc-bin"))
- (arch ,(match (or (%current-target-system)
- (%current-system))
+ (arch ,(match (current-target-nix-system)
("i686-linux" "i386")
("x86_64-linux" "x86_64")
(_ "unknown"))))
diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index dc05c0a22265..3684421ecaa7 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -2089,8 +2089,7 @@ (define-public mplayer
(string-append "--prefix=" out)
;; Enable runtime cpu detection where supported,
;; and choose a suitable target.
- ,@(match (or (%current-target-system)
- (%current-system))
+ ,@(match (current-target-nix-system)
("x86_64-linux"
'("--enable-runtime-cpudetection"
"--target=x86_64-linux"))
diff --git a/gnu/packages/web.scm b/gnu/packages/web.scm
index 75aa5ce9078b..24535226ec20 100644
--- a/gnu/packages/web.scm
+++ b/gnu/packages/web.scm
@@ -413,8 +413,7 @@ (define-public nginx
,(let ((system "Linux") ; uname -s
(release "3.2.0") ; uname -r
;; uname -m
- (machine (match (or (%current-target-system)
- (%current-system))
+ (machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i686")
("mips64el-linux" "mips64")
@@ -603,8 +602,7 @@ (define-public nginx-accept-language-module
,(let ((system "Linux") ; uname -s
(release "3.2.0") ; uname -r
;; uname -m
- (machine (match (or (%current-target-system)
- (%current-system))
+ (machine (match (current-target-nix-system)
("x86_64-linux" "x86_64")
("i686-linux" "i686")
("mips64el-linux" "mips64")
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 5/6] gnu: Query membership in ‘supported-systems’ list with Nix ident ifier
(address . 49672@debbugs.gnu.org)
20220327214026.102723-6-bauermann@kolabnow.com
Packages’ ‘supported-systems’ list contains Nix system identifiers, while
‘%current-target-system’ contains a GNU triplet. We need to use
‘current-target-nix-system’ to query the list, which always returns a Nix
system identifier.

* gnu/packages/bootloaders.scm (grub)[inputs]: Use ‘current-target-nix-system’
to query membership in (package-supported-systems).
---
gnu/packages/bootloaders.scm | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)

Toggle diff (33 lines)
diff --git a/gnu/packages/bootloaders.scm b/gnu/packages/bootloaders.scm
index 40dd38fdd28a..98970450900e 100644
--- a/gnu/packages/bootloaders.scm
+++ b/gnu/packages/bootloaders.scm
@@ -185,16 +185,14 @@ (define-public grub
;; Depend on LVM2 for libdevmapper, used by 'grub-probe' and
;; 'grub-install' to recognize mapped devices (LUKS, etc.)
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems lvm2))
`(("lvm2" ,lvm2))
'())
;; Depend on mdadm, which is invoked by 'grub-probe' and 'grub-install'
;; to determine whether the root file system is RAID.
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems mdadm))
`(("mdadm" ,mdadm))
'())
@@ -205,8 +203,7 @@ (define-public grub
;; Needed for ‘grub-mount’, the only reliable way to tell whether a given
;; file system will be readable by GRUB without rebooting.
- ,@(if (member (or (%current-target-system)
- (%current-system))
+ ,@(if (member (current-target-nix-system)
(package-supported-systems fuse))
`(("fuse" ,fuse))
'())
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 6/6] gnu: Fix check of ‘%curr ent-system’ and ‘%current-target-system ’
(address . 49672@debbugs.gnu.org)
20220327214026.102723-7-bauermann@kolabnow.com
The order of the check is important because ‘%current-system’ is always
defined, while ‘%current-target-system’ is only defined when
cross-building.

Therefore, it’s important to check ‘%current-target-system’ first,
otherwise the cross target is never considered.

* gnu/packages/crypto.scm (libb2)[arguments]<#:configure-flags>: Check
‘%current-target-system’ first.
* gnu/packages/java.scm (jamvm-1-bootstrap)[arguments]<#:phases>: Likewise.
[native-inputs]: Likewise.
(ant-bootstrap)[arguments]<#:phases>: Likewise.
(classpath-jamvm-wrappers)[arguments]<#:builder>: Likewise.
* gnu/packages/photo.scm (lensfun)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/php.scm (php)[arguments]<#:phases>: Likewise.
* gnu/packages/sdl.scm (sdl-gfx)[arguments]<#:configure-flags>: Likewise.
* gnu/packages/telephony.scm (pjproject)[arguments]<#:configure-flags>: Likewise.
---
gnu/packages/crypto.scm | 4 ++--
gnu/packages/java.scm | 16 ++++++++--------
gnu/packages/photo.scm | 4 ++--
gnu/packages/php.scm | 4 ++--
gnu/packages/sdl.scm | 4 ++--
gnu/packages/telephony.scm | 4 ++--
6 files changed, 18 insertions(+), 18 deletions(-)

Toggle diff (123 lines)
diff --git a/gnu/packages/crypto.scm b/gnu/packages/crypto.scm
index 63be51f86a21..89694f111e17 100644
--- a/gnu/packages/crypto.scm
+++ b/gnu/packages/crypto.scm
@@ -826,8 +826,8 @@ (define-public libb2
(arguments
`(#:configure-flags
(list
- ,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ ,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; fat only checks for Intel optimisations
'("--enable-fat")
diff --git a/gnu/packages/java.scm b/gnu/packages/java.scm
index aead02d93c31..77f9f7e8fb86 100644
--- a/gnu/packages/java.scm
+++ b/gnu/packages/java.scm
@@ -207,8 +207,8 @@ (define jamvm-1-bootstrap
"--enable-runtime-reloc-checks"
"--enable-ffi")
#:phases
- ,(if (string-prefix? "aarch64" (or (%current-system)
- (%current-target-system)))
+ ,(if (string-prefix? "aarch64" (or (%current-target-system)
+ (%current-system)))
;; Makefiles and the configure script need to be regenerated to
;; incorporate support for AArch64.
'(modify-phases %standard-phases
@@ -218,8 +218,8 @@ (define jamvm-1-bootstrap
(inputs
(list classpath-bootstrap jikes libffi zip zlib))
(native-inputs
- (if (string-prefix? "aarch64" (or (%current-system)
- (%current-target-system)))
+ (if (string-prefix? "aarch64" (or (%current-target-system)
+ (%current-system)))
;; Additional packages needed for autoreconf.
`(("autoconf" ,autoconf)
("automake" ,automake)
@@ -285,8 +285,8 @@ (define ant-bootstrap
;; Without these JamVM options the build may freeze.
(substitute* "bootstrap.sh"
(("^\"\\$\\{JAVACMD\\}\" " m)
- ,@(if (string-prefix? "armhf" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "armhf" (or (%current-target-system)
+ (%current-system)))
`((string-append m "-Xnocompact "))
`((string-append m "-Xnocompact -Xnoinlining ")))))
@@ -535,8 +535,8 @@ (define classpath-jamvm-wrappers
(for-each (lambda (tool)
(with-output-to-file (string-append bin tool)
(lambda _
- #$@(if (string-prefix? "armhf" (or (%current-system)
- (%current-target-system)))
+ #$@(if (string-prefix? "armhf" (or (%current-target-system)
+ (%current-system)))
`((format #t "#!~a/bin/sh
~a/bin/jamvm -Xnocompact -classpath ~a/share/classpath/tools.zip \
gnu.classpath.tools.~a.~a $@"
diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm
index 2f561abc2f31..eaa905dd3b8c 100644
--- a/gnu/packages/photo.scm
+++ b/gnu/packages/photo.scm
@@ -426,8 +426,8 @@ (define-public lensfun
"0cfk8jjhs9nbfjfdy98plrj9ayi59aph0nx6ppslgjhlcvacm2xf"))))
(build-system cmake-build-system)
(arguments
- `(,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ `(,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; SSE and SSE2 are supported only on Intel processors.
'()
diff --git a/gnu/packages/php.scm b/gnu/packages/php.scm
index 191dcafb4ae4..e2489d2435a6 100644
--- a/gnu/packages/php.scm
+++ b/gnu/packages/php.scm
@@ -177,8 +177,8 @@ (define-public php
(substitute* "ext/standard/tests/streams/bug60602.phpt"
(("'ls'") (string-append "'" (which "ls") "'")))
- ,@(if (string-prefix? "arm" (or (%current-system)
- (%current-target-system)))
+ ,@(if (string-prefix? "arm" (or (%current-target-system)
+ (%current-system)))
;; Drop tests known to fail on armhf.
'((for-each delete-file
(list
diff --git a/gnu/packages/sdl.scm b/gnu/packages/sdl.scm
index 4c38e2f05507..a5892934d824 100644
--- a/gnu/packages/sdl.scm
+++ b/gnu/packages/sdl.scm
@@ -198,8 +198,8 @@ (define-public sdl-gfx
(build-system gnu-build-system)
(outputs '("out" "debug"))
(arguments
- `(,@(if (any (cute string-prefix? <> (or (%current-system)
- (%current-target-system)))
+ `(,@(if (any (cute string-prefix? <> (or (%current-target-system)
+ (%current-system)))
'("x86_64" "i686"))
;; mmx is supported only on Intel processors.
'()
diff --git a/gnu/packages/telephony.scm b/gnu/packages/telephony.scm
index e3071d9b75a7..c694a906f1d0 100644
--- a/gnu/packages/telephony.scm
+++ b/gnu/packages/telephony.scm
@@ -755,8 +755,8 @@ (define-public pjproject
"--with-external-srtp"
"--with-external-pa"
;; The following flag is Linux specific.
- ,@(if (string-contains (or (%current-system)
- (%current-target-system)) "linux")
+ ,@(if (string-contains (or (%current-target-system)
+ (%current-system)) "linux")
'("--enable-epoll")
'())
"--with-gnutls" ;disable OpenSSL checks
T
T
Thiago Jung Bauermann wrote on 27 Mar 2022 23:40
[PATCH v2 3/6] utils: Introduce the ‘curr ent-target-nix-system’ procedure
(address . 49672@debbugs.gnu.org)
20220327214026.102723-4-bauermann@kolabnow.com
Both ‘glibc-dynamic-linker’ and ‘system->llvm-target’ use the same logic
for the default value of their arguments, so factor it out into a separate
procedure.

It turns out that this procedure will be useful in other places as well.

* gnu/packages/bootstrap.scm (glibc-dynamic-linker): Use result of
‘current-target-nix-system’ as default value for ‘system’ argument.
* gnu/packages/llvm.scm (system->llvm-target): Likewise.
* guix/utils.scm (current-target-nix-system): Define.
---
gnu/packages/bootstrap.scm | 4 +---
gnu/packages/llvm.scm | 4 +---
guix/utils.scm | 7 +++++++
3 files changed, 9 insertions(+), 6 deletions(-)

Toggle diff (55 lines)
diff --git a/gnu/packages/bootstrap.scm b/gnu/packages/bootstrap.scm
index 8bd0c4eaf3ab..8f444b1ff338 100644
--- a/gnu/packages/bootstrap.scm
+++ b/gnu/packages/bootstrap.scm
@@ -309,9 +309,7 @@ (define rewritten-input
package-with-bootstrap-guile)))))
(define* (glibc-dynamic-linker
- #:optional (system (or (and=> (%current-target-system)
- gnu-triplet->nix-system)
- (%current-system))))
+ #:optional (system (current-target-nix-system)))
"Return the name of Glibc's dynamic linker for SYSTEM."
;; See the 'SYSDEP_KNOWN_INTERPRETER_NAMES' cpp macro in libc.
(cond ((string=? system "x86_64-linux") "/lib/ld-linux-x86-64.so.2")
diff --git a/gnu/packages/llvm.scm b/gnu/packages/llvm.scm
index eb949bed1b47..e2bc5398715a 100644
--- a/gnu/packages/llvm.scm
+++ b/gnu/packages/llvm.scm
@@ -77,9 +77,7 @@ (define-module (gnu packages llvm)
system->llvm-target))
(define* (system->llvm-target #:optional
- (system (or (and=> (%current-target-system)
- gnu-triplet->nix-system)
- (%current-system))))
+ (system (current-target-nix-system)))
"Return the LLVM target name that corresponds to SYSTEM, a system type such
as \"x86_64-linux\"."
;; See the 'lib/Target' directory of LLVM for a list of supported targets.
diff --git a/guix/utils.scm b/guix/utils.scm
index 44c46cb4a96c..d5e15581acea 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -85,6 +85,7 @@ (define-module (guix utils)
gnu-triplet->nix-system
%current-system
%current-target-system
+ current-target-nix-system
package-name->name+version
target-linux?
target-hurd?
@@ -635,6 +636,12 @@ (define %current-target-system
;; cross-building to.
(make-parameter #f))
+(define (current-target-nix-system)
+ "Return the Nix system identifier for the current target, whether we are
+cross-building or not."
+ (or (and=> (%current-target-system) gnu-triplet->nix-system)
+ (%current-system)))
+
(define* (package-name->name+version spec
#:optional (delimiter #\@))
"Given SPEC, a package name like \"foo@0.9.1b\", return two values: \"foo\"
M
M
Maxime Devos wrote on 28 Mar 2022 14:10
Re: [PATCH v2 0/6] Target check fixes for cross compilation
3176f7feadf478c55a68f76d69bc003ed22c857f.camel@telenet.be
user guix
usertag 49672 reviewed looks-good
quit

Thiago Jung Bauermann schreef op zo 27-03-2022 om 18:40 [-0300]:
Toggle quote (15 lines)
> Hello,
>
> I've been working on and off on this fixes and cleanups series for a long
> time now, but it became a bit unwieldy and overwhelming so in the interest
> of shipping something I decided to split the fixes from the cleanups. This
> way I can at least submit the former, and leave the latter for an
> unspecified, uncertain future.
>
> I tested that on x86_64-linux the build derivations of all packages modified
> by these packages are unchanged. They only affect (for the better!) cross
> builds. This means that this patch series can go to master.
>
> I don't mind rebasing it if by the time the series is approved, it doesn't
> cleanly apply anymore.

These patches LGTM (untested, only read them).

Greetings,
Maxime.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYkGlxhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7ingAQDeGaoURQ1BPvKcsnfK3BcUt5z2
oWLaPfJtDexPgEY2nQD+KC47Mi7LRcvLqLvJFWzpGVfMNQAqsZjGbVu0r/xPiww=
=Aftu
-----END PGP SIGNATURE-----


T
T
Thiago Jung Bauermann wrote on 29 Mar 2022 02:12
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 49672@debbugs.gnu.org)
34469868.pztx5feHR1@popigai
Hello Maxim,

Em segunda-feira, 28 de março de 2022, às 09:10:46 -03, Maxime Devos
escreveu:
Toggle quote (4 lines)
> user guix
> usertag 49672 reviewed looks-good
> quit

Ah, good to know how to use this tag. :-)

Toggle quote (17 lines)
> Thiago Jung Bauermann schreef op zo 27-03-2022 om 18:40 [-0300]:
> > I've been working on and off on this fixes and cleanups series for a
> > long time now, but it became a bit unwieldy and overwhelming so in the
> > interest of shipping something I decided to split the fixes from the
> > cleanups. This way I can at least submit the former, and leave the
> > latter for an unspecified, uncertain future.
> >
> > I tested that on x86_64-linux the build derivations of all packages
> > modified by these packages are unchanged. They only affect (for the
> > better!) cross builds. This means that this patch series can go to
> > master.
> >
> > I don't mind rebasing it if by the time the series is approved, it
> > doesn't cleanly apply anymore.
>
> These patches LGTM (untested, only read them).

That was quick! Thank you very much for your review!

--
Thanks,
Thiago
T
T
Thiago Jung Bauermann wrote on 29 Apr 2022 06:17
(address . 49672@debbugs.gnu.org)
874k2cwmiv.fsf@kolabnow.com
Thiago Jung Bauermann <bauermann@kolabnow.com> writes:

Toggle quote (7 lines)
> I tested that on x86_64-linux the build derivations of all packages modified
> by these packages are unchanged. They only affect (for the better!) cross
> builds. This means that this patch series can go to master.
>
> I don't mind rebasing it if by the time the series is approved, it doesn't
> cleanly apply anymore.

Ping.

--
Thanks
Thiago
?