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)
68 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
69 ;; should use our own "cpp" instead of "/lib/cpp".
71 ,@(if (%current-target-system)
73 (modify-phases %standard-phases
74 (add-after 'install 'patch-non-shebang-references
75 (lambda* (#:key build inputs outputs #:allow-other-keys)
76 ;; `patch-shebangs' patches shebangs only, and the Perl
77 ;; scripts use a re-exec feature that references the
78 ;; build hosts' perl. Also, BASH and M4 store references
79 ;; hide in the scripts.
80 (let ((bash (assoc-ref inputs "bash"))
81 (m4 (assoc-ref inputs "m4"))
82 (perl (assoc-ref inputs "perl"))
83 (out (assoc-ref outputs "out"))
84 (store-directory (%store-directory)))
85 (substitute* (find-files (string-append out "/bin"))
86 (((string-append store-directory "/[^/]*-bash-[^/]*"))
88 (((string-append store-directory "/[^/]*-m4-[^/]*"))
90 (((string-append store-directory "/[^/]*-perl-[^/]*"))
94 (home-page "https://www.gnu.org/software/autoconf/")
95 (synopsis "Create source code configuration scripts")
97 "Autoconf offers the developer a robust set of M4 macros which expand
98 into shell code to test the features of Unix-like systems and to adapt
99 automatically their software package to these systems. The resulting shell
100 scripts are self-contained and portable, freeing the user from needing to
101 know anything about Autoconf or M4.")
102 (license gpl3+))) ; some files are under GPLv2+
104 ;; This is the renaissance version, which is not widely supported yet.
105 (define-public autoconf-2.71
107 (inherit autoconf-2.69)
112 (uri (string-append "mirror://gnu/autoconf/autoconf-"
116 "197sl23irn6s9pd54rxj5vcp5y8dv65jb9yfqgr2g56cxg7q6k7i"))))
118 (substitute-keyword-arguments (package-arguments autoconf-2.69)
120 ;; FIXME: To run the test suite, fix all the instances where scripts
121 ;; generates "#! /bin/sh" shebangs.
123 ((#:phases phases '%standard-phases)
124 `(modify-phases ,phases
125 (add-before 'check 'prepare-tests
127 (for-each patch-shebang
128 (append (find-files "tests"
130 (executable-file? file)))
133 (executable-file? file)))))
135 (add-after 'install 'unpatch-shebangs
136 (lambda* (#:key outputs #:allow-other-keys)
137 ;; Scripts that "autoconf -i" installs (config.guess,
138 ;; config.sub, and install-sh) must use a regular shebang
139 ;; rather than a reference to the store. Restore it.
140 ;; TODO: Move this phase to 'autoconf-2.69'.
141 (let* ((out (assoc-ref outputs "out"))
142 (build-aux (string-append
143 out "/share/autoconf/build-aux")))
144 (substitute* (find-files build-aux)
145 (("^#!.*/bin/sh") "#!/bin/sh")))))))))))
147 (define-public autoconf autoconf-2.69)
149 (define-public autoconf-2.68
150 (package (inherit autoconf)
155 (uri (string-append "mirror://gnu/autoconf/autoconf-"
159 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
161 (define-public autoconf-2.64
162 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
163 (package (inherit autoconf)
168 (uri (string-append "mirror://gnu/autoconf/autoconf-"
172 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
174 (define-public autoconf-2.13
175 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
176 (package (inherit autoconf)
181 (uri (string-append "mirror://gnu/autoconf/autoconf-"
185 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
189 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
190 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
191 ;; and pass a simplified set of arguments.
192 (modify-phases %standard-phases
194 (lambda* (#:key build inputs outputs #:allow-other-keys)
195 (let ((bash (which "bash"))
196 (out (assoc-ref outputs "out")))
197 (setenv "CONFIG_SHELL" bash)
198 (setenv "SHELL" bash)
199 (invoke bash "./configure"
200 (string-append "--prefix=" out)
201 (string-append "--build=" build))))))))))
204 (define (make-autoconf-wrapper autoconf)
205 "Return a wrapper around AUTOCONF that generates `configure' scripts that
206 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
207 only be used internally---users should not end up distributing `configure'
208 files with a system-specific shebang."
209 (package (inherit autoconf)
210 (name (string-append (package-name autoconf) "-wrapper"))
211 (build-system trivial-build-system)
213 ;; XXX: Kludge to hide the circular dependency.
214 ,(module-ref (resolve-interface '(gnu packages guile))
216 ("autoconf" ,autoconf)
217 ("bash" ,bash-minimal)))
219 '(#:modules ((guix build utils))
222 (use-modules (guix build utils))
223 (let* ((out (assoc-ref %outputs "out"))
224 (bin (string-append out "/bin"))
225 (autoconf (string-append
226 (assoc-ref %build-inputs "autoconf")
228 (guile (string-append
229 (assoc-ref %build-inputs "guile")
232 (assoc-ref %build-inputs "bash")
234 (modules ((compose dirname dirname dirname)
235 (search-path %load-path
236 "guix/build/utils.scm"))))
239 ;; Symlink all the binaries but `autoconf'.
240 (with-directory-excursion bin
241 (for-each (lambda (file)
242 (unless (string=? (basename file) "autoconf")
243 (symlink file (basename file))))
244 (find-files (dirname autoconf) ".*")))
246 ;; Add an `autoconf' binary that wraps the real one.
247 (call-with-output-file (string-append bin "/autoconf")
249 ;; Shamefully, Guile can be used in shebangs only if a
250 ;; single argument is passed (-ds); otherwise it gets
251 ;; them all as a single argument and fails to parse them.
253 export GUILE_LOAD_PATH=\"~a\"
254 export GUILE_LOAD_COMPILED_PATH=\"~a\"
255 exec ~a --no-auto-compile \"$0\" \"$@\"
257 sh modules modules guile)
260 (use-modules (guix build utils))
261 (let ((result (apply system* ,autoconf
262 (cdr (command-line)))))
263 (when (and (file-exists? "configure")
264 (not (file-exists? "/bin/sh")))
265 ;; Patch regardless of RESULT, because `autoconf
266 ;; -Werror' can both create a `configure' file and
267 ;; return a non-zero exit code.
268 (patch-shebang "configure"))
269 (exit (status:exit-val result))))
271 (chmod (string-append bin "/autoconf") #o555)
274 ;; Do not show it in the UI since it's meant for internal use.
275 (properties '((hidden? . #t)))))
277 ;; Only use this package when autoconf is not usable,
278 ;; see <https://issues.guix.gnu.org/46564#1>.
279 (define-public autoconf-wrapper
280 (make-autoconf-wrapper autoconf))
282 (define-public autoconf-archive
284 (name "autoconf-archive")
285 (version "2021.02.19")
289 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
293 "1gcwqspcxiygnyk02smsk8ivzs9r69ji38izxzzsijyx52fyp9p8"))))
294 (build-system gnu-build-system)
295 (home-page "https://www.gnu.org/software/autoconf-archive/")
296 (synopsis "Collection of freely reusable Autoconf macros")
298 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
299 greatly expanding the domain of its functionality. These macros have been
300 contributed as free software by the community.")
303 (define-public autobuild
309 (uri (string-append "mirror://savannah/autobuild/autobuild-"
313 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
314 (build-system gnu-build-system)
316 (synopsis "Process generated build logs")
317 (description "Autobuild is a package that processes build logs generated
318 when building software. Autobuild is primarily focused on packages using
319 Autoconf and Automake, but can be used with other build systems too.
320 Autobuild generates an HTML summary file, containing links to each build log.
321 The summary includes project name, version, build hostname, host type (cross
322 compile aware), date of build, and indication of success or failure. The
323 output is indexed in many ways to simplify browsing.")
324 (home-page "https://josefsson.org/autobuild/")
327 (define-public automake
333 (uri (string-append "mirror://gnu/automake/automake-"
337 "0fmz2fhmzcpacnprl5msphvaflwiy0hvpgmqlgfny72ddijzfazz"))
339 (search-patches "automake-skip-amhello-tests.patch"))))
340 (build-system gnu-build-system)
342 `(("autoconf" ,autoconf-wrapper)
343 ("bash" ,bash-minimal)
346 `(("autoconf" ,autoconf-wrapper)
349 (list (search-path-specification
350 (variable "ACLOCAL_PATH")
351 (files '("share/aclocal")))))
353 `(#:modules ((guix build gnu-build-system)
359 (modify-phases %standard-phases
360 (add-before 'patch-source-shebangs 'patch-tests-shebangs
362 (let ((sh (which "sh")))
363 (substitute* (find-files "t" "\\.(sh|tap)$")
364 (("#![[:blank:]]?/bin/sh")
365 (string-append "#!" sh)))
367 ;; Set these variables for all the `configure' runs
368 ;; that occur during the test suite.
370 (setenv "CONFIG_SHELL" sh)
373 (add-before 'check 'skip-test
375 ;; This test requires 'etags' and fails if it's missing.
377 (substitute* "t/tags-lisp-space.sh"
379 (string-append "exit 77\n" all "\n")))
382 ,@(if (%current-target-system)
383 `((add-after 'install 'patch-non-shebang-references
384 (lambda* (#:key build inputs outputs #:allow-other-keys)
385 ;; `patch-shebangs' patches shebangs only, and the Perl
386 ;; scripts use a re-exec feature that references the
387 ;; build hosts' perl. Also, AUTOCONF and BASH store
388 ;; references hide in the scripts.
389 (let ((autoconf (assoc-ref inputs "autoconf"))
390 (bash (assoc-ref inputs "bash"))
391 (perl (assoc-ref inputs "perl"))
392 (out (assoc-ref outputs "out"))
393 (store-directory (%store-directory)))
394 (substitute* (find-files (string-append out "/bin"))
395 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
397 (((string-append store-directory "/[^/]*-bash-[^/]*"))
399 (((string-append store-directory "/[^/]*-perl-[^/]*"))
404 ;; Files like `install-sh', `mdate.sh', etc. must use
405 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
406 ;; in the wild. See <http://bugs.gnu.org/14201> for an
408 (add-after 'install 'unpatch-shebangs
409 (lambda* (#:key outputs #:allow-other-keys)
410 (let* ((out (assoc-ref outputs "out"))
411 (dir (string-append out "/share")))
412 (define (starts-with-shebang? file)
413 (equal? (call-with-input-file file
415 (list (get-u8 p) (get-u8 p))))
416 (map char->integer '(#\# #\!))))
418 (for-each (lambda (file)
419 (when (and (starts-with-shebang? file)
420 (executable-file? file))
421 (format #t "restoring shebang on `~a'~%"
426 (("^#!.*/bin/env(.*)$" _ args)
427 (string-append "#!/usr/bin/env"
429 (find-files dir ".*"))
431 (home-page "https://www.gnu.org/software/automake/")
432 (synopsis "Making GNU standards-compliant Makefiles")
434 "Automake the part of the GNU build system for producing
435 standards-compliant Makefiles. Build requirements are entered in an
436 intuitive format and then Automake works with Autoconf to produce a robust
437 Makefile, simplifying the entire process for the developer.")
438 (license gpl2+))) ; some files are under GPLv3+
440 (define-public automake-1.16.5
446 (uri (string-append "mirror://gnu/automake/automake-"
450 "0sdl32qxdy7m06iggmkkvf7j520rmmgbsjzbm7fgnxwxdp6mh7gh"))
452 (search-patches "automake-skip-amhello-tests.patch"))))))
454 (define-public libtool
460 (uri (string-append "mirror://gnu/libtool/libtool-"
464 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
465 (patches (search-patches "libtool-skip-tests2.patch"))))
466 (build-system gnu-build-system)
467 (propagated-inputs (list m4))
468 (native-inputs `(("m4" ,m4)
470 ;; XXX: this shouldn't be necessary, but without it test
471 ;; 102 fails because it cannot find ltdl/libltdl.la.
473 ("help2man" ,help2man) ;because we modify ltmain.sh
474 ("automake" ,automake) ;some tests rely on 'aclocal'
475 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
478 `(;; Libltdl is provided as a separate package, so don't install it here.
479 #:configure-flags '("--disable-ltdl-install")
481 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
482 ;; <http://hydra.gnu.org/build/181662>.
483 ;; Also, do not run tests when cross compiling
484 #:tests? ,(not (or (%current-target-system)
485 (string-prefix? "mips64"
489 (modify-phases %standard-phases
490 (add-before 'check 'pre-check
491 (lambda* (#:key inputs native-inputs #:allow-other-keys)
492 ;; Run the test suite in parallel, if possible.
493 (setenv "TESTSUITEFLAGS"
496 (number->string (parallel-job-count))))
497 ;; Patch references to /bin/sh.
498 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
499 (substitute* "tests/testsuite"
501 (string-append bash "/bin/sh")))
503 ;; These files may be copied into source trees by libtoolize,
504 ;; therefore they must not point to store file names that would be
505 ;; leaked with tarballs generated by make dist.
506 (add-after 'install 'restore-build-aux-shebang
507 (lambda* (#:key outputs #:allow-other-keys)
508 (let* ((out (assoc-ref outputs "out"))
509 (dir (string-append out "/share/libtool/build-aux")))
510 (for-each (lambda (file)
511 (format #t "restoring shebang on `~a'~%" file)
513 (("^#!.*/bin/sh") "#!/bin/sh")))
514 (find-files dir ".*"))
517 (synopsis "Generic shared library support tools")
519 "GNU Libtool helps in the creation and use of shared libraries, by
520 presenting a single consistent, portable interface that hides the usual
521 complexity of working with shared libraries across platforms.")
523 (home-page "https://www.gnu.org/software/libtool/")))
525 (define-public config
527 (commit "c8ddc8472f8efcadafc1ef53ca1d863415fddd5f"))
530 (version (git-version "0.0.0" revision commit)) ;no release tag
534 (url "https://git.savannah.gnu.org/git/config.git/")
536 (file-name (git-file-name name version))
539 "0x6ycvkmmhhhag97wsf0pw8n5fvh12rjvrck90rz17my4ys16qwv"))))
540 (build-system gnu-build-system)
542 `(#:phases (modify-phases %standard-phases
543 (add-after 'unpack 'patch-/bin/sh
545 (substitute* "testsuite/config-guess.sh"
547 (string-append "#!" (which "sh"))))
551 (invoke "make" "manpages")))
554 (lambda* (#:key outputs #:allow-other-keys)
555 (let* ((out (assoc-ref outputs "out"))
556 (bin (string-append out "/bin"))
557 (man1 (string-append out "/share/man/man1")))
558 (install-file "config.guess" bin)
559 (install-file "config.sub" bin)
560 (install-file "doc/config.guess.1" man1)
561 (install-file "doc/config.sub.1" man1)
565 (home-page "https://savannah.gnu.org/projects/config")
566 (synopsis "Ubiquitous config.guess and config.sub scripts")
567 (description "The `config.guess' script tries to guess a canonical system triple,
568 and `config.sub' validates and canonicalizes. These are used as part of
569 configuration in nearly all GNU packages (and many others).")
572 (define-public libltdl
573 ;; This is a libltdl package separate from the libtool package. This is
574 ;; useful because, unlike libtool, it has zero extra dependencies (making it
575 ;; readily usable during bootstrap), and it builds very quickly since
576 ;; Libtool's extensive test suite isn't run.
582 (uri (string-append "mirror://gnu/libtool/libtool-"
586 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
587 (build-system gnu-build-system)
589 '(#:configure-flags '("--enable-ltdl-install") ;really install it
590 #:phases (modify-phases %standard-phases
591 (add-before 'configure 'change-directory
592 (lambda _ (chdir "libltdl") #t)))))
594 (synopsis "System-independent dlopen wrapper of GNU libtool")
595 (description (package-description libtool))
596 (home-page (package-home-page libtool))
599 (define-public pyconfigure
605 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
609 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
610 (build-system gnu-build-system)
613 (modify-phases %standard-phases
614 (add-before 'configure 'patch-python
616 (substitute* "pyconf.in"
617 (("/usr/bin/env python") (which "python3")))
621 (synopsis "@command{configure} interface for Python-based packages")
623 "GNU pyconfigure provides template files for easily implementing
624 standards-compliant configure scripts and Makefiles for Python-based packages.
625 It is designed to work alongside existing Python setup scripts, making it easy
626 to integrate into existing projects. Powerful and flexible Autoconf macros
627 are available, allowing you to easily make adjustments to the installation
628 procedure based on the capabilities of the target computer.")
629 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
632 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))