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