gnu: calibre: Wrap QTWEBENGINEPROCESS_PATH.
[jackhill/guix/guix.git] / gnu / packages / autotools.scm
CommitLineData
233e7676
LC
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
72a5cc53 3;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2020 Ludovic Courtès <ludo@gnu.org>
2b00a550 4;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
c6e96280 5;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
a33391bd 6;;; Copyright © 2015, 2017, 2018 Mark H Weaver <mhw@netris.org>
6b0686fa 7;;; Copyright © 2016 David Thompson <davet@gnu.org>
3c986a7d 8;;; Copyright © 2017 Nikita <nikita@n0.is>
c71bbfcc 9;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
cc355333 10;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
2b4e5568 11;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
647cfcf6 12;;; Copyright © 2019 Pierre-Moana Levesque <pierre.moana.levesque@gmail.com>
b085d436 13;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
80ffc708 14;;;
233e7676 15;;; This file is part of GNU Guix.
80ffc708 16;;;
233e7676 17;;; GNU Guix is free software; you can redistribute it and/or modify it
80ffc708
NK
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.
21;;;
233e7676 22;;; GNU Guix is distributed in the hope that it will be useful, but
80ffc708
NK
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.
26;;;
27;;; You should have received a copy of the GNU General Public License
233e7676 28;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
80ffc708 29
1ffa7090 30(define-module (gnu packages autotools)
4a44e743 31 #:use-module (guix licenses)
59a43334 32 #:use-module (gnu packages)
1ffa7090 33 #:use-module (gnu packages perl)
bfe88e0c 34 #:use-module (gnu packages python)
1ffa7090 35 #:use-module (gnu packages m4)
98341757 36 #:use-module (gnu packages man)
7cd1d7bd
LC
37 #:use-module (gnu packages bash)
38 #:use-module (guix utils)
80ffc708
NK
39 #:use-module (guix packages)
40 #:use-module (guix download)
7cd1d7bd 41 #:use-module (guix build-system gnu)
c6e96280
MR
42 #:use-module (guix build-system trivial)
43 #:use-module (ice-9 match)
44 #:export (autoconf-wrapper))
80ffc708
NK
45
46(define-public autoconf
47 (package
48 (name "autoconf")
49 (version "2.69")
50 (source
51 (origin
52 (method url-fetch)
53 (uri (string-append "mirror://gnu/autoconf/autoconf-"
54 version ".tar.xz"))
55 (sha256
56 (base32
57 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
58 (build-system gnu-build-system)
b085d436
JN
59 (inputs
60 ;; TODO: remove `if' in the next rebuild cycle.
61 (if (%current-target-system)
62 `(("bash" ,bash-minimal)
63 ("perl" ,perl)
64 ("m4" ,m4))
65 '()))
a6abac9f 66 (native-inputs
80ffc708
NK
67 `(("perl" ,perl)
68 ("m4" ,m4)))
b085d436
JN
69 (arguments
70 `(;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
71 ;; should use our own "cpp" instead of "/lib/cpp".
72 #:tests? #f
73 ,@(if (%current-target-system)
74 `(#:phases
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-[^/]*"))
89 bash)
90 (((string-append store-directory "/[^/]*-m4-[^/]*"))
91 m4)
92 (((string-append store-directory "/[^/]*-perl-[^/]*"))
93 perl))
94 #t)))))
95 '())))
25ee4a47 96 (home-page "https://www.gnu.org/software/autoconf/")
f50d2669 97 (synopsis "Create source code configuration scripts")
80ffc708 98 (description
a22dc0c4
LC
99 "Autoconf offers the developer a robust set of M4 macros which expand
100into shell code to test the features of Unix-like systems and to adapt
101automatically their software package to these systems. The resulting shell
102scripts are self-contained and portable, freeing the user from needing to
103know anything about Autoconf or M4.")
4a44e743 104 (license gpl3+))) ; some files are under GPLv2+
80ffc708 105
c6e96280
MR
106(define-public autoconf-2.68
107 (package (inherit autoconf)
108 (version "2.68")
109 (source
110 (origin
111 (method url-fetch)
112 (uri (string-append "mirror://gnu/autoconf/autoconf-"
113 version ".tar.xz"))
114 (sha256
115 (base32
116 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
117
2a7050ab
LC
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)
121 (version "2.64")
122 (source
123 (origin
124 (method url-fetch)
125 (uri (string-append "mirror://gnu/autoconf/autoconf-"
126 version ".tar.xz"))
127 (sha256
128 (base32
129 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
130
fe18e257
MW
131(define-public autoconf-2.13
132 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
133 (package (inherit autoconf)
134 (version "2.13")
135 (source
136 (origin
137 (method url-fetch)
138 (uri (string-append "mirror://gnu/autoconf/autoconf-"
139 version ".tar.gz"))
140 (sha256
141 (base32
142 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
143 (arguments
144 `(#:tests? #f
145 #:phases
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
150 (replace 'configure
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)
95cc40a8
MW
156 (invoke bash "./configure"
157 (string-append "--prefix=" out)
158 (string-append "--build=" build))))))))))
fe18e257 159
2a7050ab 160
464f5447
LC
161(define (make-autoconf-wrapper autoconf)
162 "Return a wrapper around AUTOCONF that generates `configure' scripts that
c6e96280
MR
163use our own Bash instead of /bin/sh in shebangs. For that reason, it should
164only be used internally---users should not end up distributing `configure'
165files with a system-specific shebang."
7cd1d7bd 166 (package (inherit autoconf)
7cd1d7bd
LC
167 (name (string-append (package-name autoconf) "-wrapper"))
168 (build-system trivial-build-system)
169 (inputs `(("guile"
168030ea
LC
170 ;; XXX: Kludge to hide the circular dependency.
171 ,(module-ref (resolve-interface '(gnu packages guile))
172 'guile-2.0))
7cd1d7bd
LC
173 ("autoconf" ,autoconf)
174 ("bash" ,bash)))
175 (arguments
176 '(#:modules ((guix build utils))
177 #:builder
178 (begin
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")
184 "/bin/autoconf"))
185 (guile (string-append
186 (assoc-ref %build-inputs "guile")
187 "/bin/guile"))
188 (sh (string-append
189 (assoc-ref %build-inputs "bash")
190 "/bin/sh"))
191 (modules ((compose dirname dirname dirname)
192 (search-path %load-path
193 "guix/build/utils.scm"))))
194 (mkdir-p bin)
195
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) ".*")))
202
203 ;; Add an `autoconf' binary that wraps the real one.
204 (call-with-output-file (string-append bin "/autoconf")
205 (lambda (port)
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.
209 (format port "#!~a
210export GUILE_LOAD_PATH=\"~a\"
211export GUILE_LOAD_COMPILED_PATH=\"~a\"
212exec ~a --no-auto-compile \"$0\" \"$@\"
213!#~%"
214 sh modules modules guile)
215 (write
216 `(begin
217 (use-modules (guix build utils))
218 (let ((result (apply system* ,autoconf
219 (cdr (command-line)))))
f11617d8
LC
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))))
7cd1d7bd 227 port)))
a33391bd
MW
228 (chmod (string-append bin "/autoconf") #o555)
229 #t))))
464f5447
LC
230
231 ;; Do not show it in the UI since it's meant for internal use.
232 (properties '((hidden? . #t)))))
233
234(define-public autoconf-wrapper
235 (make-autoconf-wrapper autoconf))
7cd1d7bd 236
6b0686fa
DT
237(define-public autoconf-archive
238 (package
239 (name "autoconf-archive")
c71bbfcc 240 (version "2019.01.06")
6b0686fa
DT
241 (source
242 (origin
243 (method url-fetch)
244 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
245 version ".tar.xz"))
246 (sha256
247 (base32
c71bbfcc 248 "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
6b0686fa 249 (build-system gnu-build-system)
6fd52309 250 (home-page "https://www.gnu.org/software/autoconf-archive/")
6b0686fa
DT
251 (synopsis "Collection of freely reusable Autoconf macros")
252 (description
253 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
254greatly expanding the domain of its functionality. These macros have been
255contributed as free software by the community.")
256 (license gpl3+)))
257
2b00a550
ML
258(define-public autobuild
259 (package
260 (name "autobuild")
261 (version "5.3")
262 (source (origin
263 (method url-fetch)
264 (uri (string-append "mirror://savannah/autobuild/autobuild-"
265 version ".tar.gz"))
266 (sha256
267 (base32
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
273when building software. Autobuild is primarily focused on packages using
274Autoconf and Automake, but can be used with other build systems too.
275Autobuild generates an HTML summary file, containing links to each build log.
276The summary includes project name, version, build hostname, host type (cross
277compile aware), date of build, and indication of success or failure. The
278output is indexed in many ways to simplify browsing.")
2eed6813 279 (home-page "https://josefsson.org/autobuild/")
2b00a550
ML
280 (license gpl3+)))
281
80ffc708
NK
282(define-public automake
283 (package
284 (name "automake")
20586ffd 285 (version "1.16.2")
7cd1d7bd
LC
286 (source (origin
287 (method url-fetch)
288 (uri (string-append "mirror://gnu/automake/automake-"
289 version ".tar.xz"))
290 (sha256
291 (base32
20586ffd 292 "1l7dkqbsmbf94ax29jj1jf6a0r6ikc8jybg1p5m0c3ki7pg5ki6c"))
01eafd38 293 (patches
01c7193e 294 (search-patches "automake-skip-amhello-tests.patch"))))
80ffc708 295 (build-system gnu-build-system)
d64a6d26
JN
296 (inputs
297 ;; TODO: remove `if' in the next rebuild cycle.
298 (if (%current-target-system)
299 `(("autoconf" ,autoconf-wrapper)
300 ("bash" ,bash-minimal)
301 ("perl" ,perl))
302 '()))
a6abac9f 303 (native-inputs
464f5447 304 `(("autoconf" ,autoconf-wrapper)
01eafd38 305 ("perl" ,perl)))
a9db7d10
LC
306 (native-search-paths
307 (list (search-path-specification
308 (variable "ACLOCAL_PATH")
af070955 309 (files '("share/aclocal")))))
7cd1d7bd 310 (arguments
d64a6d26 311 `(#:modules ((guix build gnu-build-system)
63b7c6c1
LC
312 (guix build utils)
313 (srfi srfi-1)
314 (srfi srfi-26)
315 (rnrs io ports))
759807e8
EF
316 #:phases
317 (modify-phases %standard-phases
318 (add-before 'patch-source-shebangs 'patch-tests-shebangs
319 (lambda _
320 (let ((sh (which "sh")))
321 (substitute* (find-files "t" "\\.(sh|tap)$")
322 (("#![[:blank:]]?/bin/sh")
323 (string-append "#!" sh)))
7cd1d7bd 324
759807e8
EF
325 ;; Set these variables for all the `configure' runs
326 ;; that occur during the test suite.
327 (setenv "SHELL" sh)
328 (setenv "CONFIG_SHELL" sh)
329 #t)))
9be8d7c8 330
20586ffd
MB
331 (add-before 'check 'skip-test
332 (lambda _
333 ;; This test requires 'etags' and fails if it's missing.
334 ;; Skip it.
335 (substitute* "t/tags-lisp-space.sh"
336 (("^required.*" all)
337 (string-append "exit 77\n" all "\n")))
338 #t))
339
d64a6d26
JN
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-[^/]*"))
354 autoconf)
355 (((string-append store-directory "/[^/]*-bash-[^/]*"))
356 bash)
357 (((string-append store-directory "/[^/]*-perl-[^/]*"))
358 perl))
359 #t))))
360 '())
361
cc355333
TGR
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
365 ;; example.
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
372 (lambda (p)
373 (list (get-u8 p) (get-u8 p))))
374 (map char->integer '(#\# #\!))))
63b7c6c1 375
cc355333
TGR
376 (for-each (lambda (file)
377 (when (and (starts-with-shebang? file)
378 (executable-file? file))
379 (format #t "restoring shebang on `~a'~%"
380 file)
381 (substitute* file
382 (("^#!.*/bin/sh")
383 "#!/bin/sh")
384 (("^#!.*/bin/env(.*)$" _ args)
385 (string-append "#!/usr/bin/env"
386 args)))))
387 (find-files dir ".*"))
388 #t))))))
6fd52309 389 (home-page "https://www.gnu.org/software/automake/")
f50d2669 390 (synopsis "Making GNU standards-compliant Makefiles")
80ffc708 391 (description
79c311b8
LC
392 "Automake the part of the GNU build system for producing
393standards-compliant Makefiles. Build requirements are entered in an
394intuitive format and then Automake works with Autoconf to produce a robust
395Makefile, simplifying the entire process for the developer.")
7cd1d7bd 396 (license gpl2+))) ; some files are under GPLv3+
36d4d49e
NK
397
398(define-public libtool
399 (package
400 (name "libtool")
192c6f96 401 (version "2.4.6")
36d4d49e 402 (source (origin
c154e1ea
LC
403 (method url-fetch)
404 (uri (string-append "mirror://gnu/libtool/libtool-"
405 version ".tar.xz"))
406 (sha256
407 (base32
192c6f96 408 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
fc1adab1 409 (patches (search-patches "libtool-skip-tests2.patch"))))
36d4d49e 410 (build-system gnu-build-system)
62c155c0 411 (propagated-inputs `(("m4" ,m4)))
36d4d49e 412 (native-inputs `(("m4" ,m4)
c154e1ea 413 ("perl" ,perl)
2b4e5568
RW
414 ;; XXX: this shouldn't be necessary, but without it test
415 ;; 102 fails because it cannot find ltdl/libltdl.la.
416 ("libltdl" ,libltdl)
98341757 417 ("help2man" ,help2man) ;because we modify ltmain.sh
c154e1ea 418 ("automake" ,automake) ;some tests rely on 'aclocal'
464f5447 419 ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
2f8a123e 420
36d4d49e 421 (arguments
3246cc91
LC
422 `(;; Libltdl is provided as a separate package, so don't install it here.
423 #:configure-flags '("--disable-ltdl-install")
424
425 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
426 ;; <http://hydra.gnu.org/build/181662>.
647cfcf6
PML
427 ;; Also, do not run tests when cross compiling
428 #:tests? ,(not (or (%current-target-system)
429 (string-prefix? "mips64"
3246cc91 430 (%current-system))))
c154e1ea 431
dc70626d 432 #:phases
433 (modify-phases %standard-phases
434 (add-before 'check 'pre-check
647cfcf6 435 (lambda* (#:key inputs native-inputs #:allow-other-keys)
dc70626d 436 ;; Run the test suite in parallel, if possible.
437 (setenv "TESTSUITEFLAGS"
438 (string-append
439 "-j"
440 (number->string (parallel-job-count))))
c5862bda 441 ;; Patch references to /bin/sh.
647cfcf6 442 (let ((bash (assoc-ref (or native-inputs inputs) "bash")))
dc70626d 443 (substitute* "tests/testsuite"
444 (("/bin/sh")
78c172a5
LF
445 (string-append bash "/bin/sh")))
446 #t)))
98341757 447 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
448 (lambda* (#:key inputs #:allow-other-keys)
449 (substitute* "build-aux/ltmain.in"
92e77959 450 (("^#!.*/bin/sh$") "#!/bin/sh"))
78c172a5 451 #t)))))
42ff70e2 452
f50d2669 453 (synopsis "Generic shared library support tools")
36d4d49e 454 (description
79c311b8
LC
455 "GNU Libtool helps in the creation and use of shared libraries, by
456presenting a single consistent, portable interface that hides the usual
457complexity of working with shared libraries across platforms.")
4a44e743 458 (license gpl3+)
6fd52309 459 (home-page "https://www.gnu.org/software/libtool/")))
e13f715b 460
3cbb3f9c
LC
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.
466 (package
467 (name "libltdl")
192c6f96 468 (version "2.4.6")
a101c891
LC
469 (source (origin
470 (method url-fetch)
471 (uri (string-append "mirror://gnu/libtool/libtool-"
472 version ".tar.xz"))
473 (sha256
474 (base32
ef593a10 475 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
3cbb3f9c
LC
476 (build-system gnu-build-system)
477 (arguments
478 '(#:configure-flags '("--enable-ltdl-install") ;really install it
8c88e0ba
EF
479 #:phases (modify-phases %standard-phases
480 (add-before 'configure 'change-directory
481 (lambda _ (chdir "libltdl") #t)))))
3cbb3f9c
LC
482
483 (synopsis "System-independent dlopen wrapper of GNU libtool")
484 (description (package-description libtool))
485 (home-page (package-home-page libtool))
486 (license lgpl2.1+)))
bfe88e0c
ML
487
488(define-public pyconfigure
489 (package
490 (name "pyconfigure")
491 (version "0.2.3")
492 (source (origin
493 (method url-fetch)
494 (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
495 version ".tar.gz"))
496 (sha256
497 (base32
498 "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
499 (build-system gnu-build-system)
500 (arguments
501 `(#:phases
502 (modify-phases %standard-phases
503 (add-before 'configure 'patch-python
504 (lambda _
505 (substitute* "pyconf.in"
506 (("/usr/bin/env python") (which "python3")))
507 #t)))))
508 (inputs
509 `(("python" ,python-3)))
510 (synopsis "@command{configure} interface for Python-based packages")
511 (description
512 "GNU pyconfigure provides template files for easily implementing
513standards-compliant configure scripts and Makefiles for Python-based packages.
514It is designed to work alongside existing Python setup scripts, making it easy
515to integrate into existing projects. Powerful and flexible Autoconf macros
516are available, allowing you to easily make adjustments to the installation
517procedure based on the capabilities of the target computer.")
518 (home-page "https://www.gnu.org/software/pyconfigure/manual/")
519 (license
520 (fsf-free
521 "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))