gnu: automake: Use 'modify-phases'.
[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>
706448b1 3;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017 Ludovic Courtès <ludo@gnu.org>
2b00a550 4;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
c6e96280 5;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
fe18e257 6;;; Copyright © 2015, 2017 Mark H Weaver <mhw@netris.org>
6b0686fa 7;;; Copyright © 2016 David Thompson <davet@gnu.org>
dc70626d 8;;; Copyright © 2017 ng0 <ng0@libertad.pw>
08d97842 9;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
80ffc708 10;;;
233e7676 11;;; This file is part of GNU Guix.
80ffc708 12;;;
233e7676 13;;; GNU Guix is free software; you can redistribute it and/or modify it
80ffc708
NK
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
233e7676 18;;; GNU Guix is distributed in the hope that it will be useful, but
80ffc708
NK
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
233e7676 24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
80ffc708 25
1ffa7090 26(define-module (gnu packages autotools)
4a44e743 27 #:use-module (guix licenses)
59a43334 28 #:use-module (gnu packages)
1ffa7090
LC
29 #:use-module (gnu packages perl)
30 #:use-module (gnu packages m4)
98341757 31 #:use-module (gnu packages man)
7cd1d7bd
LC
32 #:use-module (gnu packages bash)
33 #:use-module (guix utils)
80ffc708
NK
34 #:use-module (guix packages)
35 #:use-module (guix download)
7cd1d7bd 36 #:use-module (guix build-system gnu)
c6e96280
MR
37 #:use-module (guix build-system trivial)
38 #:use-module (ice-9 match)
39 #:export (autoconf-wrapper))
80ffc708
NK
40
41(define-public autoconf
42 (package
43 (name "autoconf")
44 (version "2.69")
45 (source
46 (origin
47 (method url-fetch)
48 (uri (string-append "mirror://gnu/autoconf/autoconf-"
49 version ".tar.xz"))
50 (sha256
51 (base32
52 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
53 (build-system gnu-build-system)
a6abac9f 54 (native-inputs
80ffc708
NK
55 `(("perl" ,perl)
56 ("m4" ,m4)))
57 ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
58 ;; should use our own "cpp" instead of "/lib/cpp".
59 (arguments `(#:tests? #f))
60 (home-page
61 "http://www.gnu.org/software/autoconf/")
f50d2669 62 (synopsis "Create source code configuration scripts")
80ffc708 63 (description
a22dc0c4
LC
64 "Autoconf offers the developer a robust set of M4 macros which expand
65into shell code to test the features of Unix-like systems and to adapt
66automatically their software package to these systems. The resulting shell
67scripts are self-contained and portable, freeing the user from needing to
68know anything about Autoconf or M4.")
4a44e743 69 (license gpl3+))) ; some files are under GPLv2+
80ffc708 70
c6e96280
MR
71(define-public autoconf-2.68
72 (package (inherit autoconf)
73 (version "2.68")
74 (source
75 (origin
76 (method url-fetch)
77 (uri (string-append "mirror://gnu/autoconf/autoconf-"
78 version ".tar.xz"))
79 (sha256
80 (base32
81 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
82
2a7050ab
LC
83(define-public autoconf-2.64
84 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
85 (package (inherit autoconf)
86 (version "2.64")
87 (source
88 (origin
89 (method url-fetch)
90 (uri (string-append "mirror://gnu/autoconf/autoconf-"
91 version ".tar.xz"))
92 (sha256
93 (base32
94 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
95
fe18e257
MW
96(define-public autoconf-2.13
97 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
98 (package (inherit autoconf)
99 (version "2.13")
100 (source
101 (origin
102 (method url-fetch)
103 (uri (string-append "mirror://gnu/autoconf/autoconf-"
104 version ".tar.gz"))
105 (sha256
106 (base32
107 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
108 (arguments
109 `(#:tests? #f
110 #:phases
111 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
112 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
113 ;; and pass a simplified set of arguments.
114 (modify-phases %standard-phases
115 (replace 'configure
116 (lambda* (#:key build inputs outputs #:allow-other-keys)
117 (let ((bash (which "bash"))
118 (out (assoc-ref outputs "out")))
119 (setenv "CONFIG_SHELL" bash)
120 (setenv "SHELL" bash)
121 (zero? (system* bash "./configure"
122 (string-append "--prefix=" out)
123 (string-append "--build=" build)))))))))))
124
2a7050ab 125
c6e96280
MR
126(define* (autoconf-wrapper #:optional (autoconf autoconf))
127 "Return an wrapper around AUTOCONF that generates `configure' scripts that
128use our own Bash instead of /bin/sh in shebangs. For that reason, it should
129only be used internally---users should not end up distributing `configure'
130files with a system-specific shebang."
7cd1d7bd 131 (package (inherit autoconf)
7cd1d7bd
LC
132 (name (string-append (package-name autoconf) "-wrapper"))
133 (build-system trivial-build-system)
134 (inputs `(("guile"
168030ea
LC
135 ;; XXX: Kludge to hide the circular dependency.
136 ,(module-ref (resolve-interface '(gnu packages guile))
137 'guile-2.0))
7cd1d7bd
LC
138 ("autoconf" ,autoconf)
139 ("bash" ,bash)))
140 (arguments
141 '(#:modules ((guix build utils))
142 #:builder
143 (begin
144 (use-modules (guix build utils))
145 (let* ((out (assoc-ref %outputs "out"))
146 (bin (string-append out "/bin"))
147 (autoconf (string-append
148 (assoc-ref %build-inputs "autoconf")
149 "/bin/autoconf"))
150 (guile (string-append
151 (assoc-ref %build-inputs "guile")
152 "/bin/guile"))
153 (sh (string-append
154 (assoc-ref %build-inputs "bash")
155 "/bin/sh"))
156 (modules ((compose dirname dirname dirname)
157 (search-path %load-path
158 "guix/build/utils.scm"))))
159 (mkdir-p bin)
160
161 ;; Symlink all the binaries but `autoconf'.
162 (with-directory-excursion bin
163 (for-each (lambda (file)
164 (unless (string=? (basename file) "autoconf")
165 (symlink file (basename file))))
166 (find-files (dirname autoconf) ".*")))
167
168 ;; Add an `autoconf' binary that wraps the real one.
169 (call-with-output-file (string-append bin "/autoconf")
170 (lambda (port)
171 ;; Shamefully, Guile can be used in shebangs only if a
172 ;; single argument is passed (-ds); otherwise it gets
173 ;; them all as a single argument and fails to parse them.
174 (format port "#!~a
175export GUILE_LOAD_PATH=\"~a\"
176export GUILE_LOAD_COMPILED_PATH=\"~a\"
177exec ~a --no-auto-compile \"$0\" \"$@\"
178!#~%"
179 sh modules modules guile)
180 (write
181 `(begin
182 (use-modules (guix build utils))
183 (let ((result (apply system* ,autoconf
184 (cdr (command-line)))))
f11617d8
LC
185 (when (and (file-exists? "configure")
186 (not (file-exists? "/bin/sh")))
187 ;; Patch regardless of RESULT, because `autoconf
188 ;; -Werror' can both create a `configure' file and
189 ;; return a non-zero exit code.
190 (patch-shebang "configure"))
191 (exit (status:exit-val result))))
7cd1d7bd
LC
192 port)))
193 (chmod (string-append bin "/autoconf") #o555)))))))
194
6b0686fa
DT
195(define-public autoconf-archive
196 (package
197 (name "autoconf-archive")
08d97842 198 (version "2017.09.28")
6b0686fa
DT
199 (source
200 (origin
201 (method url-fetch)
202 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
203 version ".tar.xz"))
204 (sha256
205 (base32
08d97842 206 "00gsh9hkrgg291my98plkrwlcpxkfrpq64pglf18kciqbf2bb7sw"))))
6b0686fa 207 (build-system gnu-build-system)
6fd52309 208 (home-page "https://www.gnu.org/software/autoconf-archive/")
6b0686fa
DT
209 (synopsis "Collection of freely reusable Autoconf macros")
210 (description
211 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
212greatly expanding the domain of its functionality. These macros have been
213contributed as free software by the community.")
214 (license gpl3+)))
215
2b00a550
ML
216(define-public autobuild
217 (package
218 (name "autobuild")
219 (version "5.3")
220 (source (origin
221 (method url-fetch)
222 (uri (string-append "mirror://savannah/autobuild/autobuild-"
223 version ".tar.gz"))
224 (sha256
225 (base32
226 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
227 (build-system gnu-build-system)
228 (inputs `(("perl" ,perl)))
229 (synopsis "Process generated build logs")
230 (description "Autobuild is a package that processes build logs generated
231when building software. Autobuild is primarily focused on packages using
232Autoconf and Automake, but can be used with other build systems too.
233Autobuild generates an HTML summary file, containing links to each build log.
234The summary includes project name, version, build hostname, host type (cross
235compile aware), date of build, and indication of success or failure. The
236output is indexed in many ways to simplify browsing.")
237 (home-page "http://josefsson.org/autobuild/")
238 (license gpl3+)))
239
80ffc708 240(define-public automake
706448b1 241 ;; Replace with 'automake/latest' on the next rebuild cycle.
80ffc708
NK
242 (package
243 (name "automake")
aebb05b0 244 (version "1.15")
7cd1d7bd
LC
245 (source (origin
246 (method url-fetch)
247 (uri (string-append "mirror://gnu/automake/automake-"
248 version ".tar.xz"))
249 (sha256
250 (base32
aebb05b0 251 "0dl6vfi2lzz8alnklwxzfz624b95hb1ipjvd3mk177flmddcf24r"))
01eafd38 252 (patches
fc1adab1 253 (search-patches "automake-regexp-syntax.patch"
28206a8e
LC
254 "automake-skip-amhello-tests.patch"
255 "automake-test-gzip-warning.patch"))))
80ffc708 256 (build-system gnu-build-system)
a6abac9f 257 (native-inputs
c6e96280 258 `(("autoconf" ,(autoconf-wrapper))
01eafd38 259 ("perl" ,perl)))
a9db7d10
LC
260 (native-search-paths
261 (list (search-path-specification
262 (variable "ACLOCAL_PATH")
af070955 263 (files '("share/aclocal")))))
7cd1d7bd 264 (arguments
01eafd38 265 '(#:modules ((guix build gnu-build-system)
63b7c6c1
LC
266 (guix build utils)
267 (srfi srfi-1)
268 (srfi srfi-26)
269 (rnrs io ports))
759807e8
EF
270 #:phases
271 (modify-phases %standard-phases
272 (add-before 'patch-source-shebangs 'patch-tests-shebangs
273 (lambda _
274 (let ((sh (which "sh")))
275 (substitute* (find-files "t" "\\.(sh|tap)$")
276 (("#![[:blank:]]?/bin/sh")
277 (string-append "#!" sh)))
7cd1d7bd 278
759807e8
EF
279 ;; Set these variables for all the `configure' runs
280 ;; that occur during the test suite.
281 (setenv "SHELL" sh)
282 (setenv "CONFIG_SHELL" sh)
283 #t)))
9be8d7c8 284
759807e8
EF
285 ;; Files like `install-sh', `mdate.sh', etc. must use
286 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
287 ;; in the wild. See <http://bugs.gnu.org/14201> for an
288 ;; example.
289 (add-after 'install 'unpatch-shebangs
290 (lambda* (#:key outputs #:allow-other-keys)
291 (let* ((out (assoc-ref outputs "out"))
292 (dir (string-append out "/share")))
293 (define (starts-with-shebang? file)
294 (equal? (call-with-input-file file
295 (lambda (p)
296 (list (get-u8 p) (get-u8 p))))
297 (map char->integer '(#\# #\!))))
63b7c6c1 298
759807e8
EF
299 (for-each (lambda (file)
300 (when (and (starts-with-shebang? file)
301 (executable-file? file))
302 (format #t "restoring shebang on `~a'~%"
303 file)
304 (substitute* file
305 (("^#!.*/bin/sh")
306 "#!/bin/sh")
307 (("^#!.*/bin/env(.*)$" _ args)
308 (string-append "#!/usr/bin/env"
309 args)))))
310 (find-files dir ".*"))))))))
6fd52309 311 (home-page "https://www.gnu.org/software/automake/")
f50d2669 312 (synopsis "Making GNU standards-compliant Makefiles")
80ffc708 313 (description
79c311b8
LC
314 "Automake the part of the GNU build system for producing
315standards-compliant Makefiles. Build requirements are entered in an
316intuitive format and then Automake works with Autoconf to produce a robust
317Makefile, simplifying the entire process for the developer.")
7cd1d7bd 318 (license gpl2+))) ; some files are under GPLv3+
36d4d49e 319
706448b1
LC
320
321(define-public automake/latest
322 ;; Merge with 'automake' on the next rebuild cycle.
323 (package
324 (inherit automake)
325 (version "1.15.1")
326 (source (origin
327 (method url-fetch)
328 (uri (string-append "mirror://gnu/automake/automake-"
329 version ".tar.xz"))
330 (sha256
331 (base32
332 "1bzd9g32dfm4rsbw93ld9x7b5nc1y6i4m6zp032qf1i28a8s6sxg"))
333 (patches
334 (search-patches "automake-skip-amhello-tests.patch"))))))
335
36d4d49e
NK
336(define-public libtool
337 (package
338 (name "libtool")
192c6f96 339 (version "2.4.6")
36d4d49e 340 (source (origin
c154e1ea
LC
341 (method url-fetch)
342 (uri (string-append "mirror://gnu/libtool/libtool-"
343 version ".tar.xz"))
344 (sha256
345 (base32
192c6f96 346 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
fc1adab1 347 (patches (search-patches "libtool-skip-tests2.patch"))))
36d4d49e 348 (build-system gnu-build-system)
62c155c0 349 (propagated-inputs `(("m4" ,m4)))
36d4d49e 350 (native-inputs `(("m4" ,m4)
c154e1ea 351 ("perl" ,perl)
98341757 352 ("help2man" ,help2man) ;because we modify ltmain.sh
c154e1ea
LC
353 ("automake" ,automake) ;some tests rely on 'aclocal'
354 ("autoconf" ,(autoconf-wrapper)))) ;others on 'autom4te'
2f8a123e 355
36d4d49e 356 (arguments
3246cc91
LC
357 `(;; Libltdl is provided as a separate package, so don't install it here.
358 #:configure-flags '("--disable-ltdl-install")
359
360 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
361 ;; <http://hydra.gnu.org/build/181662>.
362 #:tests? ,(not (string-prefix? "mips64"
363 (or (%current-target-system)
364 (%current-system))))
c154e1ea 365
dc70626d 366 #:phases
367 (modify-phases %standard-phases
368 (add-before 'check 'pre-check
369 (lambda* (#:key inputs #:allow-other-keys)
370 ;; Run the test suite in parallel, if possible.
371 (setenv "TESTSUITEFLAGS"
372 (string-append
373 "-j"
374 (number->string (parallel-job-count))))
c5862bda 375 ;; Patch references to /bin/sh.
dc70626d 376 (let ((bash (assoc-ref inputs "bash")))
377 (substitute* "tests/testsuite"
378 (("/bin/sh")
78c172a5
LF
379 (string-append bash "/bin/sh")))
380 #t)))
98341757 381 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
382 (lambda* (#:key inputs #:allow-other-keys)
383 (substitute* "build-aux/ltmain.in"
92e77959 384 (("^#!.*/bin/sh$") "#!/bin/sh"))
78c172a5 385 #t)))))
42ff70e2 386
f50d2669 387 (synopsis "Generic shared library support tools")
36d4d49e 388 (description
79c311b8
LC
389 "GNU Libtool helps in the creation and use of shared libraries, by
390presenting a single consistent, portable interface that hides the usual
391complexity of working with shared libraries across platforms.")
4a44e743 392 (license gpl3+)
6fd52309 393 (home-page "https://www.gnu.org/software/libtool/")))
e13f715b 394
3cbb3f9c
LC
395(define-public libltdl
396 ;; This is a libltdl package separate from the libtool package. This is
397 ;; useful because, unlike libtool, it has zero extra dependencies (making it
398 ;; readily usable during bootstrap), and it builds very quickly since
399 ;; Libtool's extensive test suite isn't run.
400 (package
401 (name "libltdl")
192c6f96 402 (version "2.4.6")
a101c891
LC
403 (source (origin
404 (method url-fetch)
405 (uri (string-append "mirror://gnu/libtool/libtool-"
406 version ".tar.xz"))
407 (sha256
408 (base32
ef593a10 409 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
3cbb3f9c
LC
410 (build-system gnu-build-system)
411 (arguments
412 '(#:configure-flags '("--enable-ltdl-install") ;really install it
413 #:phases (alist-cons-before
414 'configure 'change-directory
415 (lambda _
416 (chdir "libltdl"))
417 %standard-phases)))
418
419 (synopsis "System-independent dlopen wrapper of GNU libtool")
420 (description (package-description libtool))
421 (home-page (package-home-page libtool))
422 (license lgpl2.1+)))