summaryrefslogtreecommitdiff
path: root/guix/build/gnu-build-system.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-06-21 00:25:54 +0200
committerLudovic Courtès <ludo@gnu.org>2013-06-21 00:25:54 +0200
commit56c092ce94cee893898f71ce61e443dd121cccdb (patch)
treee0323ffa05b55605112e2ce46500ee13c7707a48 /guix/build/gnu-build-system.scm
parentd501fad11cfbd69245a4d5e2d632a0ab37985b55 (diff)
downloadguix-patches-56c092ce94cee893898f71ce61e443dd121cccdb.tar
guix-patches-56c092ce94cee893898f71ce61e443dd121cccdb.tar.gz
build-system/gnu: Unify with (guix build-system gnu-cross-build).
* guix/build/gnu-build-system.scm (set-paths): Add `native-inputs' and `native-search-paths' keyword parameters. Honor them. (configure): Add `target' and `native-inputs' keyword parameters. Look for Bash in NATIVE-INPUTS or INPUTS. Pass `--host' when TARGET is true. (strip): Add `strip-command' keyword parameter. Use it. * guix/build/gnu-cross-build.scm: Remove. * Makefile.am (MODULES): Adjust accordingly. * gnu/packages/acl.scm, gnu/packages/attr.scm, gnu/packages/base.scm, gnu/packages/bash.scm, gnu/packages/gawk.scm, gnu/packages/gettext.scm, gnu/packages/guile.scm, gnu/packages/libffi.scm, gnu/packages/libsigsegv.scm, gnu/packages/linux.scm, gnu/packages/ncurses.scm, gnu/packages/readline.scm, guix/build-system/gnu.scm: Replace `%standard-cross-phases' by `%standard-phases'. Remove references to (guix build gnu-cross-build).
Diffstat (limited to 'guix/build/gnu-build-system.scm')
-rw-r--r--guix/build/gnu-build-system.scm45
1 files changed, 37 insertions, 8 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 47820aa02e..4245f2aefd 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -48,15 +48,28 @@
#f
dir))
-(define* (set-paths #:key inputs (search-paths '())
+(define* (set-paths #:key target inputs native-inputs
+ (search-paths '()) (native-search-paths '())
#:allow-other-keys)
(define input-directories
(match inputs
(((_ . dir) ...)
dir)))
+ (define native-input-directories
+ (match native-inputs
+ (((_ . dir) ...)
+ dir)
+ (#f ; not cross compiling
+ '())))
+
+ ;; When cross building, $PATH must refer only to native (host) inputs since
+ ;; target inputs are not executable.
(set-path-environment-variable "PATH" '("bin" "sbin")
- input-directories)
+ (append native-input-directories
+ (if target
+ '()
+ input-directories)))
(for-each (match-lambda
((env-var (directories ...) separator)
@@ -65,6 +78,15 @@
#:separator separator)))
search-paths)
+ (when native-search-paths
+ ;; Search paths for native inputs, when cross building.
+ (for-each (match-lambda
+ ((env-var (directories ...) separator)
+ (set-path-environment-variable env-var directories
+ native-input-directories
+ #:separator separator)))
+ native-search-paths))
+
;; Dump the environment variables as a shell script, for handy debugging.
(system "export > environment-variables"))
@@ -102,7 +124,8 @@ makefiles."
(append patch-flags (list "--input" p)))))
patches))
-(define* (configure #:key inputs outputs (configure-flags '()) out-of-source?
+(define* (configure #:key target native-inputs inputs outputs
+ (configure-flags '()) out-of-source?
#:allow-other-keys)
(define (package-name)
(let* ((out (assoc-ref outputs "out"))
@@ -119,7 +142,7 @@ makefiles."
(libdir (assoc-ref outputs "lib"))
(includedir (assoc-ref outputs "include"))
(docdir (assoc-ref outputs "doc"))
- (bash (or (and=> (assoc-ref inputs "bash")
+ (bash (or (and=> (assoc-ref (or native-inputs inputs) "bash")
(cut string-append <> "/bin/bash"))
"/bin/sh"))
(flags `(,(string-append "CONFIG_SHELL=" bash)
@@ -148,6 +171,9 @@ makefiles."
(list (string-append "--docdir=" docdir
"/doc/" (package-name)))
'())
+ ,@(if target ; cross building
+ (list (string-append "--host=" target))
+ '())
,@configure-flags))
(abs-srcdir (getcwd))
(srcdir (if out-of-source?
@@ -230,17 +256,20 @@ makefiles."
bindirs)))
#t)
-(define* (strip #:key outputs (strip-binaries? #t)
+(define* (strip #:key target outputs (strip-binaries? #t)
+ (strip-command (if target
+ (string-append target "-strip")
+ "strip"))
(strip-flags '("--strip-debug"))
(strip-directories '("lib" "lib64" "libexec"
"bin" "sbin"))
#:allow-other-keys)
(define (strip-dir dir)
- (format #t "stripping binaries in ~s with flags ~s~%"
- dir strip-flags)
+ (format #t "stripping binaries in ~s with ~s and flags ~s~%"
+ dir strip-command strip-flags)
(file-system-fold (const #t)
(lambda (path stat result) ; leaf
- (zero? (apply system* "strip"
+ (zero? (apply system* strip-command
(append strip-flags (list path)))))
(const #t) ; down
(const #t) ; up