Merge remote-tracking branch 'origin/master' into core-updates
[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>
c1463145 8;;; Copyright © 2017 ng0 <ng0@infotropique.org>
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
NK
240(define-public automake
241 (package
242 (name "automake")
01c7193e 243 (version "1.15.1")
7cd1d7bd
LC
244 (source (origin
245 (method url-fetch)
246 (uri (string-append "mirror://gnu/automake/automake-"
247 version ".tar.xz"))
248 (sha256
249 (base32
01c7193e 250 "1bzd9g32dfm4rsbw93ld9x7b5nc1y6i4m6zp032qf1i28a8s6sxg"))
01eafd38 251 (patches
01c7193e 252 (search-patches "automake-skip-amhello-tests.patch"))))
80ffc708 253 (build-system gnu-build-system)
a6abac9f 254 (native-inputs
c6e96280 255 `(("autoconf" ,(autoconf-wrapper))
01eafd38 256 ("perl" ,perl)))
a9db7d10
LC
257 (native-search-paths
258 (list (search-path-specification
259 (variable "ACLOCAL_PATH")
af070955 260 (files '("share/aclocal")))))
7cd1d7bd 261 (arguments
01eafd38 262 '(#:modules ((guix build gnu-build-system)
63b7c6c1
LC
263 (guix build utils)
264 (srfi srfi-1)
265 (srfi srfi-26)
266 (rnrs io ports))
759807e8
EF
267 #:phases
268 (modify-phases %standard-phases
269 (add-before 'patch-source-shebangs 'patch-tests-shebangs
270 (lambda _
271 (let ((sh (which "sh")))
272 (substitute* (find-files "t" "\\.(sh|tap)$")
273 (("#![[:blank:]]?/bin/sh")
274 (string-append "#!" sh)))
7cd1d7bd 275
759807e8
EF
276 ;; Set these variables for all the `configure' runs
277 ;; that occur during the test suite.
278 (setenv "SHELL" sh)
279 (setenv "CONFIG_SHELL" sh)
280 #t)))
9be8d7c8 281
759807e8
EF
282 ;; Files like `install-sh', `mdate.sh', etc. must use
283 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
284 ;; in the wild. See <http://bugs.gnu.org/14201> for an
285 ;; example.
286 (add-after 'install 'unpatch-shebangs
287 (lambda* (#:key outputs #:allow-other-keys)
288 (let* ((out (assoc-ref outputs "out"))
289 (dir (string-append out "/share")))
290 (define (starts-with-shebang? file)
291 (equal? (call-with-input-file file
292 (lambda (p)
293 (list (get-u8 p) (get-u8 p))))
294 (map char->integer '(#\# #\!))))
63b7c6c1 295
759807e8
EF
296 (for-each (lambda (file)
297 (when (and (starts-with-shebang? file)
298 (executable-file? file))
299 (format #t "restoring shebang on `~a'~%"
300 file)
301 (substitute* file
302 (("^#!.*/bin/sh")
303 "#!/bin/sh")
304 (("^#!.*/bin/env(.*)$" _ args)
305 (string-append "#!/usr/bin/env"
306 args)))))
307 (find-files dir ".*"))))))))
6fd52309 308 (home-page "https://www.gnu.org/software/automake/")
f50d2669 309 (synopsis "Making GNU standards-compliant Makefiles")
80ffc708 310 (description
79c311b8
LC
311 "Automake the part of the GNU build system for producing
312standards-compliant Makefiles. Build requirements are entered in an
313intuitive format and then Automake works with Autoconf to produce a robust
314Makefile, simplifying the entire process for the developer.")
7cd1d7bd 315 (license gpl2+))) ; some files are under GPLv3+
36d4d49e
NK
316
317(define-public libtool
318 (package
319 (name "libtool")
192c6f96 320 (version "2.4.6")
36d4d49e 321 (source (origin
c154e1ea
LC
322 (method url-fetch)
323 (uri (string-append "mirror://gnu/libtool/libtool-"
324 version ".tar.xz"))
325 (sha256
326 (base32
192c6f96 327 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
fc1adab1 328 (patches (search-patches "libtool-skip-tests2.patch"))))
36d4d49e 329 (build-system gnu-build-system)
62c155c0 330 (propagated-inputs `(("m4" ,m4)))
36d4d49e 331 (native-inputs `(("m4" ,m4)
c154e1ea 332 ("perl" ,perl)
98341757 333 ("help2man" ,help2man) ;because we modify ltmain.sh
c154e1ea
LC
334 ("automake" ,automake) ;some tests rely on 'aclocal'
335 ("autoconf" ,(autoconf-wrapper)))) ;others on 'autom4te'
2f8a123e 336
36d4d49e 337 (arguments
3246cc91
LC
338 `(;; Libltdl is provided as a separate package, so don't install it here.
339 #:configure-flags '("--disable-ltdl-install")
340
341 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
342 ;; <http://hydra.gnu.org/build/181662>.
343 #:tests? ,(not (string-prefix? "mips64"
344 (or (%current-target-system)
345 (%current-system))))
c154e1ea 346
dc70626d 347 #:phases
348 (modify-phases %standard-phases
349 (add-before 'check 'pre-check
350 (lambda* (#:key inputs #:allow-other-keys)
351 ;; Run the test suite in parallel, if possible.
352 (setenv "TESTSUITEFLAGS"
353 (string-append
354 "-j"
355 (number->string (parallel-job-count))))
c5862bda 356 ;; Patch references to /bin/sh.
dc70626d 357 (let ((bash (assoc-ref inputs "bash")))
358 (substitute* "tests/testsuite"
359 (("/bin/sh")
78c172a5
LF
360 (string-append bash "/bin/sh")))
361 #t)))
98341757 362 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
363 (lambda* (#:key inputs #:allow-other-keys)
364 (substitute* "build-aux/ltmain.in"
92e77959 365 (("^#!.*/bin/sh$") "#!/bin/sh"))
78c172a5 366 #t)))))
42ff70e2 367
f50d2669 368 (synopsis "Generic shared library support tools")
36d4d49e 369 (description
79c311b8
LC
370 "GNU Libtool helps in the creation and use of shared libraries, by
371presenting a single consistent, portable interface that hides the usual
372complexity of working with shared libraries across platforms.")
4a44e743 373 (license gpl3+)
6fd52309 374 (home-page "https://www.gnu.org/software/libtool/")))
e13f715b 375
3cbb3f9c
LC
376(define-public libltdl
377 ;; This is a libltdl package separate from the libtool package. This is
378 ;; useful because, unlike libtool, it has zero extra dependencies (making it
379 ;; readily usable during bootstrap), and it builds very quickly since
380 ;; Libtool's extensive test suite isn't run.
381 (package
382 (name "libltdl")
192c6f96 383 (version "2.4.6")
a101c891
LC
384 (source (origin
385 (method url-fetch)
386 (uri (string-append "mirror://gnu/libtool/libtool-"
387 version ".tar.xz"))
388 (sha256
389 (base32
ef593a10 390 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
3cbb3f9c
LC
391 (build-system gnu-build-system)
392 (arguments
393 '(#:configure-flags '("--enable-ltdl-install") ;really install it
8c88e0ba
EF
394 #:phases (modify-phases %standard-phases
395 (add-before 'configure 'change-directory
396 (lambda _ (chdir "libltdl") #t)))))
3cbb3f9c
LC
397
398 (synopsis "System-independent dlopen wrapper of GNU libtool")
399 (description (package-description libtool))
400 (home-page (package-home-page libtool))
401 (license lgpl2.1+)))