From 800cdeef31ccc92c9f54b62ec5276985d7b157b1 Mon Sep 17 00:00:00 2001
From: Ludovic Courtès <ludo@gnu.org>
Date: Wed, 22 Aug 2012 17:24:38 +0200
Subject: distro: Move patches to their own directory.

* Makefile.am (nobase_dist_guilemodule_DATA): Keep only $(MODULES).
  (patchdir): New variable.
  (dist_patch_DATA): New variable.  Patch files formerly
  in $(nobase_dist_guilemodule_DATA).
  (.scm.go): Define `DISTRO_PATCH_DIRECTORY' and
  `DISTRO_INSTALLED_PATCH_DIRECTORY'.
  (TESTS_ENVIRONMENT): Define `DISTRO_PATCH_DIRECTORY'.

* distro.scm (%patch-directory): New variable.
  (search-patch): New procedure.
* distro/base.scm: Use `search-patch' instead of `(search-path
  %load-path ...)'.

* distro/findutils-absolute-paths.patch, distro/guile-1.8-cpp-4.5.patch,
  distro/m4-readlink-EINVAL.patch, distro/m4-s_isdir.patch,
  distro/make-impure-dirs.patch: Move to `distro/patches'.
---
 distro/base.scm                               | 17 +++++-------
 distro/findutils-absolute-paths.patch         | 29 -------------------
 distro/guile-1.8-cpp-4.5.patch                | 24 ----------------
 distro/m4-readlink-EINVAL.patch               | 18 ------------
 distro/m4-s_isdir.patch                       | 14 ----------
 distro/make-impure-dirs.patch                 | 40 ---------------------------
 distro/patches/findutils-absolute-paths.patch | 29 +++++++++++++++++++
 distro/patches/guile-1.8-cpp-4.5.patch        | 24 ++++++++++++++++
 distro/patches/m4-readlink-EINVAL.patch       | 18 ++++++++++++
 distro/patches/m4-s_isdir.patch               | 14 ++++++++++
 distro/patches/make-impure-dirs.patch         | 40 +++++++++++++++++++++++++++
 distro/patches/readline-link-ncurses.patch    | 18 ++++++++++++
 distro/readline-link-ncurses.patch            | 18 ------------
 13 files changed, 150 insertions(+), 153 deletions(-)
 delete mode 100644 distro/findutils-absolute-paths.patch
 delete mode 100644 distro/guile-1.8-cpp-4.5.patch
 delete mode 100644 distro/m4-readlink-EINVAL.patch
 delete mode 100644 distro/m4-s_isdir.patch
 delete mode 100644 distro/make-impure-dirs.patch
 create mode 100644 distro/patches/findutils-absolute-paths.patch
 create mode 100644 distro/patches/guile-1.8-cpp-4.5.patch
 create mode 100644 distro/patches/m4-readlink-EINVAL.patch
 create mode 100644 distro/patches/m4-s_isdir.patch
 create mode 100644 distro/patches/make-impure-dirs.patch
 create mode 100644 distro/patches/readline-link-ncurses.patch
 delete mode 100644 distro/readline-link-ncurses.patch

(limited to 'distro')

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/findutils-absolute-paths.patch
deleted file mode 100644
index 96341e281f..0000000000
--- a/distro/findutils-absolute-paths.patch
+++ /dev/null
@@ -1,29 +0,0 @@
-Fix use of LFS-style absolute paths.
-
-Patches from Nixpkgs by Armijn Hemel <armijn@gpl-violations.org>
-and Wouter den Breejen <uu@denbreejen.net>.
-
-diff -ruN findutils-4.2.20/locate/updatedb.sh findutils-4.2.20.new/locate/updatedb.sh
---- findutils-4.2.20/locate/updatedb.sh	2005-01-24 17:12:35.000000000 +0100
-+++ findutils-4.2.20.new/locate/updatedb.sh	2005-08-23 14:37:10.000000000 +0200
-@@ -141,7 +141,7 @@
- : ${code:=${LIBEXECDIR}/@code@}
- 
- 
--PATH=/bin:/usr/bin:${BINDIR}; export PATH
-+PATH=/bin:/usr/bin:${BINDIR}:${PATH}; export PATH
- 
- : ${PRUNEFS="nfs NFS proc afs proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs sysfs shfs"}
- 
-diff -Naur findutils-4.2.30/xargs/xargs.c findutils-4.2.30_new/xargs/xargs.c
---- findutils-4.2.30/xargs/xargs.c	2007-02-27 11:21:08.000000000 +0100
-+++ findutils-4.2.30_new/xargs/xargs.c	2007-07-17 19:02:05.000000000 +0200
-@@ -402,7 +402,7 @@
-   int show_limits = 0;			/* --show-limits */
-   int always_run_command = 1;
-   char *input_file = "-"; /* "-" is stdin */
--  char *default_cmd = "/bin/echo";
-+  char *default_cmd = "echo";
-   int (*read_args) PARAMS ((void)) = read_line;
-   void (*act_on_init_result)(void) = noop;
-   int env_too_big = 0;
diff --git a/distro/guile-1.8-cpp-4.5.patch b/distro/guile-1.8-cpp-4.5.patch
deleted file mode 100644
index 638d071baf..0000000000
--- a/distro/guile-1.8-cpp-4.5.patch
+++ /dev/null
@@ -1,24 +0,0 @@
-Fix doc snarfing with GCC 4.5+.
-From <http://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=aac41d28358cea594bb30f6e547afb82bb6004a6>.
-
-diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi
-index ea33e17..8cd42e8 100755
---- a/scripts/snarf-check-and-output-texi
-+++ b/scripts/snarf-check-and-output-texi
-@@ -267,6 +267,17 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
-       (set! *file* file)
-       (set! *line* line))
- 
-+     ;; newer gccs like to throw around more location markers into the
-+     ;; preprocessed source; these (hash . hash) bits are what they translate to
-+     ;; in snarfy terms.
-+     (('location ('string . file) ('int . line) ('hash . 'hash))
-+      (set! *file* file)
-+      (set! *line* line))
-+
-+     (('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash))
-+      (set! *file* file)
-+      (set! *line* line))
-+
-      (('arglist rest ...)
-       (set! *args* (do-arglist rest)))
diff --git a/distro/m4-readlink-EINVAL.patch b/distro/m4-readlink-EINVAL.patch
deleted file mode 100644
index dd371584a7..0000000000
--- a/distro/m4-readlink-EINVAL.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-Newer Linux kernels would return EINVAL instead of ENOENT.
-The patch below, taken from Gnulib, allows the test to pass when
-these Linux versions are in use:
-https://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00308.html .
-
-diff --git a/tests/test-readlink.h b/tests/test-readlink.h
-index 08d5662..7247fc4 100644
---- a/tests/test-readlink.h
-+++ b/tests/test-readlink.h
-@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
-   ASSERT (errno == ENOENT);
-   errno = 0;
-   ASSERT (func ("", buf, sizeof buf) == -1);
--  ASSERT (errno == ENOENT);
-+  ASSERT (errno == ENOENT || errno == EINVAL);
-   errno = 0;
-   ASSERT (func (".", buf, sizeof buf) == -1);
-   ASSERT (errno == EINVAL);
diff --git a/distro/m4-s_isdir.patch b/distro/m4-s_isdir.patch
deleted file mode 100644
index a009a4ba44..0000000000
--- a/distro/m4-s_isdir.patch
+++ /dev/null
@@ -1,14 +0,0 @@
-Fails to build with glibc 2.12.1 without this patch.
-
-http://lists.gnu.org/archive/html/bug-m4/2010-05/msg00002.html
-
---- a/src/path.c
-+++ b/src/path.c
-@@ -22,6 +22,7 @@
- /* Handling of path search of included files via the builtins "include"
-    and "sinclude".  */
- 
- #include "m4.h"
-+#include "sys/stat.h"
- 
- struct includes
diff --git a/distro/make-impure-dirs.patch b/distro/make-impure-dirs.patch
deleted file mode 100644
index 83a5fbe3a5..0000000000
--- a/distro/make-impure-dirs.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-Purity: don't look for library dependencies (of the form `-lfoo') in
-/lib and /usr/lib.  Likewise, when searching for included Makefiles,
-don't look in /usr/include and friends.
-
-Patch from Nixpkgs, by Eelco Dolstra.
-
-diff -rc make-3.81-orig/read.c make-3.81/read.c
-*** make-3.81-orig/read.c	2006-03-17 15:24:20.000000000 +0100
---- make-3.81/read.c	2007-05-24 17:16:31.000000000 +0200
-***************
-*** 99,107 ****
---- 99,109 ----
-  #endif
-      INCLUDEDIR,
-  #ifndef _AMIGA
-+ #if 0    
-      "/usr/gnu/include",
-      "/usr/local/include",
-      "/usr/include",
-+ #endif    
-  #endif
-      0
-    };
-diff -rc make-3.81-orig/remake.c make-3.81/remake.c
-*** make-3.81-orig/remake.c	2006-03-20 03:36:37.000000000 +0100
---- make-3.81/remake.c	2007-05-24 17:06:54.000000000 +0200
-***************
-*** 1452,1460 ****
---- 1452,1462 ----
-    static char *dirs[] =
-      {
-  #ifndef _AMIGA
-+ #if 0
-        "/lib",
-        "/usr/lib",
-  #endif
-+ #endif
-  #if defined(WINDOWS32) && !defined(LIBDIR)
-  /*
-   * This is completely up to the user at product install time. Just define
diff --git a/distro/patches/findutils-absolute-paths.patch b/distro/patches/findutils-absolute-paths.patch
new file mode 100644
index 0000000000..96341e281f
--- /dev/null
+++ b/distro/patches/findutils-absolute-paths.patch
@@ -0,0 +1,29 @@
+Fix use of LFS-style absolute paths.
+
+Patches from Nixpkgs by Armijn Hemel <armijn@gpl-violations.org>
+and Wouter den Breejen <uu@denbreejen.net>.
+
+diff -ruN findutils-4.2.20/locate/updatedb.sh findutils-4.2.20.new/locate/updatedb.sh
+--- findutils-4.2.20/locate/updatedb.sh	2005-01-24 17:12:35.000000000 +0100
++++ findutils-4.2.20.new/locate/updatedb.sh	2005-08-23 14:37:10.000000000 +0200
+@@ -141,7 +141,7 @@
+ : ${code:=${LIBEXECDIR}/@code@}
+ 
+ 
+-PATH=/bin:/usr/bin:${BINDIR}; export PATH
++PATH=/bin:/usr/bin:${BINDIR}:${PATH}; export PATH
+ 
+ : ${PRUNEFS="nfs NFS proc afs proc smbfs autofs iso9660 ncpfs coda devpts ftpfs devfs mfs sysfs shfs"}
+ 
+diff -Naur findutils-4.2.30/xargs/xargs.c findutils-4.2.30_new/xargs/xargs.c
+--- findutils-4.2.30/xargs/xargs.c	2007-02-27 11:21:08.000000000 +0100
++++ findutils-4.2.30_new/xargs/xargs.c	2007-07-17 19:02:05.000000000 +0200
+@@ -402,7 +402,7 @@
+   int show_limits = 0;			/* --show-limits */
+   int always_run_command = 1;
+   char *input_file = "-"; /* "-" is stdin */
+-  char *default_cmd = "/bin/echo";
++  char *default_cmd = "echo";
+   int (*read_args) PARAMS ((void)) = read_line;
+   void (*act_on_init_result)(void) = noop;
+   int env_too_big = 0;
diff --git a/distro/patches/guile-1.8-cpp-4.5.patch b/distro/patches/guile-1.8-cpp-4.5.patch
new file mode 100644
index 0000000000..638d071baf
--- /dev/null
+++ b/distro/patches/guile-1.8-cpp-4.5.patch
@@ -0,0 +1,24 @@
+Fix doc snarfing with GCC 4.5+.
+From <http://git.savannah.gnu.org/cgit/guile.git/commit/?h=branch_release-1-8&id=aac41d28358cea594bb30f6e547afb82bb6004a6>.
+
+diff --git a/scripts/snarf-check-and-output-texi b/scripts/snarf-check-and-output-texi
+index ea33e17..8cd42e8 100755
+--- a/scripts/snarf-check-and-output-texi
++++ b/scripts/snarf-check-and-output-texi
+@@ -267,6 +267,17 @@ exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
+       (set! *file* file)
+       (set! *line* line))
+ 
++     ;; newer gccs like to throw around more location markers into the
++     ;; preprocessed source; these (hash . hash) bits are what they translate to
++     ;; in snarfy terms.
++     (('location ('string . file) ('int . line) ('hash . 'hash))
++      (set! *file* file)
++      (set! *line* line))
++
++     (('location ('hash . 'hash) ('string . file) ('int . line) ('hash . 'hash))
++      (set! *file* file)
++      (set! *line* line))
++
+      (('arglist rest ...)
+       (set! *args* (do-arglist rest)))
diff --git a/distro/patches/m4-readlink-EINVAL.patch b/distro/patches/m4-readlink-EINVAL.patch
new file mode 100644
index 0000000000..dd371584a7
--- /dev/null
+++ b/distro/patches/m4-readlink-EINVAL.patch
@@ -0,0 +1,18 @@
+Newer Linux kernels would return EINVAL instead of ENOENT.
+The patch below, taken from Gnulib, allows the test to pass when
+these Linux versions are in use:
+https://lists.gnu.org/archive/html/bug-gnulib/2011-03/msg00308.html .
+
+diff --git a/tests/test-readlink.h b/tests/test-readlink.h
+index 08d5662..7247fc4 100644
+--- a/tests/test-readlink.h
++++ b/tests/test-readlink.h
+@@ -38,7 +38,7 @@ test_readlink (ssize_t (*func) (char const *, char *, size_t), bool print)
+   ASSERT (errno == ENOENT);
+   errno = 0;
+   ASSERT (func ("", buf, sizeof buf) == -1);
+-  ASSERT (errno == ENOENT);
++  ASSERT (errno == ENOENT || errno == EINVAL);
+   errno = 0;
+   ASSERT (func (".", buf, sizeof buf) == -1);
+   ASSERT (errno == EINVAL);
diff --git a/distro/patches/m4-s_isdir.patch b/distro/patches/m4-s_isdir.patch
new file mode 100644
index 0000000000..a009a4ba44
--- /dev/null
+++ b/distro/patches/m4-s_isdir.patch
@@ -0,0 +1,14 @@
+Fails to build with glibc 2.12.1 without this patch.
+
+http://lists.gnu.org/archive/html/bug-m4/2010-05/msg00002.html
+
+--- a/src/path.c
++++ b/src/path.c
+@@ -22,6 +22,7 @@
+ /* Handling of path search of included files via the builtins "include"
+    and "sinclude".  */
+ 
+ #include "m4.h"
++#include "sys/stat.h"
+ 
+ struct includes
diff --git a/distro/patches/make-impure-dirs.patch b/distro/patches/make-impure-dirs.patch
new file mode 100644
index 0000000000..83a5fbe3a5
--- /dev/null
+++ b/distro/patches/make-impure-dirs.patch
@@ -0,0 +1,40 @@
+Purity: don't look for library dependencies (of the form `-lfoo') in
+/lib and /usr/lib.  Likewise, when searching for included Makefiles,
+don't look in /usr/include and friends.
+
+Patch from Nixpkgs, by Eelco Dolstra.
+
+diff -rc make-3.81-orig/read.c make-3.81/read.c
+*** make-3.81-orig/read.c	2006-03-17 15:24:20.000000000 +0100
+--- make-3.81/read.c	2007-05-24 17:16:31.000000000 +0200
+***************
+*** 99,107 ****
+--- 99,109 ----
+  #endif
+      INCLUDEDIR,
+  #ifndef _AMIGA
++ #if 0    
+      "/usr/gnu/include",
+      "/usr/local/include",
+      "/usr/include",
++ #endif    
+  #endif
+      0
+    };
+diff -rc make-3.81-orig/remake.c make-3.81/remake.c
+*** make-3.81-orig/remake.c	2006-03-20 03:36:37.000000000 +0100
+--- make-3.81/remake.c	2007-05-24 17:06:54.000000000 +0200
+***************
+*** 1452,1460 ****
+--- 1452,1462 ----
+    static char *dirs[] =
+      {
+  #ifndef _AMIGA
++ #if 0
+        "/lib",
+        "/usr/lib",
+  #endif
++ #endif
+  #if defined(WINDOWS32) && !defined(LIBDIR)
+  /*
+   * This is completely up to the user at product install time. Just define
diff --git a/distro/patches/readline-link-ncurses.patch b/distro/patches/readline-link-ncurses.patch
new file mode 100644
index 0000000000..0fd0598f46
--- /dev/null
+++ b/distro/patches/readline-link-ncurses.patch
@@ -0,0 +1,18 @@
+This patch is to make sure that `libncurses' is among the `NEEDED'
+dependencies of `libreadline.so' and `libhistory.so'.
+
+Failing to do that, applications linking against Readline are
+forced to explicitly link against libncurses as well; in addition,
+this trick doesn't work when using GNU ld's `--as-needed'.
+
+--- shlib/Makefile.in	2009-01-06 18:03:22.000000000 +0100
++++ shlib/Makefile.in	2009-07-27 14:43:25.000000000 +0200
+@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
+ SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
+ SHOBJ_LIBS = @SHOBJ_LIBS@
+ 
+-SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
++SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses
+ SHLIB_LIBS = @SHLIB_LIBS@
+ 
+ SHLIB_DOT = @SHLIB_DOT@
diff --git a/distro/readline-link-ncurses.patch b/distro/readline-link-ncurses.patch
deleted file mode 100644
index 0fd0598f46..0000000000
--- a/distro/readline-link-ncurses.patch
+++ /dev/null
@@ -1,18 +0,0 @@
-This patch is to make sure that `libncurses' is among the `NEEDED'
-dependencies of `libreadline.so' and `libhistory.so'.
-
-Failing to do that, applications linking against Readline are
-forced to explicitly link against libncurses as well; in addition,
-this trick doesn't work when using GNU ld's `--as-needed'.
-
---- shlib/Makefile.in	2009-01-06 18:03:22.000000000 +0100
-+++ shlib/Makefile.in	2009-07-27 14:43:25.000000000 +0200
-@@ -84,7 +84,7 @@ SHOBJ_LDFLAGS = @SHOBJ_LDFLAGS@
- SHOBJ_XLDFLAGS = @SHOBJ_XLDFLAGS@
- SHOBJ_LIBS = @SHOBJ_LIBS@
- 
--SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@
-+SHLIB_XLDFLAGS = @LDFLAGS@ @SHLIB_XLDFLAGS@ -lncurses
- SHLIB_LIBS = @SHLIB_LIBS@
- 
- SHLIB_DOT = @SHLIB_DOT@
-- 
cgit v1.2.3