summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am21
-rw-r--r--distro.scm15
-rw-r--r--distro/base.scm17
-rw-r--r--distro/patches/findutils-absolute-paths.patch (renamed from distro/findutils-absolute-paths.patch)0
-rw-r--r--distro/patches/guile-1.8-cpp-4.5.patch (renamed from distro/guile-1.8-cpp-4.5.patch)0
-rw-r--r--distro/patches/m4-readlink-EINVAL.patch (renamed from distro/m4-readlink-EINVAL.patch)0
-rw-r--r--distro/patches/m4-s_isdir.patch (renamed from distro/m4-s_isdir.patch)0
-rw-r--r--distro/patches/make-impure-dirs.patch (renamed from distro/make-impure-dirs.patch)0
-rw-r--r--distro/patches/readline-link-ncurses.patch (renamed from distro/readline-link-ncurses.patch)0
9 files changed, 34 insertions, 19 deletions
diff --git a/Makefile.am b/Makefile.am
index 0c05160e95..6616b80f7c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -35,14 +35,16 @@ MODULES =					\
 
 GOBJECTS = $(MODULES:%.scm=%.go)
 
-nobase_dist_guilemodule_DATA =			\
-  $(MODULES)					\
-  distro/guile-1.8-cpp-4.5.patch		\
-  distro/m4-readlink-EINVAL.patch		\
-  distro/m4-s_isdir.patch			\
-  distro/make-impure-dirs.patch			\
-  distro/findutils-absolute-paths.patch		\
-  distro/readline-link-ncurses.patch
+nobase_dist_guilemodule_DATA = $(MODULES)
+
+patchdir = $(pkgdatadir)/patches
+dist_patch_DATA =				\
+  distro/patches/guile-1.8-cpp-4.5.patch	\
+  distro/patches/m4-readlink-EINVAL.patch	\
+  distro/patches/m4-s_isdir.patch		\
+  distro/patches/make-impure-dirs.patch		\
+  distro/patches/findutils-absolute-paths.patch	\
+  distro/patches/readline-link-ncurses.patch
 
 nobase_nodist_guilemodule_DATA = $(GOBJECTS)
 
@@ -57,6 +59,7 @@ TESTS_ENVIRONMENT =								\
   NIX_HASH="$(NIX_HASH)";							\
   NIX_INSTANTIATE="$(NIX_INSTANTIATE)";						\
   NIXPKGS="$(NIXPKGS)";								\
+  DISTRO_PATCH_DIRECTORY="$(top_srcdir)/distro/patches"				\
   GUILE_LOAD_COMPILED_PATH="$(top_builddir):$$GUILE_LOAD_COMPILED_PATH";	\
   export NIX_HASH NIX_INSTANTIATE NIXPKGS GUILE_LOAD_COMPILED_PATH;
 
@@ -78,6 +81,8 @@ CLEANFILES = $(GOBJECTS) *.log
 	NIX_INSTANTIATE="$(NIX_INSTANTIATE)"					\
 	NIXPKGS="$(NIXPKGS)"							\
 	LIBGCRYPT="$(LIBGCRYPT)"						\
+	DISTRO_PATCH_DIRECTORY="$(top_srcdir)/distro/patches"			\
+	DISTRO_INSTALLED_PATCH_DIRECTORY="$(patchdir)"				\
 	GUILE_AUTO_COMPILE=0							\
 	GUILE_LOAD_COMPILED_PATH="$(top_builddir):$$GUILE_LOAD_COMPILED_PATH"	\
 	$(GUILD) compile -L "$(top_srcdir)"					\
diff --git a/distro.scm b/distro.scm
index 784e537deb..b21b0e6184 100644
--- a/distro.scm
+++ b/distro.scm
@@ -18,10 +18,14 @@
 
 (define-module (distro)
   #:use-module (guix packages)
+  #:use-module (guix utils)
   #:use-module (ice-9 ftw)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26)
-  #:export (find-packages-by-name))
+  #:use-module (srfi srfi-39)
+  #:export (search-patch
+            %patch-directory
+            find-packages-by-name))
 
 ;;; Commentary:
 ;;;
@@ -32,6 +36,15 @@
 
 (define _ (cut gettext <> "guix"))
 
+(define %patch-directory
+  (make-parameter
+   (or (getenv "DISTRO_PATCH_DIRECTORY")
+       (compile-time-value (getenv "DISTRO_INSTALLED_PATCH_DIRECTORY")))))
+
+(define (search-patch file-name)
+  "Search the patch FILE-NAME."
+  (search-path (list (%patch-directory)) file-name))
+
 (define %distro-module-directory
   ;; Absolute path of the (distro ...) module root.
   (string-append (dirname (search-path %load-path "distro.scm"))
diff --git a/distro/base.scm b/distro/base.scm
index 16f5b40e30..179910a129 100644
--- a/distro/base.scm
+++ b/distro/base.scm
@@ -17,6 +17,7 @@
 ;;; along with Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (distro base)
+  #:use-module (distro)
   #:use-module (guix packages)
   #:use-module (guix http)
   #:use-module (guix build-system gnu)
@@ -191,7 +192,7 @@ files (as archives).")
    (build-system gnu-build-system)
    (native-inputs
     `(("patch/absolute-paths"
-       ,(search-path %load-path "distro/findutils-absolute-paths.patch"))))
+       ,(search-patch "findutils-absolute-paths.patch"))))
    (arguments
     (case-lambda
       ((system)
@@ -245,10 +246,9 @@ The tools supplied with this package are:
                  `(#:patches (list (assoc-ref %build-inputs "patch/s_isdir")
                                    (assoc-ref %build-inputs
                                               "patch/readlink-EINVAL"))))))
-   (inputs `(("patch/s_isdir"
-              ,(search-path %load-path "distro/m4-s_isdir.patch"))
+   (inputs `(("patch/s_isdir" ,(search-patch "m4-s_isdir.patch"))
              ("patch/readlink-EINVAL"
-              ,(search-path %load-path "distro/m4-readlink-EINVAL.patch"))))
+              ,(search-patch "m4-readlink-EINVAL.patch"))))
    (description "GNU M4, a macro processor")
    (long-description
     "GNU M4 is an implementation of the traditional Unix macro processor.  It
@@ -280,8 +280,7 @@ macro processor in its own right.")
               "0ri98385hsd7li6rh4l5afcq92v8l2lgiaz85wgcfh4w2wzsghg2"))))
    (build-system gnu-build-system)
    (native-inputs
-    `(("patch/impure-dirs"
-       ,(search-path %load-path "distro/make-impure-dirs.patch"))))
+    `(("patch/impure-dirs" ,(search-patch "make-impure-dirs.patch"))))
    (arguments `(#:patches (list (assoc-ref %build-inputs
                                            "patch/impure-dirs"))))
    (description "GNU Make, a program controlling the generation of non-source
@@ -481,8 +480,7 @@ UNIX.  It has even been ported to OS/2 Warp!")
    (build-system gnu-build-system)
    (propagated-inputs `(("ncurses" ,ncurses)))
    (inputs `(("patch/link-ncurses"
-              ,(search-path %load-path
-                            "distro/readline-link-ncurses.patch"))))
+              ,(search-patch "readline-link-ncurses.patch"))))
    (arguments `(#:patches (list (assoc-ref %build-inputs
                                            "patch/link-ncurses"))
                 #:patch-flags '("-p0")))
@@ -664,8 +662,7 @@ records, each record containing an arbitrary number of named fields.")
                                                    match
                                                    (assoc-ref outputs "out")))))
                            %standard-phases)))
-   (inputs `(("patch/snarf"
-              ,(search-path %load-path "distro/guile-1.8-cpp-4.5.patch"))
+   (inputs `(("patch/snarf" ,(search-patch "guile-1.8-cpp-4.5.patch"))
              ("gawk" ,gawk)
              ("readline" ,readline)))
 
diff --git a/distro/findutils-absolute-paths.patch b/distro/patches/findutils-absolute-paths.patch
index 96341e281f..96341e281f 100644
--- a/distro/findutils-absolute-paths.patch
+++ b/distro/patches/findutils-absolute-paths.patch
diff --git a/distro/guile-1.8-cpp-4.5.patch b/distro/patches/guile-1.8-cpp-4.5.patch
index 638d071baf..638d071baf 100644
--- a/distro/guile-1.8-cpp-4.5.patch
+++ b/distro/patches/guile-1.8-cpp-4.5.patch
diff --git a/distro/m4-readlink-EINVAL.patch b/distro/patches/m4-readlink-EINVAL.patch
index dd371584a7..dd371584a7 100644
--- a/distro/m4-readlink-EINVAL.patch
+++ b/distro/patches/m4-readlink-EINVAL.patch
diff --git a/distro/m4-s_isdir.patch b/distro/patches/m4-s_isdir.patch
index a009a4ba44..a009a4ba44 100644
--- a/distro/m4-s_isdir.patch
+++ b/distro/patches/m4-s_isdir.patch
diff --git a/distro/make-impure-dirs.patch b/distro/patches/make-impure-dirs.patch
index 83a5fbe3a5..83a5fbe3a5 100644
--- a/distro/make-impure-dirs.patch
+++ b/distro/patches/make-impure-dirs.patch
diff --git a/distro/readline-link-ncurses.patch b/distro/patches/readline-link-ncurses.patch
index 0fd0598f46..0fd0598f46 100644
--- a/distro/readline-link-ncurses.patch
+++ b/distro/patches/readline-link-ncurses.patch