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 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 ;; TODO: remove `if' in the next rebuild cycle.
63 (if (%current-target-system)
64 `(("bash" ,bash-minimal)
72 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
73 ;; should use our own "cpp" instead of "/lib/cpp".
75 ,@(if (%current-target-system)
77 (modify-phases %standard-phases
78 (add-after 'install 'patch-non-shebang-references
79 (lambda* (#:key build inputs outputs #:allow-other-keys)
80 ;; `patch-shebangs' patches shebangs only, and the Perl
81 ;; scripts use a re-exec feature that references the
82 ;; build hosts' perl. Also, BASH and M4 store references
83 ;; hide in the scripts.
84 (let ((bash (assoc-ref inputs "bash"))
85 (m4 (assoc-ref inputs "m4"))
86 (perl (assoc-ref inputs "perl"))
87 (out (assoc-ref outputs "out"))
88 (store-directory (%store-directory)))
89 (substitute* (find-files (string-append out "/bin"))
90 (((string-append store-directory "/[^/]*-bash-[^/]*"))
92 (((string-append store-directory "/[^/]*-m4-[^/]*"))
94 (((string-append store-directory "/[^/]*-perl-[^/]*"))
98 (home-page "https://www.gnu.org/software/autoconf/")
99 (synopsis "Create source code configuration scripts")
101 "Autoconf offers the developer a robust set of M4 macros which expand
102 into shell code to test the features of Unix-like systems and to adapt
103 automatically their software package to these systems. The resulting shell
104 scripts are self-contained and portable, freeing the user from needing to
105 know anything about Autoconf or M4.")
106 (license gpl3+))) ; some files are under GPLv2+
108 ;; This is the renaissance version, which is not widely supported yet.
109 (define-public autoconf-2.71
111 (inherit autoconf-2.69)
116 (uri (string-append "mirror://gnu/autoconf/autoconf-"
120 "197sl23irn6s9pd54rxj5vcp5y8dv65jb9yfqgr2g56cxg7q6k7i"))))
122 (substitute-keyword-arguments (package-arguments autoconf-2.69)
124 ;; FIXME: To run the test suite, fix all the instances where scripts
125 ;; generates "#! /bin/sh" shebangs.
127 ((#:phases phases '%standard-phases)
128 `(modify-phases ,phases
129 (add-before 'check 'prepare-tests
131 (for-each patch-shebang
132 (append (find-files "tests"
134 (executable-file? file)))
137 (executable-file? file)))))
140 (define-public autoconf autoconf-2.69)
142 (define-public autoconf-2.68
143 (package (inherit autoconf)
148 (uri (string-append "mirror://gnu/autoconf/autoconf-"
152 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
154 (define-public autoconf-2.64
155 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
156 (package (inherit autoconf)
161 (uri (string-append "mirror://gnu/autoconf/autoconf-"
165 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
167 (define-public autoconf-2.13
168 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
169 (package (inherit autoconf)
174 (uri (string-append "mirror://gnu/autoconf/autoconf-"
178 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
182 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
183 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
184 ;; and pass a simplified set of arguments.
185 (modify-phases %standard-phases
187 (lambda* (#:key build inputs outputs #:allow-other-keys)
188 (let ((bash (which "bash"))
189 (out (assoc-ref outputs "out")))
190 (setenv "CONFIG_SHELL" bash)
191 (setenv "SHELL" bash)
192 (invoke bash "./configure"
193 (string-append "--prefix=" out)
194 (string-append "--build=" build))))))))))
197 (define (make-autoconf-wrapper autoconf)
198 "Return a wrapper around AUTOCONF that generates `configure' scripts that
199 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
200 only be used internally---users should not end up distributing `configure'
201 files with a system-specific shebang."
202 (package (inherit autoconf)
203 (name (string-append (package-name autoconf) "-wrapper"))
204 (build-system trivial-build-system)
206 ;; XXX: Kludge to hide the circular dependency.
207 ,(module-ref (resolve-interface '(gnu packages guile))
209 ("autoconf" ,autoconf)
212 '(#:modules ((guix build utils))
215 (use-modules (guix build utils))
216 (let* ((out (assoc-ref %outputs "out"))
217 (bin (string-append out "/bin"))
218 (autoconf (string-append
219 (assoc-ref %build-inputs "autoconf")
221 (guile (string-append
222 (assoc-ref %build-inputs "guile")
225 (assoc-ref %build-inputs "bash")
227 (modules ((compose dirname dirname dirname)
228 (search-path %load-path
229 "guix/build/utils.scm"))))
232 ;; Symlink all the binaries but `autoconf'.
233 (with-directory-excursion bin
234 (for-each (lambda (file)
235 (unless (string=? (basename file) "autoconf")
236 (symlink file (basename file))))
237 (find-files (dirname autoconf) ".*")))
239 ;; Add an `autoconf' binary that wraps the real one.
240 (call-with-output-file (string-append bin "/autoconf")
242 ;; Shamefully, Guile can be used in shebangs only if a
243 ;; single argument is passed (-ds); otherwise it gets
244 ;; them all as a single argument and fails to parse them.
246 export GUILE_LOAD_PATH=\"~a\"
247 export GUILE_LOAD_COMPILED_PATH=\"~a\"
248 exec ~a --no-auto-compile \"$0\" \"$@\"
250 sh modules modules guile)
253 (use-modules (guix build utils))
254 (let ((result (apply system* ,autoconf
255 (cdr (command-line)))))
256 (when (and (file-exists? "configure")
257 (not (file-exists? "/bin/sh")))
258 ;; Patch regardless of RESULT, because `autoconf
259 ;; -Werror' can both create a `configure' file and
260 ;; return a non-zero exit code.
261 (patch-shebang "configure"))
262 (exit (status:exit-val result))))
264 (chmod (string-append bin "/autoconf") #o555)
267 ;; Do not show it in the UI since it's meant for internal use.
268 (properties '((hidden? . #t)))))
270 (define-public autoconf-wrapper
271 (make-autoconf-wrapper autoconf))
273 (define-public autoconf-archive
275 (name "autoconf-archive")
276 (version "2019.01.06")
280 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
284 "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
285 (build-system gnu-build-system)
286 (home-page "https://www.gnu.org/software/autoconf-archive/")
287 (synopsis "Collection of freely reusable Autoconf macros")
289 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
290 greatly expanding the domain of its functionality. These macros have been
291 contributed as free software by the community.")
294 (define-public autobuild
300 (uri (string-append "mirror://savannah/autobuild/autobuild-"
304 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
305 (build-system gnu-build-system)
306 (inputs `(("perl" ,perl)))
307 (synopsis "Process generated build logs")
308 (description "Autobuild is a package that processes build logs generated
309 when building software. Autobuild is primarily focused on packages using
310 Autoconf and Automake, but can be used with other build systems too.
311 Autobuild generates an HTML summary file, containing links to each build log.
312 The summary includes project name, version, build hostname, host type (cross
313 compile aware), date of build, and indication of success or failure. The
314 output is indexed in many ways to simplify browsing.")
315 (home-page "https://josefsson.org/autobuild/")
318 (define-public automake
324 (uri (string-append "mirror://gnu/automake/automake-"
328 "1l7dkqbsmbf94ax29jj1jf6a0r6ikc8jybg1p5m0c3ki7pg5ki6c"))
330 (search-patches "automake-skip-amhello-tests.patch"))))
331 (build-system gnu-build-system)
333 ;; TODO: remove `if' in the next rebuild cycle.
334 (if (%current-target-system)
335 `(("autoconf" ,autoconf-wrapper)
336 ("bash" ,bash-minimal)
340 `(("autoconf" ,autoconf-wrapper)
343 (list (search-path-specification
344 (variable "ACLOCAL_PATH")
345 (files '("share/aclocal")))))
347 `(#:modules ((guix build gnu-build-system)
353 (modify-phases %standard-phases
354 (add-before 'patch-source-shebangs 'patch-tests-shebangs
356 (let ((sh (which "sh")))
357 (substitute* (find-files "t" "\\.(sh|tap)$")
358 (("#![[:blank:]]?/bin/sh")
359 (string-append "#!" sh)))
361 ;; Set these variables for all the `configure' runs
362 ;; that occur during the test suite.
364 (setenv "CONFIG_SHELL" sh)
367 (add-before 'check 'skip-test
369 ;; This test requires 'etags' and fails if it's missing.
371 (substitute* "t/tags-lisp-space.sh"
373 (string-append "exit 77\n" all "\n")))
376 ,@(if (%current-target-system)
377 `((add-after 'install 'patch-non-shebang-references
378 (lambda* (#:key build inputs outputs #:allow-other-keys)
379 ;; `patch-shebangs' patches shebangs only, and the Perl
380 ;; scripts use a re-exec feature that references the
381 ;; build hosts' perl. Also, AUTOCONF and BASH store
382 ;; references hide in the scripts.
383 (let ((autoconf (assoc-ref inputs "autoconf"))
384 (bash (assoc-ref inputs "bash"))
385 (perl (assoc-ref inputs "perl"))
386 (out (assoc-ref outputs "out"))
387 (store-directory (%store-directory)))
388 (substitute* (find-files (string-append out "/bin"))
389 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
391 (((string-append store-directory "/[^/]*-bash-[^/]*"))
393 (((string-append store-directory "/[^/]*-perl-[^/]*"))
398 ;; Files like `install-sh', `mdate.sh', etc. must use
399 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
400 ;; in the wild. See <http://bugs.gnu.org/14201> for an
402 (add-after 'install 'unpatch-shebangs
403 (lambda* (#:key outputs #:allow-other-keys)
404 (let* ((out (assoc-ref outputs "out"))
405 (dir (string-append out "/share")))
406 (define (starts-with-shebang? file)
407 (equal? (call-with-input-file file
409 (list (get-u8 p) (get-u8 p))))
410 (map char->integer '(#\# #\!))))
412 (for-each (lambda (file)
413 (when (and (starts-with-shebang? file)
414 (executable-file? file))
415 (format #t "restoring shebang on `~a'~%"
420 (("^#!.*/bin/env(.*)$" _ args)
421 (string-append "#!/usr/bin/env"
423 (find-files dir ".*"))
425 (home-page "https://www.gnu.org/software/automake/")
426 (synopsis "Making GNU standards-compliant Makefiles")
428 "Automake the part of the GNU build system for producing
429 standards-compliant Makefiles. Build requirements are entered in an
430 intuitive format and then Automake works with Autoconf to produce a robust
431 Makefile, simplifying the entire process for the developer.")
432 (license gpl2+))) ; some files are under GPLv3+
434 (define-public libtool
440 (uri (string-append "mirror://gnu/libtool/libtool-"
444 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
445 (patches (search-patches "libtool-skip-tests2.patch"))))
446 (build-system gnu-build-system)
447 (propagated-inputs `(("m4" ,m4)))
448 (native-inputs `(("m4" ,m4)
450 ;; XXX: this shouldn't be necessary, but without it test
451 ;; 102 fails because it cannot find ltdl/libltdl.la.
453 ("help2man" ,help2man) ;because we modify ltmain.sh
454 ("automake" ,automake) ;some tests rely on 'aclocal'
455 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
458 `(;; Libltdl is provided as a separate package, so don't install it here.
459 #:configure-flags '("--disable-ltdl-install")
461 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
462 ;; <http://hydra.gnu.org/build/181662>.
463 ;; Also, do not run tests when cross compiling
464 #:tests? ,(not (or (%current-target-system)
465 (string-prefix? "mips64"
469 (modify-phases %standard-phases
470 (add-before 'check 'pre-check
471 (lambda* (#:key inputs native-inputs #:allow-other-keys)
472 ;; Run the test suite in parallel, if possible.
473 (setenv "TESTSUITEFLAGS"
476 (number->string (parallel-job-count))))
477 ;; Patch references to /bin/sh.
478 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
479 (substitute* "tests/testsuite"
481 (string-append bash "/bin/sh")))
483 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
484 (lambda* (#:key inputs #:allow-other-keys)
485 (substitute* "build-aux/ltmain.in"
486 (("^#!.*/bin/sh$") "#!/bin/sh"))
489 (synopsis "Generic shared library support tools")
491 "GNU Libtool helps in the creation and use of shared libraries, by
492 presenting a single consistent, portable interface that hides the usual
493 complexity of working with shared libraries across platforms.")
495 (home-page "https://www.gnu.org/software/libtool/")))
497 (define-public config
499 (commit "c8ddc8472f8efcadafc1ef53ca1d863415fddd5f"))
502 (version (git-version "0.0.0" revision commit)) ;no release tag
506 (url "https://git.savannah.gnu.org/git/config.git/")
508 (file-name (git-file-name name version))
511 "0x6ycvkmmhhhag97wsf0pw8n5fvh12rjvrck90rz17my4ys16qwv"))))
512 (build-system gnu-build-system)
514 `(#:phases (modify-phases %standard-phases
515 (add-after 'unpack 'patch-/bin/sh
517 (substitute* "testsuite/config-guess.sh"
519 (string-append "#!" (which "sh"))))
523 (invoke "make" "manpages")))
526 (lambda* (#:key outputs #:allow-other-keys)
527 (let* ((out (assoc-ref outputs "out"))
528 (bin (string-append out "/bin"))
529 (man1 (string-append out "/share/man/man1")))
530 (install-file "config.guess" bin)
531 (install-file "config.sub" bin)
532 (install-file "doc/config.guess.1" man1)
533 (install-file "doc/config.sub.1" man1)
536 `(("help2man" ,help2man)))
537 (home-page "https://savannah.gnu.org/projects/config")
538 (synopsis "Ubiquitious config.guess and config.sub scripts")
539 (description "The `config.guess' script tries to guess a canonical system triple,
540 and `config.sub' validates and canonicalizes. These are used as part of
541 configuration in nearly all GNU packages (and many others).")
544 (define-public libltdl
545 ;; This is a libltdl package separate from the libtool package. This is
546 ;; useful because, unlike libtool, it has zero extra dependencies (making it
547 ;; readily usable during bootstrap), and it builds very quickly since
548 ;; Libtool's extensive test suite isn't run.
554 (uri (string-append "mirror://gnu/libtool/libtool-"
558 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
559 (build-system gnu-build-system)
561 '(#:configure-flags '("--enable-ltdl-install") ;really install it
562 #:phases (modify-phases %standard-phases
563 (add-before 'configure 'change-directory
564 (lambda _ (chdir "libltdl") #t)))))
566 (synopsis "System-independent dlopen wrapper of GNU libtool")
567 (description (package-description libtool))
568 (home-page (package-home-page libtool))
571 (define-public pyconfigure
577 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
581 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
582 (build-system gnu-build-system)
585 (modify-phases %standard-phases
586 (add-before 'configure 'patch-python
588 (substitute* "pyconf.in"
589 (("/usr/bin/env python") (which "python3")))
592 `(("python" ,python-3)))
593 (synopsis "@command{configure} interface for Python-based packages")
595 "GNU pyconfigure provides template files for easily implementing
596 standards-compliant configure scripts and Makefiles for Python-based packages.
597 It is designed to work alongside existing Python setup scripts, making it easy
598 to integrate into existing projects. Powerful and flexible Autoconf macros
599 are available, allowing you to easily make adjustments to the installation
600 procedure based on the capabilities of the target computer.")
601 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
604 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))