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 ;;; 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 (define-public autoconf-2.70
110 (inherit autoconf-2.69)
115 (uri (string-append "mirror://gnu/autoconf/autoconf-"
119 "1ipckz0wr2mvhj9n3ys54fmf2aksin6bhqvzl304bn6rc1w257ps"))))
121 (substitute-keyword-arguments (package-arguments autoconf-2.69)
123 ;; FIXME: To run the test suite, fix all the instances where scripts
124 ;; generates "#! /bin/sh" shebangs.
126 ((#:phases phases '%standard-phases)
127 `(modify-phases ,phases
128 (add-before 'check 'prepare-tests
130 (for-each patch-shebang
131 (append (find-files "tests"
133 (executable-file? file)))
136 (executable-file? file)))))
139 (define-public autoconf autoconf-2.69)
141 (define-public autoconf-2.68
142 (package (inherit autoconf)
147 (uri (string-append "mirror://gnu/autoconf/autoconf-"
151 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
153 (define-public autoconf-2.64
154 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
155 (package (inherit autoconf)
160 (uri (string-append "mirror://gnu/autoconf/autoconf-"
164 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
166 (define-public autoconf-2.13
167 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
168 (package (inherit autoconf)
173 (uri (string-append "mirror://gnu/autoconf/autoconf-"
177 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
181 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
182 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
183 ;; and pass a simplified set of arguments.
184 (modify-phases %standard-phases
186 (lambda* (#:key build inputs outputs #:allow-other-keys)
187 (let ((bash (which "bash"))
188 (out (assoc-ref outputs "out")))
189 (setenv "CONFIG_SHELL" bash)
190 (setenv "SHELL" bash)
191 (invoke bash "./configure"
192 (string-append "--prefix=" out)
193 (string-append "--build=" build))))))))))
196 (define (make-autoconf-wrapper autoconf)
197 "Return a wrapper around AUTOCONF that generates `configure' scripts that
198 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
199 only be used internally---users should not end up distributing `configure'
200 files with a system-specific shebang."
201 (package (inherit autoconf)
202 (name (string-append (package-name autoconf) "-wrapper"))
203 (build-system trivial-build-system)
205 ;; XXX: Kludge to hide the circular dependency.
206 ,(module-ref (resolve-interface '(gnu packages guile))
208 ("autoconf" ,autoconf)
211 '(#:modules ((guix build utils))
214 (use-modules (guix build utils))
215 (let* ((out (assoc-ref %outputs "out"))
216 (bin (string-append out "/bin"))
217 (autoconf (string-append
218 (assoc-ref %build-inputs "autoconf")
220 (guile (string-append
221 (assoc-ref %build-inputs "guile")
224 (assoc-ref %build-inputs "bash")
226 (modules ((compose dirname dirname dirname)
227 (search-path %load-path
228 "guix/build/utils.scm"))))
231 ;; Symlink all the binaries but `autoconf'.
232 (with-directory-excursion bin
233 (for-each (lambda (file)
234 (unless (string=? (basename file) "autoconf")
235 (symlink file (basename file))))
236 (find-files (dirname autoconf) ".*")))
238 ;; Add an `autoconf' binary that wraps the real one.
239 (call-with-output-file (string-append bin "/autoconf")
241 ;; Shamefully, Guile can be used in shebangs only if a
242 ;; single argument is passed (-ds); otherwise it gets
243 ;; them all as a single argument and fails to parse them.
245 export GUILE_LOAD_PATH=\"~a\"
246 export GUILE_LOAD_COMPILED_PATH=\"~a\"
247 exec ~a --no-auto-compile \"$0\" \"$@\"
249 sh modules modules guile)
252 (use-modules (guix build utils))
253 (let ((result (apply system* ,autoconf
254 (cdr (command-line)))))
255 (when (and (file-exists? "configure")
256 (not (file-exists? "/bin/sh")))
257 ;; Patch regardless of RESULT, because `autoconf
258 ;; -Werror' can both create a `configure' file and
259 ;; return a non-zero exit code.
260 (patch-shebang "configure"))
261 (exit (status:exit-val result))))
263 (chmod (string-append bin "/autoconf") #o555)
266 ;; Do not show it in the UI since it's meant for internal use.
267 (properties '((hidden? . #t)))))
269 (define-public autoconf-wrapper
270 (make-autoconf-wrapper autoconf))
272 (define-public autoconf-archive
274 (name "autoconf-archive")
275 (version "2019.01.06")
279 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
283 "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
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 "1l7dkqbsmbf94ax29jj1jf6a0r6ikc8jybg1p5m0c3ki7pg5ki6c"))
329 (search-patches "automake-skip-amhello-tests.patch"))))
330 (build-system gnu-build-system)
332 ;; TODO: remove `if' in the next rebuild cycle.
333 (if (%current-target-system)
334 `(("autoconf" ,autoconf-wrapper)
335 ("bash" ,bash-minimal)
339 `(("autoconf" ,autoconf-wrapper)
342 (list (search-path-specification
343 (variable "ACLOCAL_PATH")
344 (files '("share/aclocal")))))
346 `(#:modules ((guix build gnu-build-system)
352 (modify-phases %standard-phases
353 (add-before 'patch-source-shebangs 'patch-tests-shebangs
355 (let ((sh (which "sh")))
356 (substitute* (find-files "t" "\\.(sh|tap)$")
357 (("#![[:blank:]]?/bin/sh")
358 (string-append "#!" sh)))
360 ;; Set these variables for all the `configure' runs
361 ;; that occur during the test suite.
363 (setenv "CONFIG_SHELL" sh)
366 (add-before 'check 'skip-test
368 ;; This test requires 'etags' and fails if it's missing.
370 (substitute* "t/tags-lisp-space.sh"
372 (string-append "exit 77\n" all "\n")))
375 ,@(if (%current-target-system)
376 `((add-after 'install 'patch-non-shebang-references
377 (lambda* (#:key build inputs outputs #:allow-other-keys)
378 ;; `patch-shebangs' patches shebangs only, and the Perl
379 ;; scripts use a re-exec feature that references the
380 ;; build hosts' perl. Also, AUTOCONF and BASH store
381 ;; references hide in the scripts.
382 (let ((autoconf (assoc-ref inputs "autoconf"))
383 (bash (assoc-ref inputs "bash"))
384 (perl (assoc-ref inputs "perl"))
385 (out (assoc-ref outputs "out"))
386 (store-directory (%store-directory)))
387 (substitute* (find-files (string-append out "/bin"))
388 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
390 (((string-append store-directory "/[^/]*-bash-[^/]*"))
392 (((string-append store-directory "/[^/]*-perl-[^/]*"))
397 ;; Files like `install-sh', `mdate.sh', etc. must use
398 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
399 ;; in the wild. See <http://bugs.gnu.org/14201> for an
401 (add-after 'install 'unpatch-shebangs
402 (lambda* (#:key outputs #:allow-other-keys)
403 (let* ((out (assoc-ref outputs "out"))
404 (dir (string-append out "/share")))
405 (define (starts-with-shebang? file)
406 (equal? (call-with-input-file file
408 (list (get-u8 p) (get-u8 p))))
409 (map char->integer '(#\# #\!))))
411 (for-each (lambda (file)
412 (when (and (starts-with-shebang? file)
413 (executable-file? file))
414 (format #t "restoring shebang on `~a'~%"
419 (("^#!.*/bin/env(.*)$" _ args)
420 (string-append "#!/usr/bin/env"
422 (find-files dir ".*"))
424 (home-page "https://www.gnu.org/software/automake/")
425 (synopsis "Making GNU standards-compliant Makefiles")
427 "Automake the part of the GNU build system for producing
428 standards-compliant Makefiles. Build requirements are entered in an
429 intuitive format and then Automake works with Autoconf to produce a robust
430 Makefile, simplifying the entire process for the developer.")
431 (license gpl2+))) ; some files are under GPLv3+
433 (define-public libtool
439 (uri (string-append "mirror://gnu/libtool/libtool-"
443 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
444 (patches (search-patches "libtool-skip-tests2.patch"))))
445 (build-system gnu-build-system)
446 (propagated-inputs `(("m4" ,m4)))
447 (native-inputs `(("m4" ,m4)
449 ;; XXX: this shouldn't be necessary, but without it test
450 ;; 102 fails because it cannot find ltdl/libltdl.la.
452 ("help2man" ,help2man) ;because we modify ltmain.sh
453 ("automake" ,automake) ;some tests rely on 'aclocal'
454 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
457 `(;; Libltdl is provided as a separate package, so don't install it here.
458 #:configure-flags '("--disable-ltdl-install")
460 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
461 ;; <http://hydra.gnu.org/build/181662>.
462 ;; Also, do not run tests when cross compiling
463 #:tests? ,(not (or (%current-target-system)
464 (string-prefix? "mips64"
468 (modify-phases %standard-phases
469 (add-before 'check 'pre-check
470 (lambda* (#:key inputs native-inputs #:allow-other-keys)
471 ;; Run the test suite in parallel, if possible.
472 (setenv "TESTSUITEFLAGS"
475 (number->string (parallel-job-count))))
476 ;; Patch references to /bin/sh.
477 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
478 (substitute* "tests/testsuite"
480 (string-append bash "/bin/sh")))
482 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
483 (lambda* (#:key inputs #:allow-other-keys)
484 (substitute* "build-aux/ltmain.in"
485 (("^#!.*/bin/sh$") "#!/bin/sh"))
488 (synopsis "Generic shared library support tools")
490 "GNU Libtool helps in the creation and use of shared libraries, by
491 presenting a single consistent, portable interface that hides the usual
492 complexity of working with shared libraries across platforms.")
494 (home-page "https://www.gnu.org/software/libtool/")))
496 (define-public config
498 (commit "c8ddc8472f8efcadafc1ef53ca1d863415fddd5f"))
501 (version (git-version "0.0.0" revision commit)) ;no release tag
505 (url "https://git.savannah.gnu.org/git/config.git/")
507 (file-name (git-file-name name version))
510 "0x6ycvkmmhhhag97wsf0pw8n5fvh12rjvrck90rz17my4ys16qwv"))))
511 (build-system gnu-build-system)
513 `(#:phases (modify-phases %standard-phases
514 (add-after 'unpack 'patch-/bin/sh
516 (substitute* "testsuite/config-guess.sh"
518 (string-append "#!" (which "sh"))))
522 (invoke "make" "manpages")))
525 (lambda* (#:key outputs #:allow-other-keys)
526 (let* ((out (assoc-ref outputs "out"))
527 (bin (string-append out "/bin"))
528 (man1 (string-append out "/share/man/man1")))
529 (install-file "config.guess" bin)
530 (install-file "config.sub" bin)
531 (install-file "doc/config.guess.1" man1)
532 (install-file "doc/config.sub.1" man1)
535 `(("help2man" ,help2man)))
536 (home-page "https://savannah.gnu.org/projects/config")
537 (synopsis "Ubiquitious config.guess and config.sub scripts")
538 (description "The `config.guess' script tries to guess a canonical system triple,
539 and `config.sub' validates and canonicalizes. These are used as part of
540 configuration in nearly all GNU packages (and many others).")
543 (define-public libltdl
544 ;; This is a libltdl package separate from the libtool package. This is
545 ;; useful because, unlike libtool, it has zero extra dependencies (making it
546 ;; readily usable during bootstrap), and it builds very quickly since
547 ;; Libtool's extensive test suite isn't run.
553 (uri (string-append "mirror://gnu/libtool/libtool-"
557 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
558 (build-system gnu-build-system)
560 '(#:configure-flags '("--enable-ltdl-install") ;really install it
561 #:phases (modify-phases %standard-phases
562 (add-before 'configure 'change-directory
563 (lambda _ (chdir "libltdl") #t)))))
565 (synopsis "System-independent dlopen wrapper of GNU libtool")
566 (description (package-description libtool))
567 (home-page (package-home-page libtool))
570 (define-public pyconfigure
576 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
580 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
581 (build-system gnu-build-system)
584 (modify-phases %standard-phases
585 (add-before 'configure 'patch-python
587 (substitute* "pyconf.in"
588 (("/usr/bin/env python") (which "python3")))
591 `(("python" ,python-3)))
592 (synopsis "@command{configure} interface for Python-based packages")
594 "GNU pyconfigure provides template files for easily implementing
595 standards-compliant configure scripts and Makefiles for Python-based packages.
596 It is designed to work alongside existing Python setup scripts, making it easy
597 to integrate into existing projects. Powerful and flexible Autoconf macros
598 are available, allowing you to easily make adjustments to the installation
599 procedure based on the capabilities of the target computer.")
600 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
603 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))