summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--guix/build-system/gnu.scm6
-rw-r--r--guix/build/gnu-build-system.scm10
2 files changed, 14 insertions, 2 deletions
diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm
index 0f931dc582..6876342b45 100644
--- a/guix/build-system/gnu.scm
+++ b/guix/build-system/gnu.scm
@@ -43,7 +43,9 @@
 
 (define* (gnu-build store name source inputs
                     #:key (outputs '("out")) (configure-flags ''())
-                    (make-flags ''()) (phases '%standard-phases)
+                    (make-flags ''())
+                    (patches ''()) (patch-flags ''("--batch" "-p1"))
+                    (phases '%standard-phases)
                     (system (%current-system))
                     (modules '((guix build gnu-build-system)
                                (guix build utils))))
@@ -57,6 +59,8 @@ input derivation INPUTS, using the usual procedure of the GNU Build System."
                                 source)
                   #:outputs %outputs
                   #:inputs %build-inputs
+                  #:patches ,patches
+                  #:patch-flags ,patch-flags
                   #:phases ,phases
                   #:configure-flags ,configure-flags
                   #:make-flags ,make-flags)))
diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 6ee9afc845..566903ed73 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -56,6 +56,14 @@
   (and (zero? (system* "tar" "xvf" source))
        (chdir (first-subdirectory "."))))
 
+(define* (patch #:key (patches '()) (patch-flags '("--batch" "-p1"))
+                #:allow-other-keys)
+  (every (lambda (p)
+           (format #t "applying patch `~a'~%" p)
+           (zero? (apply system* "patch"
+                         (append patch-flags (list p)))))
+         patches))
+
 (define* (configure #:key outputs (configure-flags '()) #:allow-other-keys)
   (let* ((prefix     (assoc-ref outputs "out"))
          (libdir     (assoc-ref outputs "lib"))
@@ -94,7 +102,7 @@
   ;; Standard build phases, as a list of symbol/procedure pairs.
   (let-syntax ((phases (syntax-rules ()
                          ((_ p ...) `((p . ,p) ...)))))
-    (phases set-paths unpack configure build check install)))
+    (phases set-paths unpack patch configure build check install)))
 
 
 (define* (gnu-build #:key (source #f) (outputs #f) (inputs #f)