utils: Add `fold2'.
[jackhill/guix/guix.git] / gnu / packages / autotools.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
4050e5d6 3;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
80ffc708 4;;;
233e7676 5;;; This file is part of GNU Guix.
80ffc708 6;;;
233e7676 7;;; GNU Guix is free software; you can redistribute it and/or modify it
80ffc708
NK
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.
11;;;
233e7676 12;;; GNU Guix is distributed in the hope that it will be useful, but
80ffc708
NK
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.
16;;;
17;;; You should have received a copy of the GNU General Public License
233e7676 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
80ffc708 19
1ffa7090 20(define-module (gnu packages autotools)
4a44e743 21 #:use-module (guix licenses)
59a43334 22 #:use-module (gnu packages)
1ffa7090
LC
23 #:use-module (gnu packages perl)
24 #:use-module (gnu packages m4)
7cd1d7bd
LC
25 #:use-module (gnu packages bash)
26 #:use-module (guix utils)
80ffc708
NK
27 #:use-module (guix packages)
28 #:use-module (guix download)
7cd1d7bd
LC
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial))
80ffc708
NK
31
32(define-public autoconf
33 (package
34 (name "autoconf")
35 (version "2.69")
36 (source
37 (origin
38 (method url-fetch)
39 (uri (string-append "mirror://gnu/autoconf/autoconf-"
40 version ".tar.xz"))
41 (sha256
42 (base32
43 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
44 (build-system gnu-build-system)
45 (inputs
46 `(("perl" ,perl)
47 ("m4" ,m4)))
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))
51 (home-page
52 "http://www.gnu.org/software/autoconf/")
53 (synopsis
54 "GNU Autoconf, a part of the GNU Build System")
55 (description
56 "GNU Autoconf is an extensible package of M4 macros that produce
57shell scripts to automatically configure software source code
58packages. These scripts can adapt the packages to many kinds of
59UNIX-like systems without manual user intervention. Autoconf
60creates a configuration script for a package from a template
61file that lists the operating system features that the package
62can use, in the form of M4 macro calls.")
4a44e743 63 (license gpl3+))) ; some files are under GPLv2+
80ffc708 64
72b9eebf 65(define-public autoconf-wrapper
7cd1d7bd
LC
66 ;; An Autoconf wrapper that generates `configure' scripts that use our
67 ;; own Bash instead of /bin/sh in shebangs. For that reason, it
68 ;; should only be used internally---users should not end up
69 ;; distributing `configure' files with a system-specific shebang.
70 (package (inherit autoconf)
71 (location (source-properties->location (current-source-location)))
72 (name (string-append (package-name autoconf) "-wrapper"))
73 (build-system trivial-build-system)
74 (inputs `(("guile"
168030ea
LC
75 ;; XXX: Kludge to hide the circular dependency.
76 ,(module-ref (resolve-interface '(gnu packages guile))
77 'guile-2.0))
7cd1d7bd
LC
78 ("autoconf" ,autoconf)
79 ("bash" ,bash)))
80 (arguments
81 '(#:modules ((guix build utils))
82 #:builder
83 (begin
84 (use-modules (guix build utils))
85 (let* ((out (assoc-ref %outputs "out"))
86 (bin (string-append out "/bin"))
87 (autoconf (string-append
88 (assoc-ref %build-inputs "autoconf")
89 "/bin/autoconf"))
90 (guile (string-append
91 (assoc-ref %build-inputs "guile")
92 "/bin/guile"))
93 (sh (string-append
94 (assoc-ref %build-inputs "bash")
95 "/bin/sh"))
96 (modules ((compose dirname dirname dirname)
97 (search-path %load-path
98 "guix/build/utils.scm"))))
99 (mkdir-p bin)
100
101 ;; Symlink all the binaries but `autoconf'.
102 (with-directory-excursion bin
103 (for-each (lambda (file)
104 (unless (string=? (basename file) "autoconf")
105 (symlink file (basename file))))
106 (find-files (dirname autoconf) ".*")))
107
108 ;; Add an `autoconf' binary that wraps the real one.
109 (call-with-output-file (string-append bin "/autoconf")
110 (lambda (port)
111 ;; Shamefully, Guile can be used in shebangs only if a
112 ;; single argument is passed (-ds); otherwise it gets
113 ;; them all as a single argument and fails to parse them.
114 (format port "#!~a
115export GUILE_LOAD_PATH=\"~a\"
116export GUILE_LOAD_COMPILED_PATH=\"~a\"
117exec ~a --no-auto-compile \"$0\" \"$@\"
118!#~%"
119 sh modules modules guile)
120 (write
121 `(begin
122 (use-modules (guix build utils))
123 (let ((result (apply system* ,autoconf
124 (cdr (command-line)))))
125 (if (and (zero? result)
126 (file-exists? "configure")
127 (not (file-exists? "/bin/sh")))
128 (begin
129 (patch-shebang "configure")
130 #t)
131 (exit (status:exit-val result)))))
132 port)))
133 (chmod (string-append bin "/autoconf") #o555)))))))
134
80ffc708
NK
135(define-public automake
136 (package
137 (name "automake")
c9ee0485 138 (version "1.13.1")
7cd1d7bd
LC
139 (source (origin
140 (method url-fetch)
141 (uri (string-append "mirror://gnu/automake/automake-"
142 version ".tar.xz"))
143 (sha256
144 (base32
c9ee0485 145 "12yi1bzkipi7qdmkdy77pazljsa9z7q66hi6c4rq73p7hbv6rkbf"))))
80ffc708
NK
146 (build-system gnu-build-system)
147 (inputs
7cd1d7bd
LC
148 `(("autoconf" ,autoconf-wrapper)
149 ("perl" ,perl)
150 ("patch/skip-amhello"
151 ,(search-patch "automake-skip-amhello-tests.patch"))))
152 (arguments
153 '(#:patches (list (assoc-ref %build-inputs "patch/skip-amhello"))
154 #:phases (alist-cons-before
155 'patch-source-shebangs 'patch-tests-shebangs
156 (lambda _
157 (let ((sh (which "sh")))
158 (substitute* (find-files "t" "\\.(sh|tap)$")
159 (("#![[:blank:]]?/bin/sh")
160 (string-append "#!" sh)))
161
162 ;; Set these variables for all the `configure' runs
163 ;; that occur during the test suite.
164 (setenv "SHELL" sh)
165 (setenv "CONFIG_SHELL" sh)))
166 %standard-phases)))
167 (home-page "http://www.gnu.org/software/automake/")
80ffc708
NK
168 (synopsis
169 "GNU Automake, a GNU standard-compliant makefile generator")
170 (description
171 "GNU Automake is a tool for automatically generating
172`Makefile.in' files compliant with the GNU Coding
173Standards. Automake requires the use of Autoconf.")
7cd1d7bd 174 (license gpl2+))) ; some files are under GPLv3+
36d4d49e
NK
175
176(define-public libtool
177 (package
178 (name "libtool")
179 (version "2.4.2")
180 (source (origin
181 (method url-fetch)
182 (uri (string-append "mirror://gnu/libtool/libtool-"
183 version ".tar.gz"))
184 (sha256
185 (base32
186 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
187 (build-system gnu-build-system)
188 (native-inputs `(("m4" ,m4)
189 ("perl" ,perl)))
2f8a123e
LC
190
191 ;; Separate binaries from the rest. During bootstrap, only ltdl is
192 ;; used; not depending on the binaries allows us to avoid retaining
193 ;; a reference to the bootstrap bash.
194 (outputs '("bin" ; libtoolize, libtool, etc.
195 "out")) ; libltdl.so, ltdl.h, etc.
196
36d4d49e 197 (arguments
42ff70e2
LC
198 `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
199 #:phases (alist-cons-before
200 'check 'pre-check
201 (lambda* (#:key inputs #:allow-other-keys)
202 ;; Run the test suite in parallel, if possible.
203 (let ((ncores
204 (cond
205 ((getenv "NIX_BUILD_CORES")
206 =>
207 (lambda (n)
208 (if (zero? (string->number n))
209 (number->string (current-processor-count))
210 n)))
211 (else "1"))))
212 (setenv "TESTSUITEFLAGS"
213 (string-append "-j" ncores)))
214
215 ;; Path references to /bin/sh.
42ff70e2
LC
216 (let ((bash (assoc-ref inputs "bash")))
217 (substitute* "tests/testsuite"
218 (("/bin/sh")
219 (string-append bash "/bin/bash")))))
220 %standard-phases)))
36d4d49e
NK
221 (inputs `(("patch/skip-tests"
222 ,(search-patch "libtool-skip-tests.patch"))))
223 (synopsis "GNU Libtool, a generic library support script")
224 (description
225 "GNU libtool is a generic library support script. Libtool hides the
226complexity of using shared libraries behind a consistent, portable interface.
227
228To use libtool, add the new generic library building commands to your
229Makefile, Makefile.in, or Makefile.am. See the documentation for
230details.")
4a44e743 231 (license gpl3+)
36d4d49e 232 (home-page "http://www.gnu.org/software/libtool/")))