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)))))
136 (add-after 'install 'unpatch-shebangs
137 (lambda* (#:key outputs #:allow-other-keys)
138 ;; Scripts that "autoconf -i" installs (config.guess,
139 ;; config.sub, and install-sh) must use a regular shebang
140 ;; rather than a reference to the store. Restore it.
141 ;; TODO: Move this phase to 'autoconf-2.69'.
142 (let* ((out (assoc-ref outputs "out"))
143 (build-aux (string-append
144 out "/share/autoconf/build-aux")))
145 (substitute* (find-files build-aux)
146 (("^#!.*/bin/sh") "#!/bin/sh")))))))))))
148 (define-public autoconf autoconf-2.69)
150 (define-public autoconf-2.68
151 (package (inherit autoconf)
156 (uri (string-append "mirror://gnu/autoconf/autoconf-"
160 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
162 (define-public autoconf-2.64
163 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
164 (package (inherit autoconf)
169 (uri (string-append "mirror://gnu/autoconf/autoconf-"
173 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
175 (define-public autoconf-2.13
176 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
177 (package (inherit autoconf)
182 (uri (string-append "mirror://gnu/autoconf/autoconf-"
186 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
190 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
191 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
192 ;; and pass a simplified set of arguments.
193 (modify-phases %standard-phases
195 (lambda* (#:key build inputs outputs #:allow-other-keys)
196 (let ((bash (which "bash"))
197 (out (assoc-ref outputs "out")))
198 (setenv "CONFIG_SHELL" bash)
199 (setenv "SHELL" bash)
200 (invoke bash "./configure"
201 (string-append "--prefix=" out)
202 (string-append "--build=" build))))))))))
205 (define (make-autoconf-wrapper autoconf)
206 "Return a wrapper around AUTOCONF that generates `configure' scripts that
207 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
208 only be used internally---users should not end up distributing `configure'
209 files with a system-specific shebang."
210 (package (inherit autoconf)
211 (name (string-append (package-name autoconf) "-wrapper"))
212 (build-system trivial-build-system)
214 ;; XXX: Kludge to hide the circular dependency.
215 ,(module-ref (resolve-interface '(gnu packages guile))
217 ("autoconf" ,autoconf)
218 ("bash" ,bash-minimal)))
220 '(#:modules ((guix build utils))
223 (use-modules (guix build utils))
224 (let* ((out (assoc-ref %outputs "out"))
225 (bin (string-append out "/bin"))
226 (autoconf (string-append
227 (assoc-ref %build-inputs "autoconf")
229 (guile (string-append
230 (assoc-ref %build-inputs "guile")
233 (assoc-ref %build-inputs "bash")
235 (modules ((compose dirname dirname dirname)
236 (search-path %load-path
237 "guix/build/utils.scm"))))
240 ;; Symlink all the binaries but `autoconf'.
241 (with-directory-excursion bin
242 (for-each (lambda (file)
243 (unless (string=? (basename file) "autoconf")
244 (symlink file (basename file))))
245 (find-files (dirname autoconf) ".*")))
247 ;; Add an `autoconf' binary that wraps the real one.
248 (call-with-output-file (string-append bin "/autoconf")
250 ;; Shamefully, Guile can be used in shebangs only if a
251 ;; single argument is passed (-ds); otherwise it gets
252 ;; them all as a single argument and fails to parse them.
254 export GUILE_LOAD_PATH=\"~a\"
255 export GUILE_LOAD_COMPILED_PATH=\"~a\"
256 exec ~a --no-auto-compile \"$0\" \"$@\"
258 sh modules modules guile)
261 (use-modules (guix build utils))
262 (let ((result (apply system* ,autoconf
263 (cdr (command-line)))))
264 (when (and (file-exists? "configure")
265 (not (file-exists? "/bin/sh")))
266 ;; Patch regardless of RESULT, because `autoconf
267 ;; -Werror' can both create a `configure' file and
268 ;; return a non-zero exit code.
269 (patch-shebang "configure"))
270 (exit (status:exit-val result))))
272 (chmod (string-append bin "/autoconf") #o555)
275 ;; Do not show it in the UI since it's meant for internal use.
276 (properties '((hidden? . #t)))))
278 ;; Only use this package when autoconf is not usable,
279 ;; see <https://issues.guix.gnu.org/46564#1>.
280 (define-public autoconf-wrapper
281 (make-autoconf-wrapper autoconf))
283 (define-public autoconf-archive
285 (name "autoconf-archive")
286 (version "2021.02.19")
290 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
294 "1gcwqspcxiygnyk02smsk8ivzs9r69ji38izxzzsijyx52fyp9p8"))))
295 (build-system gnu-build-system)
296 (home-page "https://www.gnu.org/software/autoconf-archive/")
297 (synopsis "Collection of freely reusable Autoconf macros")
299 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
300 greatly expanding the domain of its functionality. These macros have been
301 contributed as free software by the community.")
304 (define-public autobuild
310 (uri (string-append "mirror://savannah/autobuild/autobuild-"
314 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
315 (build-system gnu-build-system)
316 (inputs `(("perl" ,perl)))
317 (synopsis "Process generated build logs")
318 (description "Autobuild is a package that processes build logs generated
319 when building software. Autobuild is primarily focused on packages using
320 Autoconf and Automake, but can be used with other build systems too.
321 Autobuild generates an HTML summary file, containing links to each build log.
322 The summary includes project name, version, build hostname, host type (cross
323 compile aware), date of build, and indication of success or failure. The
324 output is indexed in many ways to simplify browsing.")
325 (home-page "https://josefsson.org/autobuild/")
328 (define-public automake
334 (uri (string-append "mirror://gnu/automake/automake-"
338 "0fmz2fhmzcpacnprl5msphvaflwiy0hvpgmqlgfny72ddijzfazz"))
340 (search-patches "automake-skip-amhello-tests.patch"))))
341 (build-system gnu-build-system)
343 `(("autoconf" ,autoconf-wrapper)
344 ("bash" ,bash-minimal)
347 `(("autoconf" ,autoconf-wrapper)
350 (list (search-path-specification
351 (variable "ACLOCAL_PATH")
352 (files '("share/aclocal")))))
354 `(#:modules ((guix build gnu-build-system)
360 (modify-phases %standard-phases
361 (add-before 'patch-source-shebangs 'patch-tests-shebangs
363 (let ((sh (which "sh")))
364 (substitute* (find-files "t" "\\.(sh|tap)$")
365 (("#![[:blank:]]?/bin/sh")
366 (string-append "#!" sh)))
368 ;; Set these variables for all the `configure' runs
369 ;; that occur during the test suite.
371 (setenv "CONFIG_SHELL" sh)
374 (add-before 'check 'skip-test
376 ;; This test requires 'etags' and fails if it's missing.
378 (substitute* "t/tags-lisp-space.sh"
380 (string-append "exit 77\n" all "\n")))
383 ,@(if (%current-target-system)
384 `((add-after 'install 'patch-non-shebang-references
385 (lambda* (#:key build inputs outputs #:allow-other-keys)
386 ;; `patch-shebangs' patches shebangs only, and the Perl
387 ;; scripts use a re-exec feature that references the
388 ;; build hosts' perl. Also, AUTOCONF and BASH store
389 ;; references hide in the scripts.
390 (let ((autoconf (assoc-ref inputs "autoconf"))
391 (bash (assoc-ref inputs "bash"))
392 (perl (assoc-ref inputs "perl"))
393 (out (assoc-ref outputs "out"))
394 (store-directory (%store-directory)))
395 (substitute* (find-files (string-append out "/bin"))
396 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
398 (((string-append store-directory "/[^/]*-bash-[^/]*"))
400 (((string-append store-directory "/[^/]*-perl-[^/]*"))
405 ;; Files like `install-sh', `mdate.sh', etc. must use
406 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
407 ;; in the wild. See <http://bugs.gnu.org/14201> for an
409 (add-after 'install 'unpatch-shebangs
410 (lambda* (#:key outputs #:allow-other-keys)
411 (let* ((out (assoc-ref outputs "out"))
412 (dir (string-append out "/share")))
413 (define (starts-with-shebang? file)
414 (equal? (call-with-input-file file
416 (list (get-u8 p) (get-u8 p))))
417 (map char->integer '(#\# #\!))))
419 (for-each (lambda (file)
420 (when (and (starts-with-shebang? file)
421 (executable-file? file))
422 (format #t "restoring shebang on `~a'~%"
427 (("^#!.*/bin/env(.*)$" _ args)
428 (string-append "#!/usr/bin/env"
430 (find-files dir ".*"))
432 (home-page "https://www.gnu.org/software/automake/")
433 (synopsis "Making GNU standards-compliant Makefiles")
435 "Automake the part of the GNU build system for producing
436 standards-compliant Makefiles. Build requirements are entered in an
437 intuitive format and then Automake works with Autoconf to produce a robust
438 Makefile, simplifying the entire process for the developer.")
439 (license gpl2+))) ; some files are under GPLv3+
441 (define-public libtool
447 (uri (string-append "mirror://gnu/libtool/libtool-"
451 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
452 (patches (search-patches "libtool-skip-tests2.patch"))))
453 (build-system gnu-build-system)
454 (propagated-inputs `(("m4" ,m4)))
455 (native-inputs `(("m4" ,m4)
457 ;; XXX: this shouldn't be necessary, but without it test
458 ;; 102 fails because it cannot find ltdl/libltdl.la.
460 ("help2man" ,help2man) ;because we modify ltmain.sh
461 ("automake" ,automake) ;some tests rely on 'aclocal'
462 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
465 `(;; Libltdl is provided as a separate package, so don't install it here.
466 #:configure-flags '("--disable-ltdl-install")
468 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
469 ;; <http://hydra.gnu.org/build/181662>.
470 ;; Also, do not run tests when cross compiling
471 #:tests? ,(not (or (%current-target-system)
472 (string-prefix? "mips64"
476 (modify-phases %standard-phases
477 (add-before 'check 'pre-check
478 (lambda* (#:key inputs native-inputs #:allow-other-keys)
479 ;; Run the test suite in parallel, if possible.
480 (setenv "TESTSUITEFLAGS"
483 (number->string (parallel-job-count))))
484 ;; Patch references to /bin/sh.
485 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
486 (substitute* "tests/testsuite"
488 (string-append bash "/bin/sh")))
490 ;; These files may be copied into source trees by libtoolize,
491 ;; therefore they must not point to store file names that would be
492 ;; leaked with tarballs generated by make dist.
493 (add-after 'install 'restore-build-aux-shebang
494 (lambda* (#:key outputs #:allow-other-keys)
495 (let* ((out (assoc-ref outputs "out"))
496 (dir (string-append out "/share/libtool/build-aux")))
497 (for-each (lambda (file)
498 (format #t "restoring shebang on `~a'~%" file)
500 (("^#!.*/bin/sh") "#!/bin/sh")))
501 (find-files dir ".*"))
504 (synopsis "Generic shared library support tools")
506 "GNU Libtool helps in the creation and use of shared libraries, by
507 presenting a single consistent, portable interface that hides the usual
508 complexity of working with shared libraries across platforms.")
510 (home-page "https://www.gnu.org/software/libtool/")))
512 (define-public config
514 (commit "c8ddc8472f8efcadafc1ef53ca1d863415fddd5f"))
517 (version (git-version "0.0.0" revision commit)) ;no release tag
521 (url "https://git.savannah.gnu.org/git/config.git/")
523 (file-name (git-file-name name version))
526 "0x6ycvkmmhhhag97wsf0pw8n5fvh12rjvrck90rz17my4ys16qwv"))))
527 (build-system gnu-build-system)
529 `(#:phases (modify-phases %standard-phases
530 (add-after 'unpack 'patch-/bin/sh
532 (substitute* "testsuite/config-guess.sh"
534 (string-append "#!" (which "sh"))))
538 (invoke "make" "manpages")))
541 (lambda* (#:key outputs #:allow-other-keys)
542 (let* ((out (assoc-ref outputs "out"))
543 (bin (string-append out "/bin"))
544 (man1 (string-append out "/share/man/man1")))
545 (install-file "config.guess" bin)
546 (install-file "config.sub" bin)
547 (install-file "doc/config.guess.1" man1)
548 (install-file "doc/config.sub.1" man1)
551 `(("help2man" ,help2man)))
552 (home-page "https://savannah.gnu.org/projects/config")
553 (synopsis "Ubiquitous config.guess and config.sub scripts")
554 (description "The `config.guess' script tries to guess a canonical system triple,
555 and `config.sub' validates and canonicalizes. These are used as part of
556 configuration in nearly all GNU packages (and many others).")
559 (define-public libltdl
560 ;; This is a libltdl package separate from the libtool package. This is
561 ;; useful because, unlike libtool, it has zero extra dependencies (making it
562 ;; readily usable during bootstrap), and it builds very quickly since
563 ;; Libtool's extensive test suite isn't run.
569 (uri (string-append "mirror://gnu/libtool/libtool-"
573 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
574 (build-system gnu-build-system)
576 '(#:configure-flags '("--enable-ltdl-install") ;really install it
577 #:phases (modify-phases %standard-phases
578 (add-before 'configure 'change-directory
579 (lambda _ (chdir "libltdl") #t)))))
581 (synopsis "System-independent dlopen wrapper of GNU libtool")
582 (description (package-description libtool))
583 (home-page (package-home-page libtool))
586 (define-public pyconfigure
592 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
596 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
597 (build-system gnu-build-system)
600 (modify-phases %standard-phases
601 (add-before 'configure 'patch-python
603 (substitute* "pyconf.in"
604 (("/usr/bin/env python") (which "python3")))
607 `(("python" ,python-3)))
608 (synopsis "@command{configure} interface for Python-based packages")
610 "GNU pyconfigure provides template files for easily implementing
611 standards-compliant configure scripts and Makefiles for Python-based packages.
612 It is designed to work alongside existing Python setup scripts, making it easy
613 to integrate into existing projects. Powerful and flexible Autoconf macros
614 are available, allowing you to easily make adjustments to the installation
615 procedure based on the capabilities of the target computer.")
616 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
619 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))