summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-07-11 15:42:40 +0200
committerLudovic Courtès <ludo@gnu.org>2012-07-11 15:42:40 +0200
commit4ac3df42904e432133fd76cbc190434fe11efada (patch)
tree5f04cdd48c9daf9c3d9762a49634ee0a7eef3b40
parent6365068393254e1131ab80eb0d68a759e7fd2256 (diff)
downloadpatches-4ac3df42904e432133fd76cbc190434fe11efada.tar
patches-4ac3df42904e432133fd76cbc190434fe11efada.tar.gz
distro: Add GNU M4.
* distro/base.scm (m4): New variable. * distro/m4-readlink-EINVAL.patch, distro/m4-s_isdir.patch: New files. * Makefile.am (nobase_dist_guilemodule_DATA): Add them.
-rw-r--r--Makefile.am4
-rw-r--r--distro/base.scm48
-rw-r--r--distro/m4-readlink-EINVAL.patch18
-rw-r--r--distro/m4-s_isdir.patch14
4 files changed, 83 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index 8f8cb12c85..c9653505e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,7 +37,9 @@ GOBJECTS = $(MODULES:%.scm=%.go)
nobase_dist_guilemodule_DATA = \
$(MODULES) \
- distro/guile-1.8-cpp-4.5.patch
+ distro/guile-1.8-cpp-4.5.patch \
+ distro/m4-readlink-EINVAL.patch \
+ distro/m4-s_isdir.patch
nobase_nodist_guilemodule_DATA = $(GOBJECTS)
diff --git a/distro/base.scm b/distro/base.scm
index 8492f1029a..86f9811ed4 100644
--- a/distro/base.scm
+++ b/distro/base.scm
@@ -108,6 +108,54 @@ code.")
(home-page "http://www.gnu.org/software/hello/")
(license "GPLv3+")))
+(define-public m4
+ (package
+ (name "m4")
+ (version "1.4.16")
+ (source (origin
+ (method http-fetch)
+ (uri (string-append "http://ftp.gnu.org/gnu/m4/m4-"
+ version ".tar.bz2"))
+ (sha256
+ (base32
+ "035r7ma272j2cwni2961jp22k6bn3n9xwn3b3qbcn2yrvlghql22"))))
+ (build-system gnu-build-system)
+ (arguments (case-lambda
+ ((system)
+ ;; XXX: Disable tests on those platforms with know issues.
+ `(#:tests? ,(not (member system
+ '("x86_64-darwin"
+ "i686-cygwin"
+ "i686-sunos")))
+ #:patches (list (assoc-ref %build-inputs "patch/s_isdir")
+ (assoc-ref %build-inputs
+ "patch/readlink-EINVAL"))))
+ ((system cross-system)
+ `(#: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"))
+ ("patch/readlink-EINVAL"
+ ,(search-path %load-path "distro/m4-readlink-EINVAL.patch"))))
+ (description "GNU M4, a macro processor")
+ (long-description
+ "GNU M4 is an implementation of the traditional Unix macro processor. It
+is mostly SVR4 compatible although it has some extensions (for example,
+handling more than 9 positional parameters to macros). GNU M4 also has
+built-in functions for including files, running shell commands, doing
+arithmetic, etc.
+
+GNU M4 is a macro processor in the sense that it copies its input to the
+output expanding macros as it goes. Macros are either builtin or
+user-defined and can take any number of arguments. Besides just doing macro
+expansion, m4 has builtin functions for including named files, running UNIX
+commands, doing integer arithmetic, manipulating text in various ways,
+recursion etc... m4 can be used either as a front-end to a compiler or as a
+macro processor in its own right.")
+ (license "GPLv3+")
+ (home-page "http://www.gnu.org/software/m4/")))
+
(define-public guile-1.8
(package
(name "guile")
diff --git a/distro/m4-readlink-EINVAL.patch b/distro/m4-readlink-EINVAL.patch
new file mode 100644
index 0000000000..dd371584a7
--- /dev/null
+++ b/distro/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/m4-s_isdir.patch b/distro/m4-s_isdir.patch
new file mode 100644
index 0000000000..a009a4ba44
--- /dev/null
+++ b/distro/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