summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-01-22 00:16:47 +0100
committerLudovic Courtès <ludo@gnu.org>2013-01-22 00:17:42 +0100
commit7cd1d7bd0cead9999e8d829ddce7abed37f9e9a0 (patch)
tree61bccec91f9ceb8595e521f4909255a3196ec231
parentf153d891550986f72a6e10f48cd68fd558569815 (diff)
downloadgnu-guix-7cd1d7bd0cead9999e8d829ddce7abed37f9e9a0.tar
gnu-guix-7cd1d7bd0cead9999e8d829ddce7abed37f9e9a0.tar.gz
gnu: automake: Adjust test suite to lack of /bin/sh.
* gnu/packages/autotools.scm (autoconf-wrapper): New variable. (automake): Use AUTOCONF-WRAPPER instead of AUTOCONF. Add `automake-skip-amhello-tests.patch' as an input. Add #:patches and #:phases arguments. * gnu/packages/patches/automake-skip-amhello-tests.patch: New file. * Makefile.am (dist_patch_DATA): Add it.
-rw-r--r--Makefile.am63
-rw-r--r--gnu/packages/autotools.scm117
-rw-r--r--gnu/packages/patches/automake-skip-amhello-tests.patch39
3 files changed, 174 insertions, 45 deletions
diff --git a/Makefile.am b/Makefile.am
index 01190a2e33..54e80cc4ed 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,37 +136,38 @@ GOBJECTS = $(MODULES:%.scm=%.go) guix/config.go
nobase_dist_guilemodule_DATA = $(MODULES)
patchdir = $(guilemoduledir)/gnu/packages/patches
-dist_patch_DATA = \
- gnu/packages/patches/bigloo-gc-shebangs.patch \
- gnu/packages/patches/binutils-ld-new-dtags.patch \
- gnu/packages/patches/cpio-gets-undeclared.patch \
- gnu/packages/patches/diffutils-gets-undeclared.patch \
- gnu/packages/patches/emacs-configure-sh.patch \
- gnu/packages/patches/flex-bison-tests.patch \
- gnu/packages/patches/gawk-shell.patch \
- gnu/packages/patches/gettext-gets-undeclared.patch \
- gnu/packages/patches/glib-tests-desktop.patch \
- gnu/packages/patches/glib-tests-homedir.patch \
- gnu/packages/patches/glib-tests-timezone.patch \
- gnu/packages/patches/glibc-bootstrap-system.patch \
- gnu/packages/patches/glibc-no-ld-so-cache.patch \
- gnu/packages/patches/guile-1.8-cpp-4.5.patch \
- gnu/packages/patches/guile-default-utf8.patch \
- gnu/packages/patches/guile-relocatable.patch \
- gnu/packages/patches/libevent-dns-tests.patch \
- gnu/packages/patches/libtool-skip-tests.patch \
- gnu/packages/patches/lsh-guile-compat.patch \
- gnu/packages/patches/lsh-no-root-login.patch \
- gnu/packages/patches/lsh-pam-service-name.patch \
- gnu/packages/patches/m4-gets-undeclared.patch \
- gnu/packages/patches/m4-readlink-EINVAL.patch \
- gnu/packages/patches/m4-s_isdir.patch \
- gnu/packages/patches/make-impure-dirs.patch \
- gnu/packages/patches/findutils-absolute-paths.patch \
- gnu/packages/patches/perl-no-sys-dirs.patch \
- gnu/packages/patches/procps-make-3.82.patch \
- gnu/packages/patches/readline-link-ncurses.patch \
- gnu/packages/patches/shishi-gets-undeclared.patch \
+dist_patch_DATA = \
+ gnu/packages/patches/automake-skip-amhello-tests.patch \
+ gnu/packages/patches/bigloo-gc-shebangs.patch \
+ gnu/packages/patches/binutils-ld-new-dtags.patch \
+ gnu/packages/patches/cpio-gets-undeclared.patch \
+ gnu/packages/patches/diffutils-gets-undeclared.patch \
+ gnu/packages/patches/emacs-configure-sh.patch \
+ gnu/packages/patches/flex-bison-tests.patch \
+ gnu/packages/patches/gawk-shell.patch \
+ gnu/packages/patches/gettext-gets-undeclared.patch \
+ gnu/packages/patches/glib-tests-desktop.patch \
+ gnu/packages/patches/glib-tests-homedir.patch \
+ gnu/packages/patches/glib-tests-timezone.patch \
+ gnu/packages/patches/glibc-bootstrap-system.patch \
+ gnu/packages/patches/glibc-no-ld-so-cache.patch \
+ gnu/packages/patches/guile-1.8-cpp-4.5.patch \
+ gnu/packages/patches/guile-default-utf8.patch \
+ gnu/packages/patches/guile-relocatable.patch \
+ gnu/packages/patches/libevent-dns-tests.patch \
+ gnu/packages/patches/libtool-skip-tests.patch \
+ gnu/packages/patches/lsh-guile-compat.patch \
+ gnu/packages/patches/lsh-no-root-login.patch \
+ gnu/packages/patches/lsh-pam-service-name.patch \
+ gnu/packages/patches/m4-gets-undeclared.patch \
+ gnu/packages/patches/m4-readlink-EINVAL.patch \
+ gnu/packages/patches/m4-s_isdir.patch \
+ gnu/packages/patches/make-impure-dirs.patch \
+ gnu/packages/patches/findutils-absolute-paths.patch \
+ gnu/packages/patches/perl-no-sys-dirs.patch \
+ gnu/packages/patches/procps-make-3.82.patch \
+ gnu/packages/patches/readline-link-ncurses.patch \
+ gnu/packages/patches/shishi-gets-undeclared.patch \
gnu/packages/patches/tar-gets-undeclared.patch
bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap
diff --git a/gnu/packages/autotools.scm b/gnu/packages/autotools.scm
index 05fddcc2ab..1f18ebc1ca 100644
--- a/gnu/packages/autotools.scm
+++ b/gnu/packages/autotools.scm
@@ -22,9 +22,12 @@
#:use-module (gnu packages)
#:use-module (gnu packages perl)
#:use-module (gnu packages m4)
+ #:use-module (gnu packages bash)
+ #:use-module (guix utils)
#:use-module (guix packages)
#:use-module (guix download)
- #:use-module (guix build-system gnu))
+ #:use-module (guix build-system gnu)
+ #:use-module (guix build-system trivial))
(define-public autoconf
(package
@@ -59,31 +62,117 @@ file that lists the operating system features that the package
can use, in the form of M4 macro calls.")
(license gpl3+))) ; some files are under GPLv2+
+(define autoconf-wrapper
+ ;; An Autoconf wrapper that generates `configure' scripts that use our
+ ;; own Bash instead of /bin/sh in shebangs. For that reason, it
+ ;; should only be used internally---users should not end up
+ ;; distributing `configure' files with a system-specific shebang.
+ (package (inherit autoconf)
+ (location (source-properties->location (current-source-location)))
+ (name (string-append (package-name autoconf) "-wrapper"))
+ (build-system trivial-build-system)
+ (inputs `(("guile"
+ ,(lambda _
+ ;; XXX: Kludge to hide the circular dependency.
+ (module-ref (resolve-interface '(gnu packages guile))
+ 'guile-2.0)))
+ ("autoconf" ,autoconf)
+ ("bash" ,bash)))
+ (arguments
+ '(#:modules ((guix build utils))
+ #:builder
+ (begin
+ (use-modules (guix build utils))
+ (let* ((out (assoc-ref %outputs "out"))
+ (bin (string-append out "/bin"))
+ (autoconf (string-append
+ (assoc-ref %build-inputs "autoconf")
+ "/bin/autoconf"))
+ (guile (string-append
+ (assoc-ref %build-inputs "guile")
+ "/bin/guile"))
+ (sh (string-append
+ (assoc-ref %build-inputs "bash")
+ "/bin/sh"))
+ (modules ((compose dirname dirname dirname)
+ (search-path %load-path
+ "guix/build/utils.scm"))))
+ (mkdir-p bin)
+
+ ;; Symlink all the binaries but `autoconf'.
+ (with-directory-excursion bin
+ (for-each (lambda (file)
+ (unless (string=? (basename file) "autoconf")
+ (symlink file (basename file))))
+ (find-files (dirname autoconf) ".*")))
+
+ ;; Add an `autoconf' binary that wraps the real one.
+ (call-with-output-file (string-append bin "/autoconf")
+ (lambda (port)
+ ;; Shamefully, Guile can be used in shebangs only if a
+ ;; single argument is passed (-ds); otherwise it gets
+ ;; them all as a single argument and fails to parse them.
+ (format port "#!~a
+export GUILE_LOAD_PATH=\"~a\"
+export GUILE_LOAD_COMPILED_PATH=\"~a\"
+exec ~a --no-auto-compile \"$0\" \"$@\"
+!#~%"
+ sh modules modules guile)
+ (write
+ `(begin
+ (use-modules (guix build utils))
+ (let ((result (apply system* ,autoconf
+ (cdr (command-line)))))
+ (if (and (zero? result)
+ (file-exists? "configure")
+ (not (file-exists? "/bin/sh")))
+ (begin
+ (patch-shebang "configure")
+ #t)
+ (exit (status:exit-val result)))))
+ port)))
+ (chmod (string-append bin "/autoconf") #o555)))))))
+
(define-public automake
(package
(name "automake")
(version "1.12.6")
- (source
- (origin
- (method url-fetch)
- (uri (string-append "mirror://gnu/automake/automake-"
- version ".tar.xz"))
- (sha256
- (base32
- "1ynvca8z4aqcwr94rf7j1bfiid2w9w250y9qhnyj9vmi8lhsnd7q"))))
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "mirror://gnu/automake/automake-"
+ version ".tar.xz"))
+ (sha256
+ (base32
+ "1ynvca8z4aqcwr94rf7j1bfiid2w9w250y9qhnyj9vmi8lhsnd7q"))))
(build-system gnu-build-system)
(inputs
- `(("autoconf" ,autoconf)
- ("perl" ,perl)))
- (home-page
- "http://www.gnu.org/software/automake/")
+ `(("autoconf" ,autoconf-wrapper)
+ ("perl" ,perl)
+ ("patch/skip-amhello"
+ ,(search-patch "automake-skip-amhello-tests.patch"))))
+ (arguments
+ '(#:patches (list (assoc-ref %build-inputs "patch/skip-amhello"))
+ #:phases (alist-cons-before
+ 'patch-source-shebangs 'patch-tests-shebangs
+ (lambda _
+ (let ((sh (which "sh")))
+ (substitute* (find-files "t" "\\.(sh|tap)$")
+ (("#![[:blank:]]?/bin/sh")
+ (string-append "#!" sh)))
+
+ ;; Set these variables for all the `configure' runs
+ ;; that occur during the test suite.
+ (setenv "SHELL" sh)
+ (setenv "CONFIG_SHELL" sh)))
+ %standard-phases)))
+ (home-page "http://www.gnu.org/software/automake/")
(synopsis
"GNU Automake, a GNU standard-compliant makefile generator")
(description
"GNU Automake is a tool for automatically generating
`Makefile.in' files compliant with the GNU Coding
Standards. Automake requires the use of Autoconf.")
- (license gpl2+))) ; some files are under GPLv3+
+ (license gpl2+))) ; some files are under GPLv3+
(define-public libtool
(package
diff --git a/gnu/packages/patches/automake-skip-amhello-tests.patch b/gnu/packages/patches/automake-skip-amhello-tests.patch
new file mode 100644
index 0000000000..560281c338
--- /dev/null
+++ b/gnu/packages/patches/automake-skip-amhello-tests.patch
@@ -0,0 +1,39 @@
+Skip tests that rely on the `amhello' tarball that comes with Automake.
+That tarball's `configure' uses #!/bin/sh, but we can't easily patch it.
+
+diff --git a/t/amhello-binpkg.sh b/t/amhello-binpkg.sh
+index fa88cc6..d988cee 100755
+--- a/t/amhello-binpkg.sh
++++ b/t/amhello-binpkg.sh
+@@ -17,6 +17,7 @@
+ # Test an example from the manual about the 'amhello' package:
+ # using DESTDIR to build simple, no-frills binary packages.
+
++exit 77
+ am_create_testdir=empty
+ . ./defs || exit 1
+
+diff --git a/t/amhello-cflags.sh b/t/amhello-cflags.sh
+index 666011f..2a95e3c 100755
+--- a/t/amhello-cflags.sh
++++ b/t/amhello-cflags.sh
+@@ -18,6 +18,7 @@
+ # using VPATH builds to configure the same package with different
+ # options.
+
++exit 77
+ am_create_testdir=empty
+ required=gcc
+ . ./defs || exit 1
+diff --git a/t/amhello-cross-compile.sh b/t/amhello-cross-compile.sh
+index 708abda..2ee4292 100755
+--- a/t/amhello-cross-compile.sh
++++ b/t/amhello-cross-compile.sh
+@@ -17,6 +17,7 @@
+ # Test an example from the manual about the 'amhello' package:
+ # cross-compiling a package from Linux/Unix to MinGW.
+
++exit 77
+ am_create_testdir=empty
+ required=i586-mingw32msvc-gcc
+ . ./defs || exit 1