summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2014-03-26 16:31:57 +0100
committerLudovic Courtès <ludo@gnu.org>2014-03-26 16:31:57 +0100
commit4979ee04f07defb55dc448a5682913dc41935760 (patch)
tree03d0a1ed2bd7c7d141d2af09ea01b66fa62e3d88 /guix
parent07fb21b231b8d86cc17beff64111759b972ffcac (diff)
parenteafee15b3ce3638058c43974244964dbd48ec15d (diff)
Merge branch 'core-updates'
Diffstat (limited to 'guix')
-rw-r--r--guix/build/gnu-build-system.scm22
-rw-r--r--guix/build/utils.scm15
-rw-r--r--guix/derivations.scm6
-rw-r--r--guix/packages.scm66
-rw-r--r--guix/profiles.scm3
5 files changed, 80 insertions, 32 deletions
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 65c9fcd1bd..da6b31c326 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -90,8 +90,17 @@
#t)
(define* (unpack #:key source #:allow-other-keys)
- (and (zero? (system* "tar" "xvf" source))
- (chdir (first-subdirectory "."))))
+ "Unpack SOURCE in the working directory, and change directory within the
+source. When SOURCE is a directory, copy it in a sub-directory of the current
+working directory."
+ (if (file-is-directory? source)
+ (begin
+ (mkdir "source")
+ (chdir "source")
+ (copy-recursively source ".")
+ #t)
+ (and (zero? (system* "tar" "xvf" source))
+ (chdir (first-subdirectory ".")))))
(define* (patch-source-shebangs #:key source #:allow-other-keys)
"Patch shebangs in all source files; this includes non-executable
@@ -136,7 +145,10 @@ makefiles."
(bash (or (and=> (assoc-ref (or native-inputs inputs) "bash")
(cut string-append <> "/bin/bash"))
"/bin/sh"))
- (flags `(,(string-append "CONFIG_SHELL=" bash)
+ (flags `(,@(if target ; cross building
+ '("CC_FOR_BUILD=gcc")
+ '())
+ ,(string-append "CONFIG_SHELL=" bash)
,(string-append "SHELL=" bash)
,(string-append "--prefix=" prefix)
"--enable-fast-install" ; when using Libtool
@@ -160,7 +172,7 @@ makefiles."
'())
,@(if docdir
(list (string-append "--docdir=" docdir
- "/doc/" (package-name)))
+ "/share/doc/" (package-name)))
'())
,@(if target ; cross building
(list (string-append "--host=" target))
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index a37ace31af..40af785b88 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2013 Nikita Karetnikov <nikita@karetnikov.org>
;;;
@@ -29,7 +29,8 @@
#:use-module (rnrs io ports)
#:re-export (alist-cons
alist-delete)
- #:export (directory-exists?
+ #:export (%store-directory
+ directory-exists?
executable-file?
call-with-ascii-input-file
with-directory-excursion
@@ -62,6 +63,11 @@
;;; Directories.
;;;
+(define (%store-directory)
+ "Return the directory name of the store."
+ (or (getenv "NIX_STORE")
+ "/gnu/store"))
+
(define (directory-exists? dir)
"Return #t if DIR exists and is a directory."
(let ((s (stat dir #f)))
@@ -443,7 +449,7 @@ all subject to the substitutions."
;;;
-;;; Patching shebangs---e.g., /bin/sh -> /nix/store/xyz...-bash/bin/sh.
+;;; Patching shebangs---e.g., /bin/sh -> /gnu/store/xyz...-bash/bin/sh.
;;;
(define* (dump-port in out
@@ -630,8 +636,7 @@ for each unmatched character."
(unmatched (car matched) result)))))))
(define* (remove-store-references file
- #:optional (store (or (getenv "NIX_STORE")
- "/nix/store")))
+ #:optional (store (%store-directory)))
"Remove from FILE occurrences of file names in STORE; return #t when
store paths were encountered in FILE, #f otherwise. This procedure is
known as `nuke-refs' in Nixpkgs."
diff --git a/guix/derivations.scm b/guix/derivations.scm
index f26075f84a..4d11434e3a 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -870,7 +870,8 @@ system, imported, and appears under FINAL-PATH in the resulting store path."
(build-expression->derivation store name builder
#:system system
#:inputs files
- #:guile-for-build guile)))
+ #:guile-for-build guile
+ #:local-build? #t)))
(define* (imported-modules store modules
#:key (name "module-import")
@@ -936,7 +937,8 @@ they can refer to each other."
(build-expression->derivation store name builder
#:inputs `(("modules" ,module-drv))
#:system system
- #:guile-for-build guile)))
+ #:guile-for-build guile
+ #:local-build? #t)))
(define* (build-expression->derivation store name exp
#:key
diff --git a/guix/packages.scm b/guix/packages.scm
index d345900f79..812d6bb991 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -315,6 +315,20 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(dash (string-index sans #\-)))
(string-drop sans (+ 1 dash))))
+ (define (numeric-extension? file-name)
+ ;; Return true if FILE-NAME ends with digits.
+ (string-every char-set:hex-digit (file-extension file-name)))
+
+ (define (tarxz-name file-name)
+ ;; Return a '.tar.xz' file name based on FILE-NAME.
+ (let ((base (if (numeric-extension? file-name)
+ original-file-name
+ (file-sans-extension file-name))))
+ (string-append base
+ (if (equal? (file-extension base) "tar")
+ ".xz"
+ ".tar.xz"))))
+
(define patch-inputs
(map (lambda (number patch)
(list (string-append "patch" (number->string number))
@@ -327,7 +341,8 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(define builder
`(begin
(use-modules (ice-9 ftw)
- (srfi srfi-1))
+ (srfi srfi-1)
+ (guix build utils))
(let ((out (assoc-ref %outputs "out"))
(xz (assoc-ref %build-inputs "xz"))
@@ -342,14 +357,27 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(format (current-error-port) "applying '~a'...~%" patch*)
(zero? (system* patch "--batch" ,@flags "--input" patch*))))
+ (define (first-file directory)
+ ;; Return the name of the first file in DIRECTORY.
+ (car (scandir directory
+ (lambda (name)
+ (not (member name '("." "..")))))))
+
(setenv "PATH" (string-append xz "/bin" ":"
decomp "/bin"))
- (and (zero? (system* tar "xvf" source))
- (let ((directory (car (scandir "."
- (lambda (name)
- (not
- (member name
- '("." ".."))))))))
+
+ ;; SOURCE may be either a directory or a tarball.
+ (and (if (file-is-directory? source)
+ (let* ((store (or (getenv "NIX_STORE") "/gnu/store"))
+ (len (+ 1 (string-length store)))
+ (base (string-drop source len))
+ (dash (string-index base #\-))
+ (directory (string-drop base (+ 1 dash))))
+ (mkdir directory)
+ (copy-recursively source directory)
+ #t)
+ (zero? (system* tar "xvf" source)))
+ (let ((directory (first-file ".")))
(format (current-error-port)
"source is under '~a'~%" directory)
(chdir directory)
@@ -375,23 +403,23 @@ IMPORTED-MODULES specify modules to use/import for use by SNIPPET."
(zero? (system* tar "cvfa" out directory))))))))
- (let ((name (string-append (file-sans-extension original-file-name)
- ".xz"))
- (inputs (filter-map (match-lambda
- ((name (? package? p))
- (and (member name (cons decompression-type
- '("tar" "xz" "patch")))
- (list name
- (package-derivation store p
- system)))))
- (or inputs (%standard-patch-inputs)))))
+ (let ((name (tarxz-name original-file-name))
+ (inputs (filter-map (match-lambda
+ ((name (? package? p))
+ (and (member name (cons decompression-type
+ '("tar" "xz" "patch")))
+ (list name
+ (package-derivation store p
+ system)))))
+ (or inputs (%standard-patch-inputs))))
+ (modules (delete-duplicates (cons '(guix build utils) modules))))
- (build-expression->derivation store name builder
+ (build-expression->derivation store name builder
#:inputs `(("source" ,source)
,@inputs
,@patch-inputs)
#:system system
- #:modules imported-modules
+ #:modules modules
#:guile-for-build guile-for-build)))
(define* (package-source-derivation store source
diff --git a/guix/profiles.scm b/guix/profiles.scm
index 1ff6c97f9f..c1fa8272ba 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -257,7 +257,8 @@ the given MANIFEST."
;; already valid.
`((,name ,path) ,@deps)))
(manifest-entries manifest))
- #:modules '((guix build union))))
+ #:modules '((guix build union))
+ #:local-build? #t))
(define (profile-regexp profile)
"Return a regular expression that matches PROFILE's name and number."