aboutsummaryrefslogtreecommitdiff
path: root/gnu/build
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/build')
-rw-r--r--gnu/build/cross-toolchain.scm41
-rw-r--r--gnu/build/icecat-extension.scm1
-rw-r--r--gnu/build/linux-boot.scm8
3 files changed, 43 insertions, 7 deletions
diff --git a/gnu/build/cross-toolchain.scm b/gnu/build/cross-toolchain.scm
index 9746be3e50..da9016488f 100644
--- a/gnu/build/cross-toolchain.scm
+++ b/gnu/build/cross-toolchain.scm
@@ -48,6 +48,12 @@
;; Search path for target headers when cross-compiling.
(map (cut string-append "CROSS_" <>) %gcc-include-paths))
+(define* (patch-genmultilib-shebang #:key inputs native-inputs #:allow-other-keys)
+ "Patch-shebang in the gcc/genmultilib file doesn't work as it contains several
+scripts inside, each with a #!/bin/sh that needs patching."
+ (substitute* "gcc/genmultilib"
+ (("#!/bin/sh") (string-append "#!" (which "sh")))))
+
(define* (make-cross-binutils-visible #:key outputs inputs target
#:allow-other-keys)
"Create symlinks for 'as', 'nm', and 'ld' in the \"out\" output, under
@@ -162,6 +168,31 @@ C_*INCLUDE_PATH."
(cons "LIBRARY_PATH" %gcc-include-paths))
#t))
+(define* (set-cross-path/avr #:key inputs #:allow-other-keys)
+ (match (assoc-ref inputs "libc")
+ ((? string? libc)
+ (define (cross? x)
+ ;; Return #t if X is a cross-libc.
+ (string-prefix? libc x))
+
+ (let ((cpath (string-append libc "/avr/include")))
+ (for-each (cut setenv <> cpath)
+ %gcc-cross-include-paths))
+
+ (setenv "CROSS_LIBRARY_PATH"
+ (string-append libc "/avr/lib"))
+
+ (for-each (lambda (var)
+ (and=> (getenv var)
+ (lambda (value)
+ (let* ((path (search-path-as-string->list value))
+ (native-path (list->search-path-as-string
+ (remove cross? path) ":")))
+ (setenv var native-path)))))
+ (cons "LIBRARY_PATH" %gcc-include-paths)))
+ ;; AVR sans-libc cross-compiler.
+ (else #t)))
+
(define (install-strip . _)
"Install a stripped GCC."
;; Unlike our 'strip' phase, this will do the right thing for
@@ -173,14 +204,18 @@ C_*INCLUDE_PATH."
"Modify PHASES to include everything needed to build a cross-GCC for TARGET,
a target triplet."
(modify-phases phases
+ (add-after 'unpack 'patch-genmultilib-shebang
+ patch-genmultilib-shebang)
(add-before 'configure 'set-cross-path
;; This mingw32 target checking logic should match that of target-mingw?
;; in (guix utils), but (guix utils) is too large too copy over to the
;; build side entirely and for now we have no way to select variables to
;; copy over. See (gnu packages cross-base) for more details.
- (if (string-suffix? "-mingw32" target)
- (cut set-cross-path/mingw #:target target <...>)
- set-cross-path))
+ (cond
+ ((string-suffix? "-mingw32" target)
+ (cut set-cross-path/mingw #:target target <...>))
+ ((string-prefix? "avr" target) set-cross-path/avr)
+ (#t set-cross-path)))
(add-after 'install 'make-cross-binutils-visible
(cut make-cross-binutils-visible #:target target <...>))
(replace 'install install-strip)))
diff --git a/gnu/build/icecat-extension.scm b/gnu/build/icecat-extension.scm
index 1e6a9a54e4..e6927c79df 100644
--- a/gnu/build/icecat-extension.scm
+++ b/gnu/build/icecat-extension.scm
@@ -29,6 +29,7 @@ when installed, will make the extension contained in PKG available as an
Icecat browser extension. PKG-OUTPUT specifies which output of PKG to use."
(package
(inherit pkg)
+ (location (package-location pkg))
(name (string-append (package-name pkg) "-icecat"))
(native-inputs '())
(inputs '())
diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm
index 84726363c0..548e28a1c9 100644
--- a/gnu/build/linux-boot.scm
+++ b/gnu/build/linux-boot.scm
@@ -611,10 +611,6 @@ upon error."
the root file system...\n" root-delay)
(sleep root-delay)))
- ;; Prepare the real root file system under /root.
- (unless (file-exists? "/root")
- (mkdir "/root"))
-
(when (procedure? pre-mount)
;; Do whatever actions are needed before mounting the root file
;; system--e.g., installing device mappings. Error out when the
@@ -631,6 +627,10 @@ the root file system...\n" root-delay)
(false-if-exception ; failure is not fatal
(resume-if-hibernated (find-long-option "resume" args))))
+ ;; Prepare the real root file system under /root.
+ (unless (file-exists? "/root")
+ (mkdir "/root"))
+
(setenv "EXT2FS_NO_MTAB_OK" "1")
;; Mount the root file system.