summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-08-23 23:13:41 +0200
committerLudovic Courtès <ludo@gnu.org>2012-08-23 23:13:41 +0200
commit22b5d9c9a5736b4fac7ddfb33a24c3481920fa4f (patch)
treeee5b2c55ce14b510f98fcce4c783180850aa00e7
parentd36622dc4440e210be7fa8c5355e3bb52dabf2f2 (diff)
downloadguix-22b5d9c9a5736b4fac7ddfb33a24c3481920fa4f.tar.gz
build-system/gnu: Add `out-of-source?' keyword parameter.
* guix/build/gnu-build-system.scm (configure): Add an `out-of-source?'
  keyword parameter; build out-of-source-tree when #t.
* guix/build-system/gnu.scm (gnu-build): Add `out-of-source?' keyword
  parameter.  Pass it in BUILDER.
-rw-r--r--guix/build-system/gnu.scm2
-rw-r--r--guix/build/gnu-build-system.scm16
2 files changed, 15 insertions, 3 deletions
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index cc00c0fddd..fd9a6d026e 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -46,6 +46,7 @@
                     #:key (outputs '("out")) (configure-flags ''())
                     (make-flags ''())
                     (patches ''()) (patch-flags ''("--batch" "-p1"))
+                    (out-of-source? #f)
                     (tests? #t)
                     (parallel-build? #t) (parallel-tests? #t)
                     (patch-shebangs? #t)
@@ -68,6 +69,7 @@ input derivation INPUTS, using the usual procedure of the GNU Build System."
                   #:phases ,phases
                   #:configure-flags ,configure-flags
                   #:make-flags ,make-flags
+                  #:out-of-source? ,out-of-source?
                   #:tests? ,tests?
                   #:parallel-build? ,parallel-build?
                   #:parallel-tests? ,parallel-tests?
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 72f9536ae8..5cc3629e27 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -74,7 +74,8 @@
                          (append patch-flags (list p)))))
          patches))
 
-(define* (configure #:key outputs (configure-flags '()) #:allow-other-keys)
+(define* (configure #:key outputs (configure-flags '()) out-of-source?
+                    #:allow-other-keys)
   (let* ((prefix     (assoc-ref outputs "out"))
          (libdir     (assoc-ref outputs "lib"))
          (includedir (assoc-ref outputs "include"))
@@ -90,9 +91,18 @@
                              (list (string-append "--includedir="
                                                   includedir "/include"))
                              '())
-                       ,@configure-flags)))
+                       ,@configure-flags))
+         (srcdir     (getcwd)))
+    (format #t "source directory: ~s~%" srcdir)
+    (if out-of-source?
+        (begin
+          (mkdir "../build")
+          (chdir "../build")))
+    (format #t "build directory: ~s~%" (getcwd))
     (format #t "configure flags: ~s~%" flags)
-    (zero? (apply system* "./configure" flags))))
+    (zero? (apply system*
+                  (string-append (if out-of-source? srcdir ".") "/configure")
+                  flags))))
 
 (define* (build #:key (make-flags '()) (parallel-build? #t)
                 #:allow-other-keys)