diff options
author | Mathieu Othacehe <othacehe@gnu.org> | 2022-05-07 16:45:40 +0200 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2022-05-22 15:15:33 +0200 |
commit | b55310603f0df7d5ae02d47cb8d4be58bf1d41ca (patch) | |
tree | fae12dd0399909cb09b3162934f198803f4a19cc | |
parent | platform: Add glibc-dynamic-linker field. (diff) | |
download | guix-b55310603f0df7d5ae02d47cb8d4be58bf1d41ca.tar.gz guix-b55310603f0df7d5ae02d47cb8d4be58bf1d41ca.tar.bz2 guix-b55310603f0df7d5ae02d47cb8d4be58bf1d41ca.tar.xz |
linux: Remove system->linux-architecture procedure.
* gnu/packages/linux.scm (system->linux-architecture): Remove it.
(make-linux-libre-headers*, make-linux-libre*): Adapt them.
* guix/build-system/linux-module.scm (system->arch): Adapt it.
* gnu/packages/instrumentation.scm (uftrace): Ditto.
* gnu/packages/cross-base.scm (cross-kernel-headers): Ditto.
* gnu/packages/bioinformatics.scm (ncbi-vdb): Ditto.
* doc/guix.texi (Porting to a new platform): Update it.
-rw-r--r-- | doc/guix.texi | 30 | ||||
-rw-r--r-- | gnu/packages/bioinformatics.scm | 11 | ||||
-rw-r--r-- | gnu/packages/cross-base.scm | 4 | ||||
-rw-r--r-- | gnu/packages/instrumentation.scm | 8 | ||||
-rw-r--r-- | gnu/packages/linux.scm | 34 | ||||
-rw-r--r-- | guix/build-system/linux-module.scm | 4 |
6 files changed, 45 insertions, 46 deletions
diff --git a/doc/guix.texi b/doc/guix.texi index 761fceb9c3..df9cbf4851 100644 --- a/doc/guix.texi +++ b/doc/guix.texi | |||
@@ -40276,20 +40276,22 @@ one: | |||
40276 | guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs | 40276 | guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs |
40277 | @end example | 40277 | @end example |
40278 | 40278 | ||
40279 | For this to work, the @code{glibc-dynamic-linker} procedure in | 40279 | For this to work, it is first required to register a new platform as |
40280 | @code{(gnu packages bootstrap)} must be augmented to return the right | 40280 | defined in the @code{(gnu platform)} module. A platform is making the |
40281 | file name for libc's dynamic linker on that platform; likewise, | 40281 | connection between a GNU triplet (@pxref{Specifying Target Triplets, GNU |
40282 | @code{system->linux-architecture} in @code{(gnu packages linux)} must be | 40282 | configuration triplets,, autoconf, Autoconf}), the equivalent |
40283 | taught about the new platform. | 40283 | @var{system} in Nix notation, the name of the |
40284 | 40284 | @var{glibc-dynamic-linker}, and the corresponding Linux architecture | |
40285 | Once these are built, the @code{(gnu packages bootstrap)} module needs | 40285 | name if applicable. |
40286 | to be updated to refer to these binaries on the target platform. That | 40286 | |
40287 | is, the hashes and URLs of the bootstrap tarballs for the new platform | 40287 | Once the bootstrap tarball are built, the @code{(gnu packages |
40288 | must be added alongside those of the currently supported platforms. The | 40288 | bootstrap)} module needs to be updated to refer to these binaries on the |
40289 | bootstrap Guile tarball is treated specially: it is expected to be | 40289 | target platform. That is, the hashes and URLs of the bootstrap tarballs |
40290 | available locally, and @file{gnu/local.mk} has rules to download it for | 40290 | for the new platform must be added alongside those of the currently |
40291 | the supported architectures; a rule for the new platform must be added | 40291 | supported platforms. The bootstrap Guile tarball is treated specially: |
40292 | as well. | 40292 | it is expected to be available locally, and @file{gnu/local.mk} has |
40293 | rules to download it for the supported architectures; a rule for the new | ||
40294 | platform must be added as well. | ||
40293 | 40295 | ||
40294 | In practice, there may be some complications. First, it may be that the | 40296 | In practice, there may be some complications. First, it may be that the |
40295 | extended GNU triplet that specifies an ABI (like the @code{eabi} suffix | 40297 | extended GNU triplet that specifies an ABI (like the @code{eabi} suffix |
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm index 33bf0921d1..2a312b1989 100644 --- a/gnu/packages/bioinformatics.scm +++ b/gnu/packages/bioinformatics.scm | |||
@@ -161,6 +161,7 @@ | |||
161 | #:use-module (gnu packages wget) | 161 | #:use-module (gnu packages wget) |
162 | #:use-module (gnu packages xml) | 162 | #:use-module (gnu packages xml) |
163 | #:use-module (gnu packages xorg) | 163 | #:use-module (gnu packages xorg) |
164 | #:use-module (gnu platform) | ||
164 | #:use-module (srfi srfi-1) | 165 | #:use-module (srfi srfi-1) |
165 | #:use-module (srfi srfi-26) | 166 | #:use-module (srfi srfi-26) |
166 | #:use-module (ice-9 match)) | 167 | #:use-module (ice-9 match)) |
@@ -6576,10 +6577,12 @@ simultaneously.") | |||
6576 | ;; architecture name ("i386") instead of the target system prefix | 6577 | ;; architecture name ("i386") instead of the target system prefix |
6577 | ;; ("i686"). | 6578 | ;; ("i686"). |
6578 | (mkdir (string-append (assoc-ref outputs "out") "/ilib")) | 6579 | (mkdir (string-append (assoc-ref outputs "out") "/ilib")) |
6579 | (copy-recursively (string-append "build/ncbi-vdb/linux/gcc/" | 6580 | (copy-recursively (string-append |
6580 | ,(system->linux-architecture | 6581 | "build/ncbi-vdb/linux/gcc/" |
6581 | (or (%current-target-system) | 6582 | ,(platform-linux-architecture |
6582 | (%current-system))) | 6583 | (lookup-platform-by-target-or-system |
6584 | (or (%current-target-system) | ||
6585 | (%current-system)))) | ||
6583 | "/rel/ilib") | 6586 | "/rel/ilib") |
6584 | (string-append (assoc-ref outputs "out") | 6587 | (string-append (assoc-ref outputs "out") |
6585 | "/ilib")) | 6588 | "/ilib")) |
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm index 66412b9e92..427fefbcd2 100644 --- a/gnu/packages/cross-base.scm +++ b/gnu/packages/cross-base.scm | |||
@@ -30,6 +30,7 @@ | |||
30 | #:use-module (gnu packages linux) | 30 | #:use-module (gnu packages linux) |
31 | #:use-module (gnu packages hurd) | 31 | #:use-module (gnu packages hurd) |
32 | #:use-module (gnu packages mingw) | 32 | #:use-module (gnu packages mingw) |
33 | #:use-module (gnu platform) | ||
33 | #:use-module (guix packages) | 34 | #:use-module (guix packages) |
34 | #:use-module (guix download) | 35 | #:use-module (guix download) |
35 | #:use-module (guix utils) | 36 | #:use-module (guix utils) |
@@ -345,7 +346,8 @@ target that libc." | |||
345 | `(modify-phases ,phases | 346 | `(modify-phases ,phases |
346 | (replace 'build | 347 | (replace 'build |
347 | (lambda _ | 348 | (lambda _ |
348 | (setenv "ARCH" ,(system->linux-architecture target)) | 349 | (setenv "ARCH" ,(platform-linux-architecture |
350 | (lookup-platform-by-target target))) | ||
349 | (format #t "`ARCH' set to `~a' (cross compiling)~%" | 351 | (format #t "`ARCH' set to `~a' (cross compiling)~%" |
350 | (getenv "ARCH")) | 352 | (getenv "ARCH")) |
351 | 353 | ||
diff --git a/gnu/packages/instrumentation.scm b/gnu/packages/instrumentation.scm index c9ca9083e4..c5062388f8 100644 --- a/gnu/packages/instrumentation.scm +++ b/gnu/packages/instrumentation.scm | |||
@@ -42,6 +42,7 @@ | |||
42 | #:use-module (gnu packages swig) | 42 | #:use-module (gnu packages swig) |
43 | #:use-module (gnu packages tbb) | 43 | #:use-module (gnu packages tbb) |
44 | #:use-module (gnu packages xml) | 44 | #:use-module (gnu packages xml) |
45 | #:use-module (gnu platform) | ||
45 | #:use-module (guix build-system cmake) | 46 | #:use-module (guix build-system cmake) |
46 | #:use-module (guix build-system copy) | 47 | #:use-module (guix build-system copy) |
47 | #:use-module (guix build-system gnu) | 48 | #:use-module (guix build-system gnu) |
@@ -312,9 +313,10 @@ line for tracing control, a @code{lttng-ctl} library for tracing control and a | |||
312 | (modify-phases %standard-phases | 313 | (modify-phases %standard-phases |
313 | (replace 'configure | 314 | (replace 'configure |
314 | (lambda* (#:key outputs target #:allow-other-keys) | 315 | (lambda* (#:key outputs target #:allow-other-keys) |
315 | (let ((arch ,(system->linux-architecture | 316 | (let ((arch ,(platform-linux-architecture |
316 | (or (%current-target-system) | 317 | (lookup-platform-by-target-or-system |
317 | (%current-system))))) | 318 | (or (%current-target-system) |
319 | (%current-system)))))) | ||
318 | (setenv "ARCH" | 320 | (setenv "ARCH" |
319 | (cond | 321 | (cond |
320 | ((string=? arch "arm64") "aarch64") | 322 | ((string=? arch "arm64") "aarch64") |
diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 7b564e7ef1..4101d4897b 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm | |||
@@ -158,6 +158,7 @@ | |||
158 | #:use-module (gnu packages groff) | 158 | #:use-module (gnu packages groff) |
159 | #:use-module (gnu packages selinux) | 159 | #:use-module (gnu packages selinux) |
160 | #:use-module (gnu packages swig) | 160 | #:use-module (gnu packages swig) |
161 | #:use-module (gnu platform) | ||
161 | #:use-module (guix build-system cmake) | 162 | #:use-module (guix build-system cmake) |
162 | #:use-module (guix build-system copy) | 163 | #:use-module (guix build-system copy) |
163 | #:use-module (guix build-system gnu) | 164 | #:use-module (guix build-system gnu) |
@@ -181,20 +182,6 @@ | |||
181 | #:use-module (ice-9 match) | 182 | #:use-module (ice-9 match) |
182 | #:use-module (ice-9 regex)) | 183 | #:use-module (ice-9 regex)) |
183 | 184 | ||
184 | (define-public (system->linux-architecture arch) | ||
185 | "Return the Linux architecture name for ARCH, a Guix system name such as | ||
186 | \"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"." | ||
187 | (let ((arch (car (string-split arch #\-)))) | ||
188 | (cond ((string=? arch "i686") "i386") | ||
189 | ((string-prefix? "mips" arch) "mips") | ||
190 | ((string-prefix? "arm" arch) "arm") | ||
191 | ((string-prefix? "aarch64" arch) "arm64") | ||
192 | ((string-prefix? "alpha" arch) "alpha") | ||
193 | ((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le" | ||
194 | ((string-prefix? "s390" arch) "s390") | ||
195 | ((string-prefix? "riscv" arch) "riscv") | ||
196 | (else arch)))) | ||
197 | |||
198 | (define-public (system->defconfig system) | 185 | (define-public (system->defconfig system) |
199 | "Some systems (notably powerpc-linux) require a special target for kernel | 186 | "Some systems (notably powerpc-linux) require a special target for kernel |
200 | defconfig. Return the appropriate make target if applicable, otherwise return | 187 | defconfig. Return the appropriate make target if applicable, otherwise return |
@@ -567,9 +554,10 @@ corresponding UPSTREAM-SOURCE (an origin), using the given DEBLOB-SCRIPTS." | |||
567 | (delete 'configure) | 554 | (delete 'configure) |
568 | (replace 'build | 555 | (replace 'build |
569 | (lambda _ | 556 | (lambda _ |
570 | (let ((arch ,(system->linux-architecture | 557 | (let ((arch ,(platform-linux-architecture |
571 | (or (%current-target-system) | 558 | (lookup-platform-by-target-or-system |
572 | (%current-system)))) | 559 | (or (%current-target-system) |
560 | (%current-system))))) | ||
573 | (defconfig ,(system->defconfig | 561 | (defconfig ,(system->defconfig |
574 | (or (%current-target-system) | 562 | (or (%current-target-system) |
575 | (%current-system)))) | 563 | (%current-system)))) |
@@ -807,8 +795,9 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." | |||
807 | 795 | ||
808 | ,@(match (and configuration-file | 796 | ,@(match (and configuration-file |
809 | (configuration-file | 797 | (configuration-file |
810 | (system->linux-architecture | 798 | (platform-linux-architecture |
811 | (or (%current-target-system) (%current-system))) | 799 | (lookup-platform-by-target-or-system |
800 | (or (%current-target-system) (%current-system)))) | ||
812 | #:variant (version-major+minor version))) | 801 | #:variant (version-major+minor version))) |
813 | (#f ;no config for this platform | 802 | (#f ;no config for this platform |
814 | '()) | 803 | '()) |
@@ -839,9 +828,10 @@ for ARCH and optionally VARIANT, or #f if there is no such configuration." | |||
839 | (setenv "KBUILD_BUILD_HOST" "guix") | 828 | (setenv "KBUILD_BUILD_HOST" "guix") |
840 | 829 | ||
841 | ;; Set ARCH and CROSS_COMPILE. | 830 | ;; Set ARCH and CROSS_COMPILE. |
842 | (let ((arch #$(system->linux-architecture | 831 | (let ((arch #$(platform-linux-architecture |
843 | (or (%current-target-system) | 832 | (lookup-platform-by-target-or-system |
844 | (%current-system))))) | 833 | (or (%current-target-system) |
834 | (%current-system)))))) | ||
845 | (setenv "ARCH" arch) | 835 | (setenv "ARCH" arch) |
846 | (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) | 836 | (format #t "`ARCH' set to `~a'~%" (getenv "ARCH")) |
847 | 837 | ||
diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm index e82a9ca65c..761ebe25b1 100644 --- a/guix/build-system/linux-module.scm +++ b/guix/build-system/linux-module.scm | |||
@@ -50,8 +50,8 @@ | |||
50 | (module-ref module 'linux-libre))) | 50 | (module-ref module 'linux-libre))) |
51 | 51 | ||
52 | (define (system->arch system) | 52 | (define (system->arch system) |
53 | (let ((module (resolve-interface '(gnu packages linux)))) | 53 | (let ((module (resolve-interface '(gnu platform)))) |
54 | ((module-ref module 'system->linux-architecture) system))) | 54 | ((module-ref module 'lookup-platform-by-target-or-system) system))) |
55 | 55 | ||
56 | (define (make-linux-module-builder linux) | 56 | (define (make-linux-module-builder linux) |
57 | (package | 57 | (package |