1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
5 ;;; This file is part of GNU Guix.
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20 (define-module (gnu packages autotools)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages perl)
24 #:use-module (gnu packages m4)
25 #:use-module (gnu packages bash)
26 #:use-module (guix utils)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial))
32 (define-public autoconf
39 (uri (string-append "mirror://gnu/autoconf/autoconf-"
43 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
44 (build-system gnu-build-system)
48 ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
49 ;; should use our own "cpp" instead of "/lib/cpp".
50 (arguments `(#:tests? #f))
52 "http://www.gnu.org/software/autoconf/")
53 (synopsis "Create source code configuration scripts")
55 "GNU Autoconf is an extensible package of M4 macros that produce
56 shell scripts to automatically configure software source code
57 packages. These scripts can adapt the packages to many kinds of
58 UNIX-like systems without manual user intervention. Autoconf
59 creates a configuration script for a package from a template
60 file that lists the operating system features that the package
61 can use, in the form of M4 macro calls.")
62 (license gpl3+))) ; some files are under GPLv2+
64 (define-public autoconf-wrapper
65 ;; An Autoconf wrapper that generates `configure' scripts that use our
66 ;; own Bash instead of /bin/sh in shebangs. For that reason, it
67 ;; should only be used internally---users should not end up
68 ;; distributing `configure' files with a system-specific shebang.
69 (package (inherit autoconf)
70 (location (source-properties->location (current-source-location)))
71 (name (string-append (package-name autoconf) "-wrapper"))
72 (build-system trivial-build-system)
74 ;; XXX: Kludge to hide the circular dependency.
75 ,(module-ref (resolve-interface '(gnu packages guile))
77 ("autoconf" ,autoconf)
80 '(#:modules ((guix build utils))
83 (use-modules (guix build utils))
84 (let* ((out (assoc-ref %outputs "out"))
85 (bin (string-append out "/bin"))
86 (autoconf (string-append
87 (assoc-ref %build-inputs "autoconf")
90 (assoc-ref %build-inputs "guile")
93 (assoc-ref %build-inputs "bash")
95 (modules ((compose dirname dirname dirname)
96 (search-path %load-path
97 "guix/build/utils.scm"))))
100 ;; Symlink all the binaries but `autoconf'.
101 (with-directory-excursion bin
102 (for-each (lambda (file)
103 (unless (string=? (basename file) "autoconf")
104 (symlink file (basename file))))
105 (find-files (dirname autoconf) ".*")))
107 ;; Add an `autoconf' binary that wraps the real one.
108 (call-with-output-file (string-append bin "/autoconf")
110 ;; Shamefully, Guile can be used in shebangs only if a
111 ;; single argument is passed (-ds); otherwise it gets
112 ;; them all as a single argument and fails to parse them.
114 export GUILE_LOAD_PATH=\"~a\"
115 export GUILE_LOAD_COMPILED_PATH=\"~a\"
116 exec ~a --no-auto-compile \"$0\" \"$@\"
118 sh modules modules guile)
121 (use-modules (guix build utils))
122 (let ((result (apply system* ,autoconf
123 (cdr (command-line)))))
124 (if (and (zero? result)
125 (file-exists? "configure")
126 (not (file-exists? "/bin/sh")))
128 (patch-shebang "configure")
130 (exit (status:exit-val result)))))
132 (chmod (string-append bin "/autoconf") #o555)))))))
134 (define-public automake
140 (uri (string-append "mirror://gnu/automake/automake-"
144 "12yi1bzkipi7qdmkdy77pazljsa9z7q66hi6c4rq73p7hbv6rkbf"))))
145 (build-system gnu-build-system)
147 `(("autoconf" ,autoconf-wrapper)
149 ("patch/skip-amhello"
150 ,(search-patch "automake-skip-amhello-tests.patch"))))
152 '(#:patches (list (assoc-ref %build-inputs "patch/skip-amhello"))
153 #:modules ((guix build gnu-build-system)
158 #:phases (alist-cons-before
159 'patch-source-shebangs 'patch-tests-shebangs
161 (let ((sh (which "sh")))
162 (substitute* (find-files "t" "\\.(sh|tap)$")
163 (("#![[:blank:]]?/bin/sh")
164 (string-append "#!" sh)))
166 ;; Set these variables for all the `configure' runs
167 ;; that occur during the test suite.
169 (setenv "CONFIG_SHELL" sh)))
171 ;; Files like `install-sh', `mdate.sh', etc. must use
172 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
173 ;; in the wild. See <http://bugs.gnu.org/14201> for an
176 'install 'unpatch-shebangs
177 (lambda* (#:key outputs #:allow-other-keys)
178 (let* ((out (assoc-ref outputs "out"))
179 (dir (string-append out "/share")))
180 (define (starts-with-shebang? file)
181 (equal? (call-with-input-file file
183 (list (get-u8 p) (get-u8 p))))
184 (map char->integer '(#\# #\!))))
186 (for-each (lambda (file)
187 (when (and (starts-with-shebang? file)
188 (executable-file? file))
189 (format #t "restoring shebang on `~a'~%"
194 (("^#!.*/bin/env(.*)$" _ args)
195 (string-append "#!/usr/bin/env"
197 (find-files dir ".*"))))
199 (home-page "http://www.gnu.org/software/automake/")
200 (synopsis "Making GNU standards-compliant Makefiles")
202 "GNU Automake is a tool for automatically generating
203 `Makefile.in' files compliant with the GNU Coding
204 Standards. Automake requires the use of Autoconf.")
205 (license gpl2+))) ; some files are under GPLv3+
207 (define-public libtool
213 (uri (string-append "mirror://gnu/libtool/libtool-"
217 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
218 (build-system gnu-build-system)
219 (native-inputs `(("m4" ,m4)
222 ;; Separate binaries from the rest. During bootstrap, only ltdl is
223 ;; used; not depending on the binaries allows us to avoid retaining
224 ;; a reference to the bootstrap bash.
225 (outputs '("bin" ; libtoolize, libtool, etc.
226 "out")) ; libltdl.so, ltdl.h, etc.
229 `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
230 #:phases (alist-cons-before
232 (lambda* (#:key inputs #:allow-other-keys)
233 ;; Run the test suite in parallel, if possible.
236 ((getenv "NIX_BUILD_CORES")
239 (if (zero? (string->number n))
240 (number->string (current-processor-count))
243 (setenv "TESTSUITEFLAGS"
244 (string-append "-j" ncores)))
246 ;; Path references to /bin/sh.
247 (let ((bash (assoc-ref inputs "bash")))
248 (substitute* "tests/testsuite"
250 (string-append bash "/bin/bash")))))
252 (inputs `(("patch/skip-tests"
253 ,(search-patch "libtool-skip-tests.patch"))))
254 (synopsis "Generic shared library support tools")
256 "GNU libtool is a generic library support script. Libtool hides the
257 complexity of using shared libraries behind a consistent, portable interface.
259 To use libtool, add the new generic library building commands to your
260 Makefile, Makefile.in, or Makefile.am. See the documentation for
263 (home-page "http://www.gnu.org/software/libtool/")))