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, 2021 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, 2021 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 ;;; Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
16 ;;; This file is part of GNU Guix.
18 ;;; GNU Guix is free software; you can redistribute it and/or modify it
19 ;;; under the terms of the GNU General Public License as published by
20 ;;; the Free Software Foundation; either version 3 of the License, or (at
21 ;;; your option) any later version.
23 ;;; GNU Guix is distributed in the hope that it will be useful, but
24 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
25 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 ;;; GNU General Public License for more details.
28 ;;; You should have received a copy of the GNU General Public License
29 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31 (define-module (gnu packages autotools)
32 #:use-module (guix licenses)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages perl)
35 #:use-module (gnu packages python)
36 #:use-module (gnu packages m4)
37 #:use-module (gnu packages man)
38 #:use-module (gnu packages bash)
39 #:use-module (guix utils)
40 #:use-module (guix packages)
41 #:use-module (guix download)
42 #:use-module (guix git-download)
43 #:use-module (guix build-system gnu)
44 #:use-module (guix build-system trivial)
45 #:use-module (ice-9 match)
46 #:export (autoconf-wrapper))
48 (define-public autoconf-2.69
55 (uri (string-append "mirror://gnu/autoconf/autoconf-"
59 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
60 (build-system gnu-build-system)
62 `(("bash" ,bash-minimal)
69 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
70 ;; should use our own "cpp" instead of "/lib/cpp".
72 ,@(if (%current-target-system)
74 (modify-phases %standard-phases
75 (add-after 'install 'patch-non-shebang-references
76 (lambda* (#:key build inputs outputs #:allow-other-keys)
77 ;; `patch-shebangs' patches shebangs only, and the Perl
78 ;; scripts use a re-exec feature that references the
79 ;; build hosts' perl. Also, BASH and M4 store references
80 ;; hide in the scripts.
81 (let ((bash (assoc-ref inputs "bash"))
82 (m4 (assoc-ref inputs "m4"))
83 (perl (assoc-ref inputs "perl"))
84 (out (assoc-ref outputs "out"))
85 (store-directory (%store-directory)))
86 (substitute* (find-files (string-append out "/bin"))
87 (((string-append store-directory "/[^/]*-bash-[^/]*"))
89 (((string-append store-directory "/[^/]*-m4-[^/]*"))
91 (((string-append store-directory "/[^/]*-perl-[^/]*"))
95 (home-page "https://www.gnu.org/software/autoconf/")
96 (synopsis "Create source code configuration scripts")
98 "Autoconf offers the developer a robust set of M4 macros which expand
99 into shell code to test the features of Unix-like systems and to adapt
100 automatically their software package to these systems. The resulting shell
101 scripts are self-contained and portable, freeing the user from needing to
102 know anything about Autoconf or M4.")
103 (license gpl3+))) ; some files are under GPLv2+
105 ;; This is the renaissance version, which is not widely supported yet.
106 (define-public autoconf-2.71
108 (inherit autoconf-2.69)
113 (uri (string-append "mirror://gnu/autoconf/autoconf-"
117 "197sl23irn6s9pd54rxj5vcp5y8dv65jb9yfqgr2g56cxg7q6k7i"))))
119 (substitute-keyword-arguments (package-arguments autoconf-2.69)
121 ;; FIXME: To run the test suite, fix all the instances where scripts
122 ;; generates "#! /bin/sh" shebangs.
124 ((#:phases phases '%standard-phases)
125 `(modify-phases ,phases
126 (add-before 'check 'prepare-tests
128 (for-each patch-shebang
129 (append (find-files "tests"
131 (executable-file? file)))
134 (executable-file? file)))))
137 (define-public autoconf autoconf-2.69)
139 (define-public autoconf-2.68
140 (package (inherit autoconf)
145 (uri (string-append "mirror://gnu/autoconf/autoconf-"
149 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
151 (define-public autoconf-2.64
152 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
153 (package (inherit autoconf)
158 (uri (string-append "mirror://gnu/autoconf/autoconf-"
162 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
164 (define-public autoconf-2.13
165 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
166 (package (inherit autoconf)
171 (uri (string-append "mirror://gnu/autoconf/autoconf-"
175 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
179 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
180 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
181 ;; and pass a simplified set of arguments.
182 (modify-phases %standard-phases
184 (lambda* (#:key build inputs outputs #:allow-other-keys)
185 (let ((bash (which "bash"))
186 (out (assoc-ref outputs "out")))
187 (setenv "CONFIG_SHELL" bash)
188 (setenv "SHELL" bash)
189 (invoke bash "./configure"
190 (string-append "--prefix=" out)
191 (string-append "--build=" build))))))))))
194 (define (make-autoconf-wrapper autoconf)
195 "Return a wrapper around AUTOCONF that generates `configure' scripts that
196 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
197 only be used internally---users should not end up distributing `configure'
198 files with a system-specific shebang."
199 (package (inherit autoconf)
200 (name (string-append (package-name autoconf) "-wrapper"))
201 (build-system trivial-build-system)
203 ;; XXX: Kludge to hide the circular dependency.
204 ,(module-ref (resolve-interface '(gnu packages guile))
206 ("autoconf" ,autoconf)
207 ("bash" ,bash-minimal)))
209 '(#:modules ((guix build utils))
212 (use-modules (guix build utils))
213 (let* ((out (assoc-ref %outputs "out"))
214 (bin (string-append out "/bin"))
215 (autoconf (string-append
216 (assoc-ref %build-inputs "autoconf")
218 (guile (string-append
219 (assoc-ref %build-inputs "guile")
222 (assoc-ref %build-inputs "bash")
224 (modules ((compose dirname dirname dirname)
225 (search-path %load-path
226 "guix/build/utils.scm"))))
229 ;; Symlink all the binaries but `autoconf'.
230 (with-directory-excursion bin
231 (for-each (lambda (file)
232 (unless (string=? (basename file) "autoconf")
233 (symlink file (basename file))))
234 (find-files (dirname autoconf) ".*")))
236 ;; Add an `autoconf' binary that wraps the real one.
237 (call-with-output-file (string-append bin "/autoconf")
239 ;; Shamefully, Guile can be used in shebangs only if a
240 ;; single argument is passed (-ds); otherwise it gets
241 ;; them all as a single argument and fails to parse them.
243 export GUILE_LOAD_PATH=\"~a\"
244 export GUILE_LOAD_COMPILED_PATH=\"~a\"
245 exec ~a --no-auto-compile \"$0\" \"$@\"
247 sh modules modules guile)
250 (use-modules (guix build utils))
251 (let ((result (apply system* ,autoconf
252 (cdr (command-line)))))
253 (when (and (file-exists? "configure")
254 (not (file-exists? "/bin/sh")))
255 ;; Patch regardless of RESULT, because `autoconf
256 ;; -Werror' can both create a `configure' file and
257 ;; return a non-zero exit code.
258 (patch-shebang "configure"))
259 (exit (status:exit-val result))))
261 (chmod (string-append bin "/autoconf") #o555)
264 ;; Do not show it in the UI since it's meant for internal use.
265 (properties '((hidden? . #t)))))
267 ;; Only use this package when autoconf is not usable,
268 ;; see <https://issues.guix.gnu.org/46564#1>.
269 (define-public autoconf-wrapper
270 (make-autoconf-wrapper autoconf))
272 (define-public autoconf-archive
274 (name "autoconf-archive")
275 (version "2021.02.19")
279 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
283 "1gcwqspcxiygnyk02smsk8ivzs9r69ji38izxzzsijyx52fyp9p8"))))
284 (build-system gnu-build-system)
285 (home-page "https://www.gnu.org/software/autoconf-archive/")
286 (synopsis "Collection of freely reusable Autoconf macros")
288 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
289 greatly expanding the domain of its functionality. These macros have been
290 contributed as free software by the community.")
293 (define-public autobuild
299 (uri (string-append "mirror://savannah/autobuild/autobuild-"
303 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
304 (build-system gnu-build-system)
305 (inputs `(("perl" ,perl)))
306 (synopsis "Process generated build logs")
307 (description "Autobuild is a package that processes build logs generated
308 when building software. Autobuild is primarily focused on packages using
309 Autoconf and Automake, but can be used with other build systems too.
310 Autobuild generates an HTML summary file, containing links to each build log.
311 The summary includes project name, version, build hostname, host type (cross
312 compile aware), date of build, and indication of success or failure. The
313 output is indexed in many ways to simplify browsing.")
314 (home-page "https://josefsson.org/autobuild/")
317 (define-public automake
323 (uri (string-append "mirror://gnu/automake/automake-"
327 "0fmz2fhmzcpacnprl5msphvaflwiy0hvpgmqlgfny72ddijzfazz"))
329 (search-patches "automake-skip-amhello-tests.patch"))))
330 (build-system gnu-build-system)
332 `(("autoconf" ,autoconf-wrapper)
333 ("bash" ,bash-minimal)
336 `(("autoconf" ,autoconf-wrapper)
339 (list (search-path-specification
340 (variable "ACLOCAL_PATH")
341 (files '("share/aclocal")))))
343 `(#:modules ((guix build gnu-build-system)
349 (modify-phases %standard-phases
350 (add-before 'patch-source-shebangs 'patch-tests-shebangs
352 (let ((sh (which "sh")))
353 (substitute* (find-files "t" "\\.(sh|tap)$")
354 (("#![[:blank:]]?/bin/sh")
355 (string-append "#!" sh)))
357 ;; Set these variables for all the `configure' runs
358 ;; that occur during the test suite.
360 (setenv "CONFIG_SHELL" sh)
363 (add-before 'check 'skip-test
365 ;; This test requires 'etags' and fails if it's missing.
367 (substitute* "t/tags-lisp-space.sh"
369 (string-append "exit 77\n" all "\n")))
372 ,@(if (%current-target-system)
373 `((add-after 'install 'patch-non-shebang-references
374 (lambda* (#:key build inputs outputs #:allow-other-keys)
375 ;; `patch-shebangs' patches shebangs only, and the Perl
376 ;; scripts use a re-exec feature that references the
377 ;; build hosts' perl. Also, AUTOCONF and BASH store
378 ;; references hide in the scripts.
379 (let ((autoconf (assoc-ref inputs "autoconf"))
380 (bash (assoc-ref inputs "bash"))
381 (perl (assoc-ref inputs "perl"))
382 (out (assoc-ref outputs "out"))
383 (store-directory (%store-directory)))
384 (substitute* (find-files (string-append out "/bin"))
385 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
387 (((string-append store-directory "/[^/]*-bash-[^/]*"))
389 (((string-append store-directory "/[^/]*-perl-[^/]*"))
394 ;; Files like `install-sh', `mdate.sh', etc. must use
395 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
396 ;; in the wild. See <http://bugs.gnu.org/14201> for an
398 (add-after 'install 'unpatch-shebangs
399 (lambda* (#:key outputs #:allow-other-keys)
400 (let* ((out (assoc-ref outputs "out"))
401 (dir (string-append out "/share")))
402 (define (starts-with-shebang? file)
403 (equal? (call-with-input-file file
405 (list (get-u8 p) (get-u8 p))))
406 (map char->integer '(#\# #\!))))
408 (for-each (lambda (file)
409 (when (and (starts-with-shebang? file)
410 (executable-file? file))
411 (format #t "restoring shebang on `~a'~%"
416 (("^#!.*/bin/env(.*)$" _ args)
417 (string-append "#!/usr/bin/env"
419 (find-files dir ".*"))
421 (home-page "https://www.gnu.org/software/automake/")
422 (synopsis "Making GNU standards-compliant Makefiles")
424 "Automake the part of the GNU build system for producing
425 standards-compliant Makefiles. Build requirements are entered in an
426 intuitive format and then Automake works with Autoconf to produce a robust
427 Makefile, simplifying the entire process for the developer.")
428 (license gpl2+))) ; some files are under GPLv3+
430 (define-public libtool
436 (uri (string-append "mirror://gnu/libtool/libtool-"
440 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
441 (patches (search-patches "libtool-skip-tests2.patch"))))
442 (build-system gnu-build-system)
443 (propagated-inputs `(("m4" ,m4)))
444 (native-inputs `(("m4" ,m4)
446 ;; XXX: this shouldn't be necessary, but without it test
447 ;; 102 fails because it cannot find ltdl/libltdl.la.
449 ("help2man" ,help2man) ;because we modify ltmain.sh
450 ("automake" ,automake) ;some tests rely on 'aclocal'
451 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
454 `(;; Libltdl is provided as a separate package, so don't install it here.
455 #:configure-flags '("--disable-ltdl-install")
457 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
458 ;; <http://hydra.gnu.org/build/181662>.
459 ;; Also, do not run tests when cross compiling
460 #:tests? ,(not (or (%current-target-system)
461 (string-prefix? "mips64"
465 (modify-phases %standard-phases
466 (add-before 'check 'pre-check
467 (lambda* (#:key inputs native-inputs #:allow-other-keys)
468 ;; Run the test suite in parallel, if possible.
469 (setenv "TESTSUITEFLAGS"
472 (number->string (parallel-job-count))))
473 ;; Patch references to /bin/sh.
474 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
475 (substitute* "tests/testsuite"
477 (string-append bash "/bin/sh")))
479 ;; These files may be copied into source trees by libtoolize,
480 ;; therefore they must not point to store file names that would be
481 ;; leaked with tarballs generated by make dist.
482 (add-after 'install 'restore-build-aux-shebang
483 (lambda* (#:key outputs #:allow-other-keys)
484 (let* ((out (assoc-ref outputs "out"))
485 (dir (string-append out "/share/libtool/build-aux")))
486 (for-each (lambda (file)
487 (format #t "restoring shebang on `~a'~%" file)
489 (("^#!.*/bin/sh") "#!/bin/sh")))
490 (find-files dir ".*"))
493 (synopsis "Generic shared library support tools")
495 "GNU Libtool helps in the creation and use of shared libraries, by
496 presenting a single consistent, portable interface that hides the usual
497 complexity of working with shared libraries across platforms.")
499 (home-page "https://www.gnu.org/software/libtool/")))
501 (define-public config
503 (commit "c8ddc8472f8efcadafc1ef53ca1d863415fddd5f"))
506 (version (git-version "0.0.0" revision commit)) ;no release tag
510 (url "https://git.savannah.gnu.org/git/config.git/")
512 (file-name (git-file-name name version))
515 "0x6ycvkmmhhhag97wsf0pw8n5fvh12rjvrck90rz17my4ys16qwv"))))
516 (build-system gnu-build-system)
518 `(#:phases (modify-phases %standard-phases
519 (add-after 'unpack 'patch-/bin/sh
521 (substitute* "testsuite/config-guess.sh"
523 (string-append "#!" (which "sh"))))
527 (invoke "make" "manpages")))
530 (lambda* (#:key outputs #:allow-other-keys)
531 (let* ((out (assoc-ref outputs "out"))
532 (bin (string-append out "/bin"))
533 (man1 (string-append out "/share/man/man1")))
534 (install-file "config.guess" bin)
535 (install-file "config.sub" bin)
536 (install-file "doc/config.guess.1" man1)
537 (install-file "doc/config.sub.1" man1)
540 `(("help2man" ,help2man)))
541 (home-page "https://savannah.gnu.org/projects/config")
542 (synopsis "Ubiquitous config.guess and config.sub scripts")
543 (description "The `config.guess' script tries to guess a canonical system triple,
544 and `config.sub' validates and canonicalizes. These are used as part of
545 configuration in nearly all GNU packages (and many others).")
548 (define-public libltdl
549 ;; This is a libltdl package separate from the libtool package. This is
550 ;; useful because, unlike libtool, it has zero extra dependencies (making it
551 ;; readily usable during bootstrap), and it builds very quickly since
552 ;; Libtool's extensive test suite isn't run.
558 (uri (string-append "mirror://gnu/libtool/libtool-"
562 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
563 (build-system gnu-build-system)
565 '(#:configure-flags '("--enable-ltdl-install") ;really install it
566 #:phases (modify-phases %standard-phases
567 (add-before 'configure 'change-directory
568 (lambda _ (chdir "libltdl") #t)))))
570 (synopsis "System-independent dlopen wrapper of GNU libtool")
571 (description (package-description libtool))
572 (home-page (package-home-page libtool))
575 (define-public pyconfigure
581 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
585 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
586 (build-system gnu-build-system)
589 (modify-phases %standard-phases
590 (add-before 'configure 'patch-python
592 (substitute* "pyconf.in"
593 (("/usr/bin/env python") (which "python3")))
596 `(("python" ,python-3)))
597 (synopsis "@command{configure} interface for Python-based packages")
599 "GNU pyconfigure provides template files for easily implementing
600 standards-compliant configure scripts and Makefiles for Python-based packages.
601 It is designed to work alongside existing Python setup scripts, making it easy
602 to integrate into existing projects. Powerful and flexible Autoconf macros
603 are available, allowing you to easily make adjustments to the installation
604 procedure based on the capabilities of the target computer.")
605 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
608 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))