gnu: facter: Update to 4.0.34.
[jackhill/guix/guix.git] / gnu / packages / autotools.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3 ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
4 ;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
5 ;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
6 ;;; Copyright © 2015, 2017, 2018 Mark H Weaver <mhw@netris.org>
7 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
8 ;;; Copyright © 2017 Nikita <nikita@n0.is>
9 ;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
10 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
11 ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
12 ;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
13 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
14 ;;;
15 ;;; This file is part of GNU Guix.
16 ;;;
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
21 ;;;
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
26 ;;;
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
29
30 (define-module (gnu packages autotools)
31 #:use-module (guix licenses)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages m4)
36 #:use-module (gnu packages man)
37 #:use-module (gnu packages bash)
38 #:use-module (guix utils)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system trivial)
43 #:use-module (ice-9 match)
44 #:export (autoconf-wrapper))
45
46 (define-public autoconf
47 (package
48 (name "autoconf")
49 (version "2.69")
50 (source
51 (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/autoconf/autoconf-"
54 version ".tar.xz"))
55 (sha256
56 (base32
57 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
58 (build-system gnu-build-system)
59 (inputs
60 ;; TODO: remove `if' in the next rebuild cycle.
61 (if (%current-target-system)
62 `(("bash" ,bash-minimal)
63 ("perl" ,perl)
64 ("m4" ,m4))
65 '()))
66 (native-inputs
67 `(("perl" ,perl)
68 ("m4" ,m4)))
69 (arguments
70 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
71 ;; should use our own "cpp" instead of "/lib/cpp".
72 #:tests? #f
73 ,@(if (%current-target-system)
74 `(#:phases
75 (modify-phases %standard-phases
76 (add-after 'install 'patch-non-shebang-references
77 (lambda* (#:key build inputs outputs #:allow-other-keys)
78 ;; `patch-shebangs' patches shebangs only, and the Perl
79 ;; scripts use a re-exec feature that references the
80 ;; build hosts' perl. Also, BASH and M4 store references
81 ;; hide in the scripts.
82 (let ((bash (assoc-ref inputs "bash"))
83 (m4 (assoc-ref inputs "m4"))
84 (perl (assoc-ref inputs "perl"))
85 (out (assoc-ref outputs "out"))
86 (store-directory (%store-directory)))
87 (substitute* (find-files (string-append out "/bin"))
88 (((string-append store-directory "/[^/]*-bash-[^/]*"))
89 bash)
90 (((string-append store-directory "/[^/]*-m4-[^/]*"))
91 m4)
92 (((string-append store-directory "/[^/]*-perl-[^/]*"))
93 perl))
94 #t)))))
95 '())))
96 (home-page "https://www.gnu.org/software/autoconf/")
97 (synopsis "Create source code configuration scripts")
98 (description
99 "Autoconf offers the developer a robust set of M4 macros which expand
100 into shell code to test the features of Unix-like systems and to adapt
101 automatically their software package to these systems. The resulting shell
102 scripts are self-contained and portable, freeing the user from needing to
103 know anything about Autoconf or M4.")
104 (license gpl3+))) ; some files are under GPLv2+
105
106 (define-public autoconf-2.68
107 (package (inherit autoconf)
108 (version "2.68")
109 (source
110 (origin
111 (method url-fetch)
112 (uri (string-append "mirror://gnu/autoconf/autoconf-"
113 version ".tar.xz"))
114 (sha256
115 (base32
116 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
117
118 (define-public autoconf-2.64
119 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
120 (package (inherit autoconf)
121 (version "2.64")
122 (source
123 (origin
124 (method url-fetch)
125 (uri (string-append "mirror://gnu/autoconf/autoconf-"
126 version ".tar.xz"))
127 (sha256
128 (base32
129 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
130
131 (define-public autoconf-2.13
132 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
133 (package (inherit autoconf)
134 (version "2.13")
135 (source
136 (origin
137 (method url-fetch)
138 (uri (string-append "mirror://gnu/autoconf/autoconf-"
139 version ".tar.gz"))
140 (sha256
141 (base32
142 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
143 (arguments
144 `(#:tests? #f
145 #:phases
146 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
147 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
148 ;; and pass a simplified set of arguments.
149 (modify-phases %standard-phases
150 (replace 'configure
151 (lambda* (#:key build inputs outputs #:allow-other-keys)
152 (let ((bash (which "bash"))
153 (out (assoc-ref outputs "out")))
154 (setenv "CONFIG_SHELL" bash)
155 (setenv "SHELL" bash)
156 (invoke bash "./configure"
157 (string-append "--prefix=" out)
158 (string-append "--build=" build))))))))))
159
160
161 (define (make-autoconf-wrapper autoconf)
162 "Return a wrapper around AUTOCONF that generates `configure' scripts that
163 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
164 only be used internally---users should not end up distributing `configure'
165 files with a system-specific shebang."
166 (package (inherit autoconf)
167 (name (string-append (package-name autoconf) "-wrapper"))
168 (build-system trivial-build-system)
169 (inputs `(("guile"
170 ;; XXX: Kludge to hide the circular dependency.
171 ,(module-ref (resolve-interface '(gnu packages guile))
172 'guile-2.0))
173 ("autoconf" ,autoconf)
174 ("bash" ,bash)))
175 (arguments
176 '(#:modules ((guix build utils))
177 #:builder
178 (begin
179 (use-modules (guix build utils))
180 (let* ((out (assoc-ref %outputs "out"))
181 (bin (string-append out "/bin"))
182 (autoconf (string-append
183 (assoc-ref %build-inputs "autoconf")
184 "/bin/autoconf"))
185 (guile (string-append
186 (assoc-ref %build-inputs "guile")
187 "/bin/guile"))
188 (sh (string-append
189 (assoc-ref %build-inputs "bash")
190 "/bin/sh"))
191 (modules ((compose dirname dirname dirname)
192 (search-path %load-path
193 "guix/build/utils.scm"))))
194 (mkdir-p bin)
195
196 ;; Symlink all the binaries but `autoconf'.
197 (with-directory-excursion bin
198 (for-each (lambda (file)
199 (unless (string=? (basename file) "autoconf")
200 (symlink file (basename file))))
201 (find-files (dirname autoconf) ".*")))
202
203 ;; Add an `autoconf' binary that wraps the real one.
204 (call-with-output-file (string-append bin "/autoconf")
205 (lambda (port)
206 ;; Shamefully, Guile can be used in shebangs only if a
207 ;; single argument is passed (-ds); otherwise it gets
208 ;; them all as a single argument and fails to parse them.
209 (format port "#!~a
210 export GUILE_LOAD_PATH=\"~a\"
211 export GUILE_LOAD_COMPILED_PATH=\"~a\"
212 exec ~a --no-auto-compile \"$0\" \"$@\"
213 !#~%"
214 sh modules modules guile)
215 (write
216 `(begin
217 (use-modules (guix build utils))
218 (let ((result (apply system* ,autoconf
219 (cdr (command-line)))))
220 (when (and (file-exists? "configure")
221 (not (file-exists? "/bin/sh")))
222 ;; Patch regardless of RESULT, because `autoconf
223 ;; -Werror' can both create a `configure' file and
224 ;; return a non-zero exit code.
225 (patch-shebang "configure"))
226 (exit (status:exit-val result))))
227 port)))
228 (chmod (string-append bin "/autoconf") #o555)
229 #t))))
230
231 ;; Do not show it in the UI since it's meant for internal use.
232 (properties '((hidden? . #t)))))
233
234 (define-public autoconf-wrapper
235 (make-autoconf-wrapper autoconf))
236
237 (define-public autoconf-archive
238 (package
239 (name "autoconf-archive")
240 (version "2019.01.06")
241 (source
242 (origin
243 (method url-fetch)
244 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
245 version ".tar.xz"))
246 (sha256
247 (base32
248 "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
249 (build-system gnu-build-system)
250 (home-page "https://www.gnu.org/software/autoconf-archive/")
251 (synopsis "Collection of freely reusable Autoconf macros")
252 (description
253 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
254 greatly expanding the domain of its functionality. These macros have been
255 contributed as free software by the community.")
256 (license gpl3+)))
257
258 (define-public autobuild
259 (package
260 (name "autobuild")
261 (version "5.3")
262 (source (origin
263 (method url-fetch)
264 (uri (string-append "mirror://savannah/autobuild/autobuild-"
265 version ".tar.gz"))
266 (sha256
267 (base32
268 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
269 (build-system gnu-build-system)
270 (inputs `(("perl" ,perl)))
271 (synopsis "Process generated build logs")
272 (description "Autobuild is a package that processes build logs generated
273 when building software. Autobuild is primarily focused on packages using
274 Autoconf and Automake, but can be used with other build systems too.
275 Autobuild generates an HTML summary file, containing links to each build log.
276 The summary includes project name, version, build hostname, host type (cross
277 compile aware), date of build, and indication of success or failure. The
278 output is indexed in many ways to simplify browsing.")
279 (home-page "https://josefsson.org/autobuild/")
280 (license gpl3+)))
281
282 (define-public automake
283 (package
284 (name "automake")
285 (version "1.16.2")
286 (source (origin
287 (method url-fetch)
288 (uri (string-append "mirror://gnu/automake/automake-"
289 version ".tar.xz"))
290 (sha256
291 (base32
292 "1l7dkqbsmbf94ax29jj1jf6a0r6ikc8jybg1p5m0c3ki7pg5ki6c"))
293 (patches
294 (search-patches "automake-skip-amhello-tests.patch"))))
295 (build-system gnu-build-system)
296 (inputs
297 ;; TODO: remove `if' in the next rebuild cycle.
298 (if (%current-target-system)
299 `(("autoconf" ,autoconf-wrapper)
300 ("bash" ,bash-minimal)
301 ("perl" ,perl))
302 '()))
303 (native-inputs
304 `(("autoconf" ,autoconf-wrapper)
305 ("perl" ,perl)))
306 (native-search-paths
307 (list (search-path-specification
308 (variable "ACLOCAL_PATH")
309 (files '("share/aclocal")))))
310 (arguments
311 `(#:modules ((guix build gnu-build-system)
312 (guix build utils)
313 (srfi srfi-1)
314 (srfi srfi-26)
315 (rnrs io ports))
316 #:phases
317 (modify-phases %standard-phases
318 (add-before 'patch-source-shebangs 'patch-tests-shebangs
319 (lambda _
320 (let ((sh (which "sh")))
321 (substitute* (find-files "t" "\\.(sh|tap)$")
322 (("#![[:blank:]]?/bin/sh")
323 (string-append "#!" sh)))
324
325 ;; Set these variables for all the `configure' runs
326 ;; that occur during the test suite.
327 (setenv "SHELL" sh)
328 (setenv "CONFIG_SHELL" sh)
329 #t)))
330
331 (add-before 'check 'skip-test
332 (lambda _
333 ;; This test requires 'etags' and fails if it's missing.
334 ;; Skip it.
335 (substitute* "t/tags-lisp-space.sh"
336 (("^required.*" all)
337 (string-append "exit 77\n" all "\n")))
338 #t))
339
340 ,@(if (%current-target-system)
341 `((add-after 'install 'patch-non-shebang-references
342 (lambda* (#:key build inputs outputs #:allow-other-keys)
343 ;; `patch-shebangs' patches shebangs only, and the Perl
344 ;; scripts use a re-exec feature that references the
345 ;; build hosts' perl. Also, AUTOCONF and BASH store
346 ;; references hide in the scripts.
347 (let ((autoconf (assoc-ref inputs "autoconf"))
348 (bash (assoc-ref inputs "bash"))
349 (perl (assoc-ref inputs "perl"))
350 (out (assoc-ref outputs "out"))
351 (store-directory (%store-directory)))
352 (substitute* (find-files (string-append out "/bin"))
353 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
354 autoconf)
355 (((string-append store-directory "/[^/]*-bash-[^/]*"))
356 bash)
357 (((string-append store-directory "/[^/]*-perl-[^/]*"))
358 perl))
359 #t))))
360 '())
361
362 ;; Files like `install-sh', `mdate.sh', etc. must use
363 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
364 ;; in the wild. See <http://bugs.gnu.org/14201> for an
365 ;; example.
366 (add-after 'install 'unpatch-shebangs
367 (lambda* (#:key outputs #:allow-other-keys)
368 (let* ((out (assoc-ref outputs "out"))
369 (dir (string-append out "/share")))
370 (define (starts-with-shebang? file)
371 (equal? (call-with-input-file file
372 (lambda (p)
373 (list (get-u8 p) (get-u8 p))))
374 (map char->integer '(#\# #\!))))
375
376 (for-each (lambda (file)
377 (when (and (starts-with-shebang? file)
378 (executable-file? file))
379 (format #t "restoring shebang on `~a'~%"
380 file)
381 (substitute* file
382 (("^#!.*/bin/sh")
383 "#!/bin/sh")
384 (("^#!.*/bin/env(.*)$" _ args)
385 (string-append "#!/usr/bin/env"
386 args)))))
387 (find-files dir ".*"))
388 #t))))))
389 (home-page "https://www.gnu.org/software/automake/")
390 (synopsis "Making GNU standards-compliant Makefiles")
391 (description
392 "Automake the part of the GNU build system for producing
393 standards-compliant Makefiles. Build requirements are entered in an
394 intuitive format and then Automake works with Autoconf to produce a robust
395 Makefile, simplifying the entire process for the developer.")
396 (license gpl2+))) ; some files are under GPLv3+
397
398 (define-public libtool
399 (package
400 (name "libtool")
401 (version "2.4.6")
402 (source (origin
403 (method url-fetch)
404 (uri (string-append "mirror://gnu/libtool/libtool-"
405 version ".tar.xz"))
406 (sha256
407 (base32
408 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
409 (patches (search-patches "libtool-skip-tests2.patch"))))
410 (build-system gnu-build-system)
411 (propagated-inputs `(("m4" ,m4)))
412 (native-inputs `(("m4" ,m4)
413 ("perl" ,perl)
414 ;; XXX: this shouldn't be necessary, but without it test
415 ;; 102 fails because it cannot find ltdl/libltdl.la.
416 ("libltdl" ,libltdl)
417 ("help2man" ,help2man) ;because we modify ltmain.sh
418 ("automake" ,automake) ;some tests rely on 'aclocal'
419 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
420
421 (arguments
422 `(;; Libltdl is provided as a separate package, so don't install it here.
423 #:configure-flags '("--disable-ltdl-install")
424
425 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
426 ;; <http://hydra.gnu.org/build/181662>.
427 ;; Also, do not run tests when cross compiling
428 #:tests? ,(not (or (%current-target-system)
429 (string-prefix? "mips64"
430 (%current-system))))
431
432 #:phases
433 (modify-phases %standard-phases
434 (add-before 'check 'pre-check
435 (lambda* (#:key inputs native-inputs #:allow-other-keys)
436 ;; Run the test suite in parallel, if possible.
437 (setenv "TESTSUITEFLAGS"
438 (string-append
439 "-j"
440 (number->string (parallel-job-count))))
441 ;; Patch references to /bin/sh.
442 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
443 (substitute* "tests/testsuite"
444 (("/bin/sh")
445 (string-append bash "/bin/sh")))
446 #t)))
447 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
448 (lambda* (#:key inputs #:allow-other-keys)
449 (substitute* "build-aux/ltmain.in"
450 (("^#!.*/bin/sh$") "#!/bin/sh"))
451 #t)))))
452
453 (synopsis "Generic shared library support tools")
454 (description
455 "GNU Libtool helps in the creation and use of shared libraries, by
456 presenting a single consistent, portable interface that hides the usual
457 complexity of working with shared libraries across platforms.")
458 (license gpl3+)
459 (home-page "https://www.gnu.org/software/libtool/")))
460
461 (define-public libltdl
462 ;; This is a libltdl package separate from the libtool package. This is
463 ;; useful because, unlike libtool, it has zero extra dependencies (making it
464 ;; readily usable during bootstrap), and it builds very quickly since
465 ;; Libtool's extensive test suite isn't run.
466 (package
467 (name "libltdl")
468 (version "2.4.6")
469 (source (origin
470 (method url-fetch)
471 (uri (string-append "mirror://gnu/libtool/libtool-"
472 version ".tar.xz"))
473 (sha256
474 (base32
475 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
476 (build-system gnu-build-system)
477 (arguments
478 '(#:configure-flags '("--enable-ltdl-install") ;really install it
479 #:phases (modify-phases %standard-phases
480 (add-before 'configure 'change-directory
481 (lambda _ (chdir "libltdl") #t)))))
482
483 (synopsis "System-independent dlopen wrapper of GNU libtool")
484 (description (package-description libtool))
485 (home-page (package-home-page libtool))
486 (license lgpl2.1+)))
487
488 (define-public pyconfigure
489 (package
490 (name "pyconfigure")
491 (version "0.2.3")
492 (source (origin
493 (method url-fetch)
494 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
495 version ".tar.gz"))
496 (sha256
497 (base32
498 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
499 (build-system gnu-build-system)
500 (arguments
501 `(#:phases
502 (modify-phases %standard-phases
503 (add-before 'configure 'patch-python
504 (lambda _
505 (substitute* "pyconf.in"
506 (("/usr/bin/env python") (which "python3")))
507 #t)))))
508 (inputs
509 `(("python" ,python-3)))
510 (synopsis "@command{configure} interface for Python-based packages")
511 (description
512 "GNU pyconfigure provides template files for easily implementing
513 standards-compliant configure scripts and Makefiles for Python-based packages.
514 It is designed to work alongside existing Python setup scripts, making it easy
515 to integrate into existing projects. Powerful and flexible Autoconf macros
516 are available, allowing you to easily make adjustments to the installation
517 procedure based on the capabilities of the target computer.")
518 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
519 (license
520 (fsf-free
521 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))