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 "Autoconf offers the developer a robust set of M4 macros which expand
56 into shell code to test the features of Unix-like systems and to adapt
57 automatically their software package to these systems. The resulting shell
58 scripts are self-contained and portable, freeing the user from needing to
59 know anything about Autoconf or M4.")
60 (license gpl3+))) ; some files are under GPLv2+
62 (define-public autoconf-wrapper
63 ;; An Autoconf wrapper that generates `configure' scripts that use our
64 ;; own Bash instead of /bin/sh in shebangs. For that reason, it
65 ;; should only be used internally---users should not end up
66 ;; distributing `configure' files with a system-specific shebang.
67 (package (inherit autoconf)
68 (location (source-properties->location (current-source-location)))
69 (name (string-append (package-name autoconf) "-wrapper"))
70 (build-system trivial-build-system)
72 ;; XXX: Kludge to hide the circular dependency.
73 ,(module-ref (resolve-interface '(gnu packages guile))
75 ("autoconf" ,autoconf)
78 '(#:modules ((guix build utils))
81 (use-modules (guix build utils))
82 (let* ((out (assoc-ref %outputs "out"))
83 (bin (string-append out "/bin"))
84 (autoconf (string-append
85 (assoc-ref %build-inputs "autoconf")
88 (assoc-ref %build-inputs "guile")
91 (assoc-ref %build-inputs "bash")
93 (modules ((compose dirname dirname dirname)
94 (search-path %load-path
95 "guix/build/utils.scm"))))
98 ;; Symlink all the binaries but `autoconf'.
99 (with-directory-excursion bin
100 (for-each (lambda (file)
101 (unless (string=? (basename file) "autoconf")
102 (symlink file (basename file))))
103 (find-files (dirname autoconf) ".*")))
105 ;; Add an `autoconf' binary that wraps the real one.
106 (call-with-output-file (string-append bin "/autoconf")
108 ;; Shamefully, Guile can be used in shebangs only if a
109 ;; single argument is passed (-ds); otherwise it gets
110 ;; them all as a single argument and fails to parse them.
112 export GUILE_LOAD_PATH=\"~a\"
113 export GUILE_LOAD_COMPILED_PATH=\"~a\"
114 exec ~a --no-auto-compile \"$0\" \"$@\"
116 sh modules modules guile)
119 (use-modules (guix build utils))
120 (let ((result (apply system* ,autoconf
121 (cdr (command-line)))))
122 (when (and (file-exists? "configure")
123 (not (file-exists? "/bin/sh")))
124 ;; Patch regardless of RESULT, because `autoconf
125 ;; -Werror' can both create a `configure' file and
126 ;; return a non-zero exit code.
127 (patch-shebang "configure"))
128 (exit (status:exit-val result))))
130 (chmod (string-append bin "/autoconf") #o555)))))))
132 (define-public automake
138 (uri (string-append "mirror://gnu/automake/automake-"
142 "0s86rzdayj1licgj35q0mnynv5xa8f4p32m36blc5jk9id5z1d59"))
144 (list (search-patch "automake-skip-amhello-tests.patch")))))
145 (build-system gnu-build-system)
147 `(("autoconf" ,autoconf-wrapper)
150 (list (search-path-specification
151 (variable "ACLOCAL_PATH")
152 (directories '("share/aclocal")))))
154 '(#:modules ((guix build gnu-build-system)
159 #:phases (alist-cons-before
160 'patch-source-shebangs 'patch-tests-shebangs
162 (let ((sh (which "sh")))
163 (substitute* (find-files "t" "\\.(sh|tap)$")
164 (("#![[:blank:]]?/bin/sh")
165 (string-append "#!" sh)))
167 ;; Set these variables for all the `configure' runs
168 ;; that occur during the test suite.
170 (setenv "CONFIG_SHELL" sh)))
172 ;; Files like `install-sh', `mdate.sh', etc. must use
173 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
174 ;; in the wild. See <http://bugs.gnu.org/14201> for an
177 'install 'unpatch-shebangs
178 (lambda* (#:key outputs #:allow-other-keys)
179 (let* ((out (assoc-ref outputs "out"))
180 (dir (string-append out "/share")))
181 (define (starts-with-shebang? file)
182 (equal? (call-with-input-file file
184 (list (get-u8 p) (get-u8 p))))
185 (map char->integer '(#\# #\!))))
187 (for-each (lambda (file)
188 (when (and (starts-with-shebang? file)
189 (executable-file? file))
190 (format #t "restoring shebang on `~a'~%"
195 (("^#!.*/bin/env(.*)$" _ args)
196 (string-append "#!/usr/bin/env"
198 (find-files dir ".*"))))
200 (home-page "http://www.gnu.org/software/automake/")
201 (synopsis "Making GNU standards-compliant Makefiles")
203 "Automake the part of the GNU build system for producing
204 standards-compliant Makefiles. Build requirements are entered in an
205 intuitive format and then Automake works with Autoconf to produce a robust
206 Makefile, simplifying the entire process for the developer.")
207 (license gpl2+))) ; some files are under GPLv3+
209 (define-public libtool
215 (uri (string-append "mirror://gnu/libtool/libtool-"
219 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))
221 (list (search-patch "libtool-skip-tests.patch")
222 (search-patch "libtool-skip-tests-for-mips.patch")))))
223 (build-system gnu-build-system)
224 (native-inputs `(("m4" ,m4)
227 ;; Separate binaries from the rest. During bootstrap, only ltdl is
228 ;; used; not depending on the binaries allows us to avoid retaining
229 ;; a reference to the bootstrap bash.
230 (outputs '("bin" ; libtoolize, libtool, etc.
231 "out")) ; libltdl.so, ltdl.h, etc.
234 (if (%current-target-system)
235 '() ; no `check' phase when cross-building
236 '(#:phases (alist-cons-before
238 (lambda* (#:key inputs #:allow-other-keys)
239 ;; Run the test suite in parallel, if possible.
242 ((getenv "NIX_BUILD_CORES")
245 (if (zero? (string->number n))
246 (number->string (current-processor-count))
249 (setenv "TESTSUITEFLAGS"
250 (string-append "-j" ncores)))
252 ;; Path references to /bin/sh.
253 (let ((bash (assoc-ref inputs "bash")))
254 (substitute* "tests/testsuite"
256 (string-append bash "/bin/bash")))))
258 (synopsis "Generic shared library support tools")
260 "GNU Libtool helps in the creation and use of shared libraries, by
261 presenting a single consistent, portable interface that hides the usual
262 complexity of working with shared libraries across platforms.")
264 (home-page "http://www.gnu.org/software/libtool/")))