mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 21:38:07 -05:00
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.
This commit is contained in:
parent
4cf7d0f836
commit
b55310603f
6 changed files with 44 additions and 45 deletions
|
@ -40276,20 +40276,22 @@ one:
|
||||||
guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs
|
guix build --target=armv5tel-linux-gnueabi bootstrap-tarballs
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
For this to work, the @code{glibc-dynamic-linker} procedure in
|
For this to work, it is first required to register a new platform as
|
||||||
@code{(gnu packages bootstrap)} must be augmented to return the right
|
defined in the @code{(gnu platform)} module. A platform is making the
|
||||||
file name for libc's dynamic linker on that platform; likewise,
|
connection between a GNU triplet (@pxref{Specifying Target Triplets, GNU
|
||||||
@code{system->linux-architecture} in @code{(gnu packages linux)} must be
|
configuration triplets,, autoconf, Autoconf}), the equivalent
|
||||||
taught about the new platform.
|
@var{system} in Nix notation, the name of the
|
||||||
|
@var{glibc-dynamic-linker}, and the corresponding Linux architecture
|
||||||
|
name if applicable.
|
||||||
|
|
||||||
Once these are built, the @code{(gnu packages bootstrap)} module needs
|
Once the bootstrap tarball are built, the @code{(gnu packages
|
||||||
to be updated to refer to these binaries on the target platform. That
|
bootstrap)} module needs to be updated to refer to these binaries on the
|
||||||
is, the hashes and URLs of the bootstrap tarballs for the new platform
|
target platform. That is, the hashes and URLs of the bootstrap tarballs
|
||||||
must be added alongside those of the currently supported platforms. The
|
for the new platform must be added alongside those of the currently
|
||||||
bootstrap Guile tarball is treated specially: it is expected to be
|
supported platforms. The bootstrap Guile tarball is treated specially:
|
||||||
available locally, and @file{gnu/local.mk} has rules to download it for
|
it is expected to be available locally, and @file{gnu/local.mk} has
|
||||||
the supported architectures; a rule for the new platform must be added
|
rules to download it for the supported architectures; a rule for the new
|
||||||
as well.
|
platform must be added as well.
|
||||||
|
|
||||||
In practice, there may be some complications. First, it may be that the
|
In practice, there may be some complications. First, it may be that the
|
||||||
extended GNU triplet that specifies an ABI (like the @code{eabi} suffix
|
extended GNU triplet that specifies an ABI (like the @code{eabi} suffix
|
||||||
|
|
|
@ -161,6 +161,7 @@ (define-module (gnu packages bioinformatics)
|
||||||
#:use-module (gnu packages wget)
|
#:use-module (gnu packages wget)
|
||||||
#:use-module (gnu packages xml)
|
#:use-module (gnu packages xml)
|
||||||
#:use-module (gnu packages xorg)
|
#:use-module (gnu packages xorg)
|
||||||
|
#:use-module (gnu platform)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:use-module (ice-9 match))
|
#:use-module (ice-9 match))
|
||||||
|
@ -6576,10 +6577,12 @@ (define-public ncbi-vdb
|
||||||
;; architecture name ("i386") instead of the target system prefix
|
;; architecture name ("i386") instead of the target system prefix
|
||||||
;; ("i686").
|
;; ("i686").
|
||||||
(mkdir (string-append (assoc-ref outputs "out") "/ilib"))
|
(mkdir (string-append (assoc-ref outputs "out") "/ilib"))
|
||||||
(copy-recursively (string-append "build/ncbi-vdb/linux/gcc/"
|
(copy-recursively (string-append
|
||||||
,(system->linux-architecture
|
"build/ncbi-vdb/linux/gcc/"
|
||||||
(or (%current-target-system)
|
,(platform-linux-architecture
|
||||||
(%current-system)))
|
(lookup-platform-by-target-or-system
|
||||||
|
(or (%current-target-system)
|
||||||
|
(%current-system))))
|
||||||
"/rel/ilib")
|
"/rel/ilib")
|
||||||
(string-append (assoc-ref outputs "out")
|
(string-append (assoc-ref outputs "out")
|
||||||
"/ilib"))
|
"/ilib"))
|
||||||
|
|
|
@ -30,6 +30,7 @@ (define-module (gnu packages cross-base)
|
||||||
#:use-module (gnu packages linux)
|
#:use-module (gnu packages linux)
|
||||||
#:use-module (gnu packages hurd)
|
#:use-module (gnu packages hurd)
|
||||||
#:use-module (gnu packages mingw)
|
#:use-module (gnu packages mingw)
|
||||||
|
#:use-module (gnu platform)
|
||||||
#:use-module (guix packages)
|
#:use-module (guix packages)
|
||||||
#:use-module (guix download)
|
#:use-module (guix download)
|
||||||
#:use-module (guix utils)
|
#:use-module (guix utils)
|
||||||
|
@ -345,7 +346,8 @@ (define xlinux-headers
|
||||||
`(modify-phases ,phases
|
`(modify-phases ,phases
|
||||||
(replace 'build
|
(replace 'build
|
||||||
(lambda _
|
(lambda _
|
||||||
(setenv "ARCH" ,(system->linux-architecture target))
|
(setenv "ARCH" ,(platform-linux-architecture
|
||||||
|
(lookup-platform-by-target target)))
|
||||||
(format #t "`ARCH' set to `~a' (cross compiling)~%"
|
(format #t "`ARCH' set to `~a' (cross compiling)~%"
|
||||||
(getenv "ARCH"))
|
(getenv "ARCH"))
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@ (define-module (gnu packages instrumentation)
|
||||||
#:use-module (gnu packages swig)
|
#:use-module (gnu packages swig)
|
||||||
#:use-module (gnu packages tbb)
|
#:use-module (gnu packages tbb)
|
||||||
#:use-module (gnu packages xml)
|
#:use-module (gnu packages xml)
|
||||||
|
#:use-module (gnu platform)
|
||||||
#:use-module (guix build-system cmake)
|
#:use-module (guix build-system cmake)
|
||||||
#:use-module (guix build-system copy)
|
#:use-module (guix build-system copy)
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
|
@ -312,9 +313,10 @@ (define-public uftrace
|
||||||
(modify-phases %standard-phases
|
(modify-phases %standard-phases
|
||||||
(replace 'configure
|
(replace 'configure
|
||||||
(lambda* (#:key outputs target #:allow-other-keys)
|
(lambda* (#:key outputs target #:allow-other-keys)
|
||||||
(let ((arch ,(system->linux-architecture
|
(let ((arch ,(platform-linux-architecture
|
||||||
(or (%current-target-system)
|
(lookup-platform-by-target-or-system
|
||||||
(%current-system)))))
|
(or (%current-target-system)
|
||||||
|
(%current-system))))))
|
||||||
(setenv "ARCH"
|
(setenv "ARCH"
|
||||||
(cond
|
(cond
|
||||||
((string=? arch "arm64") "aarch64")
|
((string=? arch "arm64") "aarch64")
|
||||||
|
|
|
@ -158,6 +158,7 @@ (define-module (gnu packages linux)
|
||||||
#:use-module (gnu packages groff)
|
#:use-module (gnu packages groff)
|
||||||
#:use-module (gnu packages selinux)
|
#:use-module (gnu packages selinux)
|
||||||
#:use-module (gnu packages swig)
|
#:use-module (gnu packages swig)
|
||||||
|
#:use-module (gnu platform)
|
||||||
#:use-module (guix build-system cmake)
|
#:use-module (guix build-system cmake)
|
||||||
#:use-module (guix build-system copy)
|
#:use-module (guix build-system copy)
|
||||||
#:use-module (guix build-system gnu)
|
#:use-module (guix build-system gnu)
|
||||||
|
@ -181,20 +182,6 @@ (define-module (gnu packages linux)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (ice-9 regex))
|
#:use-module (ice-9 regex))
|
||||||
|
|
||||||
(define-public (system->linux-architecture arch)
|
|
||||||
"Return the Linux architecture name for ARCH, a Guix system name such as
|
|
||||||
\"x86_64-linux\" or a target triplet such as \"arm-linux-gnueabihf\"."
|
|
||||||
(let ((arch (car (string-split arch #\-))))
|
|
||||||
(cond ((string=? arch "i686") "i386")
|
|
||||||
((string-prefix? "mips" arch) "mips")
|
|
||||||
((string-prefix? "arm" arch) "arm")
|
|
||||||
((string-prefix? "aarch64" arch) "arm64")
|
|
||||||
((string-prefix? "alpha" arch) "alpha")
|
|
||||||
((string-prefix? "powerpc" arch) "powerpc") ;including "powerpc64le"
|
|
||||||
((string-prefix? "s390" arch) "s390")
|
|
||||||
((string-prefix? "riscv" arch) "riscv")
|
|
||||||
(else arch))))
|
|
||||||
|
|
||||||
(define-public (system->defconfig system)
|
(define-public (system->defconfig system)
|
||||||
"Some systems (notably powerpc-linux) require a special target for kernel
|
"Some systems (notably powerpc-linux) require a special target for kernel
|
||||||
defconfig. Return the appropriate make target if applicable, otherwise return
|
defconfig. Return the appropriate make target if applicable, otherwise return
|
||||||
|
@ -567,9 +554,10 @@ (define (make-linux-libre-headers* version gnu-revision source)
|
||||||
(delete 'configure)
|
(delete 'configure)
|
||||||
(replace 'build
|
(replace 'build
|
||||||
(lambda _
|
(lambda _
|
||||||
(let ((arch ,(system->linux-architecture
|
(let ((arch ,(platform-linux-architecture
|
||||||
(or (%current-target-system)
|
(lookup-platform-by-target-or-system
|
||||||
(%current-system))))
|
(or (%current-target-system)
|
||||||
|
(%current-system)))))
|
||||||
(defconfig ,(system->defconfig
|
(defconfig ,(system->defconfig
|
||||||
(or (%current-target-system)
|
(or (%current-target-system)
|
||||||
(%current-system))))
|
(%current-system))))
|
||||||
|
@ -807,8 +795,9 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
|
||||||
|
|
||||||
,@(match (and configuration-file
|
,@(match (and configuration-file
|
||||||
(configuration-file
|
(configuration-file
|
||||||
(system->linux-architecture
|
(platform-linux-architecture
|
||||||
(or (%current-target-system) (%current-system)))
|
(lookup-platform-by-target-or-system
|
||||||
|
(or (%current-target-system) (%current-system))))
|
||||||
#:variant (version-major+minor version)))
|
#:variant (version-major+minor version)))
|
||||||
(#f ;no config for this platform
|
(#f ;no config for this platform
|
||||||
'())
|
'())
|
||||||
|
@ -839,9 +828,10 @@ (define* (make-linux-libre* version gnu-revision source supported-systems
|
||||||
(setenv "KBUILD_BUILD_HOST" "guix")
|
(setenv "KBUILD_BUILD_HOST" "guix")
|
||||||
|
|
||||||
;; Set ARCH and CROSS_COMPILE.
|
;; Set ARCH and CROSS_COMPILE.
|
||||||
(let ((arch #$(system->linux-architecture
|
(let ((arch #$(platform-linux-architecture
|
||||||
(or (%current-target-system)
|
(lookup-platform-by-target-or-system
|
||||||
(%current-system)))))
|
(or (%current-target-system)
|
||||||
|
(%current-system))))))
|
||||||
(setenv "ARCH" arch)
|
(setenv "ARCH" arch)
|
||||||
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
|
(format #t "`ARCH' set to `~a'~%" (getenv "ARCH"))
|
||||||
|
|
||||||
|
|
|
@ -50,8 +50,8 @@ (define (default-linux)
|
||||||
(module-ref module 'linux-libre)))
|
(module-ref module 'linux-libre)))
|
||||||
|
|
||||||
(define (system->arch system)
|
(define (system->arch system)
|
||||||
(let ((module (resolve-interface '(gnu packages linux))))
|
(let ((module (resolve-interface '(gnu platform))))
|
||||||
((module-ref module 'system->linux-architecture) system)))
|
((module-ref module 'lookup-platform-by-target-or-system) system)))
|
||||||
|
|
||||||
(define (make-linux-module-builder linux)
|
(define (make-linux-module-builder linux)
|
||||||
(package
|
(package
|
||||||
|
|
Loading…
Reference in a new issue