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>
15 ;;; This file is part of GNU Guix.
17 ;;; GNU Guix is free software; you can redistribute it and/or modify it
18 ;;; under the terms of the GNU General Public License as published by
19 ;;; the Free Software Foundation; either version 3 of the License, or (at
20 ;;; your option) any later version.
22 ;;; GNU Guix is distributed in the hope that it will be useful, but
23 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
24 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 ;;; GNU General Public License for more details.
27 ;;; You should have received a copy of the GNU General Public License
28 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
30 (define-module (gnu packages autotools)
31 #:use-module (guix licenses)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages m4)
36 #:use-module (gnu packages man)
37 #:use-module (gnu packages bash)
38 #:use-module (guix utils)
39 #:use-module (guix packages)
40 #:use-module (guix download)
41 #:use-module (guix build-system gnu)
42 #:use-module (guix build-system trivial)
43 #:use-module (ice-9 match)
44 #:export (autoconf-wrapper))
46 (define-public autoconf
53 (uri (string-append "mirror://gnu/autoconf/autoconf-"
57 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
58 (build-system gnu-build-system)
60 ;; TODO: remove `if' in the next rebuild cycle.
61 (if (%current-target-system)
62 `(("bash" ,bash-minimal)
70 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
71 ;; should use our own "cpp" instead of "/lib/cpp".
73 ,@(if (%current-target-system)
75 (modify-phases %standard-phases
76 (add-after 'install 'patch-non-shebang-references
77 (lambda* (#:key build inputs outputs #:allow-other-keys)
78 ;; `patch-shebangs' patches shebangs only, and the Perl
79 ;; scripts use a re-exec feature that references the
80 ;; build hosts' perl. Also, BASH and M4 store references
81 ;; hide in the scripts.
82 (let ((bash (assoc-ref inputs "bash"))
83 (m4 (assoc-ref inputs "m4"))
84 (perl (assoc-ref inputs "perl"))
85 (out (assoc-ref outputs "out"))
86 (store-directory (%store-directory)))
87 (substitute* (find-files (string-append out "/bin"))
88 (((string-append store-directory "/[^/]*-bash-[^/]*"))
90 (((string-append store-directory "/[^/]*-m4-[^/]*"))
92 (((string-append store-directory "/[^/]*-perl-[^/]*"))
96 (home-page "https://www.gnu.org/software/autoconf/")
97 (synopsis "Create source code configuration scripts")
99 "Autoconf offers the developer a robust set of M4 macros which expand
100 into shell code to test the features of Unix-like systems and to adapt
101 automatically their software package to these systems. The resulting shell
102 scripts are self-contained and portable, freeing the user from needing to
103 know anything about Autoconf or M4.")
104 (license gpl3+))) ; some files are under GPLv2+
106 (define-public autoconf-2.68
107 (package (inherit autoconf)
112 (uri (string-append "mirror://gnu/autoconf/autoconf-"
116 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
118 (define-public autoconf-2.64
119 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
120 (package (inherit autoconf)
125 (uri (string-append "mirror://gnu/autoconf/autoconf-"
129 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
131 (define-public autoconf-2.13
132 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
133 (package (inherit autoconf)
138 (uri (string-append "mirror://gnu/autoconf/autoconf-"
142 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
146 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
147 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
148 ;; and pass a simplified set of arguments.
149 (modify-phases %standard-phases
151 (lambda* (#:key build inputs outputs #:allow-other-keys)
152 (let ((bash (which "bash"))
153 (out (assoc-ref outputs "out")))
154 (setenv "CONFIG_SHELL" bash)
155 (setenv "SHELL" bash)
156 (invoke bash "./configure"
157 (string-append "--prefix=" out)
158 (string-append "--build=" build))))))))))
161 (define (make-autoconf-wrapper autoconf)
162 "Return a wrapper around AUTOCONF that generates `configure' scripts that
163 use our own Bash instead of /bin/sh in shebangs. For that reason, it should
164 only be used internally---users should not end up distributing `configure'
165 files with a system-specific shebang."
166 (package (inherit autoconf)
167 (name (string-append (package-name autoconf) "-wrapper"))
168 (build-system trivial-build-system)
170 ;; XXX: Kludge to hide the circular dependency.
171 ,(module-ref (resolve-interface '(gnu packages guile))
173 ("autoconf" ,autoconf)
176 '(#:modules ((guix build utils))
179 (use-modules (guix build utils))
180 (let* ((out (assoc-ref %outputs "out"))
181 (bin (string-append out "/bin"))
182 (autoconf (string-append
183 (assoc-ref %build-inputs "autoconf")
185 (guile (string-append
186 (assoc-ref %build-inputs "guile")
189 (assoc-ref %build-inputs "bash")
191 (modules ((compose dirname dirname dirname)
192 (search-path %load-path
193 "guix/build/utils.scm"))))
196 ;; Symlink all the binaries but `autoconf'.
197 (with-directory-excursion bin
198 (for-each (lambda (file)
199 (unless (string=? (basename file) "autoconf")
200 (symlink file (basename file))))
201 (find-files (dirname autoconf) ".*")))
203 ;; Add an `autoconf' binary that wraps the real one.
204 (call-with-output-file (string-append bin "/autoconf")
206 ;; Shamefully, Guile can be used in shebangs only if a
207 ;; single argument is passed (-ds); otherwise it gets
208 ;; them all as a single argument and fails to parse them.
210 export GUILE_LOAD_PATH=\"~a\"
211 export GUILE_LOAD_COMPILED_PATH=\"~a\"
212 exec ~a --no-auto-compile \"$0\" \"$@\"
214 sh modules modules guile)
217 (use-modules (guix build utils))
218 (let ((result (apply system* ,autoconf
219 (cdr (command-line)))))
220 (when (and (file-exists? "configure")
221 (not (file-exists? "/bin/sh")))
222 ;; Patch regardless of RESULT, because `autoconf
223 ;; -Werror' can both create a `configure' file and
224 ;; return a non-zero exit code.
225 (patch-shebang "configure"))
226 (exit (status:exit-val result))))
228 (chmod (string-append bin "/autoconf") #o555)
231 ;; Do not show it in the UI since it's meant for internal use.
232 (properties '((hidden? . #t)))))
234 (define-public autoconf-wrapper
235 (make-autoconf-wrapper autoconf))
237 (define-public autoconf-archive
239 (name "autoconf-archive")
240 (version "2019.01.06")
244 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
248 "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
249 (build-system gnu-build-system)
250 (home-page "https://www.gnu.org/software/autoconf-archive/")
251 (synopsis "Collection of freely reusable Autoconf macros")
253 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
254 greatly expanding the domain of its functionality. These macros have been
255 contributed as free software by the community.")
258 (define-public autobuild
264 (uri (string-append "mirror://savannah/autobuild/autobuild-"
268 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
269 (build-system gnu-build-system)
270 (inputs `(("perl" ,perl)))
271 (synopsis "Process generated build logs")
272 (description "Autobuild is a package that processes build logs generated
273 when building software. Autobuild is primarily focused on packages using
274 Autoconf and Automake, but can be used with other build systems too.
275 Autobuild generates an HTML summary file, containing links to each build log.
276 The summary includes project name, version, build hostname, host type (cross
277 compile aware), date of build, and indication of success or failure. The
278 output is indexed in many ways to simplify browsing.")
279 (home-page "https://josefsson.org/autobuild/")
282 (define-public automake
288 (uri (string-append "mirror://gnu/automake/automake-"
292 "1l7dkqbsmbf94ax29jj1jf6a0r6ikc8jybg1p5m0c3ki7pg5ki6c"))
294 (search-patches "automake-skip-amhello-tests.patch"))))
295 (build-system gnu-build-system)
297 ;; TODO: remove `if' in the next rebuild cycle.
298 (if (%current-target-system)
299 `(("autoconf" ,autoconf-wrapper)
300 ("bash" ,bash-minimal)
304 `(("autoconf" ,autoconf-wrapper)
307 (list (search-path-specification
308 (variable "ACLOCAL_PATH")
309 (files '("share/aclocal")))))
311 `(#:modules ((guix build gnu-build-system)
317 (modify-phases %standard-phases
318 (add-before 'patch-source-shebangs 'patch-tests-shebangs
320 (let ((sh (which "sh")))
321 (substitute* (find-files "t" "\\.(sh|tap)$")
322 (("#![[:blank:]]?/bin/sh")
323 (string-append "#!" sh)))
325 ;; Set these variables for all the `configure' runs
326 ;; that occur during the test suite.
328 (setenv "CONFIG_SHELL" sh)
331 (add-before 'check 'skip-test
333 ;; This test requires 'etags' and fails if it's missing.
335 (substitute* "t/tags-lisp-space.sh"
337 (string-append "exit 77\n" all "\n")))
340 ,@(if (%current-target-system)
341 `((add-after 'install 'patch-non-shebang-references
342 (lambda* (#:key build inputs outputs #:allow-other-keys)
343 ;; `patch-shebangs' patches shebangs only, and the Perl
344 ;; scripts use a re-exec feature that references the
345 ;; build hosts' perl. Also, AUTOCONF and BASH store
346 ;; references hide in the scripts.
347 (let ((autoconf (assoc-ref inputs "autoconf"))
348 (bash (assoc-ref inputs "bash"))
349 (perl (assoc-ref inputs "perl"))
350 (out (assoc-ref outputs "out"))
351 (store-directory (%store-directory)))
352 (substitute* (find-files (string-append out "/bin"))
353 (((string-append store-directory "/[^/]*-autoconf-[^/]*"))
355 (((string-append store-directory "/[^/]*-bash-[^/]*"))
357 (((string-append store-directory "/[^/]*-perl-[^/]*"))
362 ;; Files like `install-sh', `mdate.sh', etc. must use
363 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
364 ;; in the wild. See <http://bugs.gnu.org/14201> for an
366 (add-after 'install 'unpatch-shebangs
367 (lambda* (#:key outputs #:allow-other-keys)
368 (let* ((out (assoc-ref outputs "out"))
369 (dir (string-append out "/share")))
370 (define (starts-with-shebang? file)
371 (equal? (call-with-input-file file
373 (list (get-u8 p) (get-u8 p))))
374 (map char->integer '(#\# #\!))))
376 (for-each (lambda (file)
377 (when (and (starts-with-shebang? file)
378 (executable-file? file))
379 (format #t "restoring shebang on `~a'~%"
384 (("^#!.*/bin/env(.*)$" _ args)
385 (string-append "#!/usr/bin/env"
387 (find-files dir ".*"))
389 (home-page "https://www.gnu.org/software/automake/")
390 (synopsis "Making GNU standards-compliant Makefiles")
392 "Automake the part of the GNU build system for producing
393 standards-compliant Makefiles. Build requirements are entered in an
394 intuitive format and then Automake works with Autoconf to produce a robust
395 Makefile, simplifying the entire process for the developer.")
396 (license gpl2+))) ; some files are under GPLv3+
398 (define-public libtool
404 (uri (string-append "mirror://gnu/libtool/libtool-"
408 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
409 (patches (search-patches "libtool-skip-tests2.patch"))))
410 (build-system gnu-build-system)
411 (propagated-inputs `(("m4" ,m4)))
412 (native-inputs `(("m4" ,m4)
414 ;; XXX: this shouldn't be necessary, but without it test
415 ;; 102 fails because it cannot find ltdl/libltdl.la.
417 ("help2man" ,help2man) ;because we modify ltmain.sh
418 ("automake" ,automake) ;some tests rely on 'aclocal'
419 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
422 `(;; Libltdl is provided as a separate package, so don't install it here.
423 #:configure-flags '("--disable-ltdl-install")
425 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
426 ;; <http://hydra.gnu.org/build/181662>.
427 ;; Also, do not run tests when cross compiling
428 #:tests? ,(not (or (%current-target-system)
429 (string-prefix? "mips64"
433 (modify-phases %standard-phases
434 (add-before 'check 'pre-check
435 (lambda* (#:key inputs native-inputs #:allow-other-keys)
436 ;; Run the test suite in parallel, if possible.
437 (setenv "TESTSUITEFLAGS"
440 (number->string (parallel-job-count))))
441 ;; Patch references to /bin/sh.
442 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
443 (substitute* "tests/testsuite"
445 (string-append bash "/bin/sh")))
447 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
448 (lambda* (#:key inputs #:allow-other-keys)
449 (substitute* "build-aux/ltmain.in"
450 (("^#!.*/bin/sh$") "#!/bin/sh"))
453 (synopsis "Generic shared library support tools")
455 "GNU Libtool helps in the creation and use of shared libraries, by
456 presenting a single consistent, portable interface that hides the usual
457 complexity of working with shared libraries across platforms.")
459 (home-page "https://www.gnu.org/software/libtool/")))
461 (define-public libltdl
462 ;; This is a libltdl package separate from the libtool package. This is
463 ;; useful because, unlike libtool, it has zero extra dependencies (making it
464 ;; readily usable during bootstrap), and it builds very quickly since
465 ;; Libtool's extensive test suite isn't run.
471 (uri (string-append "mirror://gnu/libtool/libtool-"
475 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
476 (build-system gnu-build-system)
478 '(#:configure-flags '("--enable-ltdl-install") ;really install it
479 #:phases (modify-phases %standard-phases
480 (add-before 'configure 'change-directory
481 (lambda _ (chdir "libltdl") #t)))))
483 (synopsis "System-independent dlopen wrapper of GNU libtool")
484 (description (package-description libtool))
485 (home-page (package-home-page libtool))
488 (define-public pyconfigure
494 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
498 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
499 (build-system gnu-build-system)
502 (modify-phases %standard-phases
503 (add-before 'configure 'patch-python
505 (substitute* "pyconf.in"
506 (("/usr/bin/env python") (which "python3")))
509 `(("python" ,python-3)))
510 (synopsis "@command{configure} interface for Python-based packages")
512 "GNU pyconfigure provides template files for easily implementing
513 standards-compliant configure scripts and Makefiles for Python-based packages.
514 It is designed to work alongside existing Python setup scripts, making it easy
515 to integrate into existing projects. Powerful and flexible Autoconf macros
516 are available, allowing you to easily make adjustments to the installation
517 procedure based on the capabilities of the target computer.")
518 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
521 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))