1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages autotools)
22 #:use-module (guix licenses)
23 #:use-module (gnu packages)
24 #:use-module (gnu packages perl)
25 #:use-module (gnu packages m4)
26 #:use-module (gnu packages bash)
27 #:use-module (guix utils)
28 #:use-module (guix packages)
29 #:use-module (guix download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system trivial)
32 #:use-module (ice-9 match)
33 #:export (autoconf-wrapper))
35 (define-public autoconf
42 (uri (string-append "mirror://gnu/autoconf/autoconf-"
46 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
47 (build-system gnu-build-system)
51 ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
52 ;; should use our own "cpp" instead of "/lib/cpp".
53 (arguments `(#:tests? #f))
55 "http://www.gnu.org/software/autoconf/")
56 (synopsis "Create source code configuration scripts")
58 "Autoconf offers the developer a robust set of M4 macros which expand
59 into shell code to test the features of Unix-like systems and to adapt
60 automatically their software package to these systems. The resulting shell
61 scripts are self-contained and portable, freeing the user from needing to
62 know anything about Autoconf or M4.")
63 (license gpl3+))) ; some files are under GPLv2+
65 (define-public autoconf-2.68
66 (package (inherit autoconf)
71 (uri (string-append "mirror://gnu/autoconf/autoconf-"
75 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
77 (define-public autoconf-2.64
78 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
79 (package (inherit autoconf)
84 (uri (string-append "mirror://gnu/autoconf/autoconf-"
88 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
91 (define* (autoconf-wrapper #:optional (autoconf autoconf))
92 "Return an wrapper around AUTOCONF that generates `configure' scripts that
93 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
94 only be used internally---users should not end up distributing `configure'
95 files with a system-specific shebang."
96 (package (inherit autoconf)
97 (location (source-properties->location (current-source-location)))
98 (name (string-append (package-name autoconf) "-wrapper"))
99 (build-system trivial-build-system)
101 ;; XXX: Kludge to hide the circular dependency.
102 ,(module-ref (resolve-interface '(gnu packages guile))
104 ("autoconf" ,autoconf)
107 '(#:modules ((guix build utils))
110 (use-modules (guix build utils))
111 (let* ((out (assoc-ref %outputs "out"))
112 (bin (string-append out "/bin"))
113 (autoconf (string-append
114 (assoc-ref %build-inputs "autoconf")
116 (guile (string-append
117 (assoc-ref %build-inputs "guile")
120 (assoc-ref %build-inputs "bash")
122 (modules ((compose dirname dirname dirname)
123 (search-path %load-path
124 "guix/build/utils.scm"))))
127 ;; Symlink all the binaries but `autoconf'.
128 (with-directory-excursion bin
129 (for-each (lambda (file)
130 (unless (string=? (basename file) "autoconf")
131 (symlink file (basename file))))
132 (find-files (dirname autoconf) ".*")))
134 ;; Add an `autoconf' binary that wraps the real one.
135 (call-with-output-file (string-append bin "/autoconf")
137 ;; Shamefully, Guile can be used in shebangs only if a
138 ;; single argument is passed (-ds); otherwise it gets
139 ;; them all as a single argument and fails to parse them.
141 export GUILE_LOAD_PATH=\"~a\"
142 export GUILE_LOAD_COMPILED_PATH=\"~a\"
143 exec ~a --no-auto-compile \"$0\" \"$@\"
145 sh modules modules guile)
148 (use-modules (guix build utils))
149 (let ((result (apply system* ,autoconf
150 (cdr (command-line)))))
151 (when (and (file-exists? "configure")
152 (not (file-exists? "/bin/sh")))
153 ;; Patch regardless of RESULT, because `autoconf
154 ;; -Werror' can both create a `configure' file and
155 ;; return a non-zero exit code.
156 (patch-shebang "configure"))
157 (exit (status:exit-val result))))
159 (chmod (string-append bin "/autoconf") #o555)))))))
161 (define-public automake
167 (uri (string-append "mirror://gnu/automake/automake-"
171 "0s86rzdayj1licgj35q0mnynv5xa8f4p32m36blc5jk9id5z1d59"))
173 (list (search-patch "automake-skip-amhello-tests.patch")))))
174 (build-system gnu-build-system)
176 `(("autoconf" ,(autoconf-wrapper))
179 (list (search-path-specification
180 (variable "ACLOCAL_PATH")
181 (directories '("share/aclocal")))))
183 '(#:modules ((guix build gnu-build-system)
188 #:phases (alist-cons-before
189 'patch-source-shebangs 'patch-tests-shebangs
191 (let ((sh (which "sh")))
192 (substitute* (find-files "t" "\\.(sh|tap)$")
193 (("#![[:blank:]]?/bin/sh")
194 (string-append "#!" sh)))
196 ;; Set these variables for all the `configure' runs
197 ;; that occur during the test suite.
199 (setenv "CONFIG_SHELL" sh)))
201 ;; Files like `install-sh', `mdate.sh', etc. must use
202 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
203 ;; in the wild. See <http://bugs.gnu.org/14201> for an
206 'install 'unpatch-shebangs
207 (lambda* (#:key outputs #:allow-other-keys)
208 (let* ((out (assoc-ref outputs "out"))
209 (dir (string-append out "/share")))
210 (define (starts-with-shebang? file)
211 (equal? (call-with-input-file file
213 (list (get-u8 p) (get-u8 p))))
214 (map char->integer '(#\# #\!))))
216 (for-each (lambda (file)
217 (when (and (starts-with-shebang? file)
218 (executable-file? file))
219 (format #t "restoring shebang on `~a'~%"
224 (("^#!.*/bin/env(.*)$" _ args)
225 (string-append "#!/usr/bin/env"
227 (find-files dir ".*"))))
229 (home-page "http://www.gnu.org/software/automake/")
230 (synopsis "Making GNU standards-compliant Makefiles")
232 "Automake the part of the GNU build system for producing
233 standards-compliant Makefiles. Build requirements are entered in an
234 intuitive format and then Automake works with Autoconf to produce a robust
235 Makefile, simplifying the entire process for the developer.")
236 (license gpl2+))) ; some files are under GPLv3+
238 (define-public libtool
244 (uri (string-append "mirror://gnu/libtool/libtool-"
248 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))
250 (list (search-patch "libtool-skip-tests.patch")
251 (search-patch "libtool-skip-tests-for-mips.patch")))))
252 (build-system gnu-build-system)
253 (native-inputs `(("m4" ,m4)
256 ;; Separate binaries from the rest. During bootstrap, only ltdl is
257 ;; used; not depending on the binaries allows us to avoid retaining
258 ;; a reference to the bootstrap bash.
259 (outputs '("bin" ; libtoolize, libtool, etc.
260 "out")) ; libltdl.so, ltdl.h, etc.
263 (if (%current-target-system)
264 '() ; no `check' phase when cross-building
265 '(#:phases (alist-cons-before
267 (lambda* (#:key inputs #:allow-other-keys)
268 ;; Run the test suite in parallel, if possible.
271 ((getenv "NIX_BUILD_CORES")
274 (if (zero? (string->number n))
275 (number->string (current-processor-count))
278 (setenv "TESTSUITEFLAGS"
279 (string-append "-j" ncores)))
281 ;; Path references to /bin/sh.
282 (let ((bash (assoc-ref inputs "bash")))
283 (substitute* "tests/testsuite"
285 (string-append bash "/bin/bash")))))
287 (synopsis "Generic shared library support tools")
289 "GNU Libtool helps in the creation and use of shared libraries, by
290 presenting a single consistent, portable interface that hides the usual
291 complexity of working with shared libraries across platforms.")
293 (home-page "http://www.gnu.org/software/libtool/")))