gnu: libtasn1: Remove obsolete patch.
[jackhill/guix/guix.git] / gnu / packages / autotools.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
3;;; Copyright © 2012, 2013, 2014, 2015, 2016 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 Mark H Weaver <mhw@netris.org>
7;;; Copyright © 2016 David Thompson <davet@gnu.org>
8;;; Copyright © 2017 ng0 <ng0@libertad.pw>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages autotools)
26 #:use-module (guix licenses)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages m4)
30 #:use-module (gnu packages man)
31 #:use-module (gnu packages bash)
32 #:use-module (guix utils)
33 #:use-module (guix packages)
34 #:use-module (guix download)
35 #:use-module (guix build-system gnu)
36 #:use-module (guix build-system trivial)
37 #:use-module (ice-9 match)
38 #:export (autoconf-wrapper))
39
40(define-public autoconf
41 (package
42 (name "autoconf")
43 (version "2.69")
44 (source
45 (origin
46 (method url-fetch)
47 (uri (string-append "mirror://gnu/autoconf/autoconf-"
48 version ".tar.xz"))
49 (sha256
50 (base32
51 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
52 (build-system gnu-build-system)
53 (native-inputs
54 `(("perl" ,perl)
55 ("m4" ,m4)))
56 ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
57 ;; should use our own "cpp" instead of "/lib/cpp".
58 (arguments `(#:tests? #f))
59 (home-page
60 "http://www.gnu.org/software/autoconf/")
61 (synopsis "Create source code configuration scripts")
62 (description
63 "Autoconf offers the developer a robust set of M4 macros which expand
64into shell code to test the features of Unix-like systems and to adapt
65automatically their software package to these systems. The resulting shell
66scripts are self-contained and portable, freeing the user from needing to
67know anything about Autoconf or M4.")
68 (license gpl3+))) ; some files are under GPLv2+
69
70(define-public autoconf-2.68
71 (package (inherit autoconf)
72 (version "2.68")
73 (source
74 (origin
75 (method url-fetch)
76 (uri (string-append "mirror://gnu/autoconf/autoconf-"
77 version ".tar.xz"))
78 (sha256
79 (base32
80 "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
81
82(define-public autoconf-2.64
83 ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
84 (package (inherit autoconf)
85 (version "2.64")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append "mirror://gnu/autoconf/autoconf-"
90 version ".tar.xz"))
91 (sha256
92 (base32
93 "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
94
95(define-public autoconf-2.13
96 ;; GNU IceCat 52.x requires autoconf-2.13 to build!
97 (package (inherit autoconf)
98 (version "2.13")
99 (source
100 (origin
101 (method url-fetch)
102 (uri (string-append "mirror://gnu/autoconf/autoconf-"
103 version ".tar.gz"))
104 (sha256
105 (base32
106 "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
107 (arguments
108 `(#:tests? #f
109 #:phases
110 ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
111 ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
112 ;; and pass a simplified set of arguments.
113 (modify-phases %standard-phases
114 (replace 'configure
115 (lambda* (#:key build inputs outputs #:allow-other-keys)
116 (let ((bash (which "bash"))
117 (out (assoc-ref outputs "out")))
118 (setenv "CONFIG_SHELL" bash)
119 (setenv "SHELL" bash)
120 (zero? (system* bash "./configure"
121 (string-append "--prefix=" out)
122 (string-append "--build=" build)))))))))))
123
124
125(define* (autoconf-wrapper #:optional (autoconf autoconf))
126 "Return an wrapper around AUTOCONF that generates `configure' scripts that
127use our own Bash instead of /bin/sh in shebangs. For that reason, it should
128only be used internally---users should not end up distributing `configure'
129files with a system-specific shebang."
130 (package (inherit autoconf)
131 (name (string-append (package-name autoconf) "-wrapper"))
132 (build-system trivial-build-system)
133 (inputs `(("guile"
134 ;; XXX: Kludge to hide the circular dependency.
135 ,(module-ref (resolve-interface '(gnu packages guile))
136 'guile-2.0))
137 ("autoconf" ,autoconf)
138 ("bash" ,bash)))
139 (arguments
140 '(#:modules ((guix build utils))
141 #:builder
142 (begin
143 (use-modules (guix build utils))
144 (let* ((out (assoc-ref %outputs "out"))
145 (bin (string-append out "/bin"))
146 (autoconf (string-append
147 (assoc-ref %build-inputs "autoconf")
148 "/bin/autoconf"))
149 (guile (string-append
150 (assoc-ref %build-inputs "guile")
151 "/bin/guile"))
152 (sh (string-append
153 (assoc-ref %build-inputs "bash")
154 "/bin/sh"))
155 (modules ((compose dirname dirname dirname)
156 (search-path %load-path
157 "guix/build/utils.scm"))))
158 (mkdir-p bin)
159
160 ;; Symlink all the binaries but `autoconf'.
161 (with-directory-excursion bin
162 (for-each (lambda (file)
163 (unless (string=? (basename file) "autoconf")
164 (symlink file (basename file))))
165 (find-files (dirname autoconf) ".*")))
166
167 ;; Add an `autoconf' binary that wraps the real one.
168 (call-with-output-file (string-append bin "/autoconf")
169 (lambda (port)
170 ;; Shamefully, Guile can be used in shebangs only if a
171 ;; single argument is passed (-ds); otherwise it gets
172 ;; them all as a single argument and fails to parse them.
173 (format port "#!~a
174export GUILE_LOAD_PATH=\"~a\"
175export GUILE_LOAD_COMPILED_PATH=\"~a\"
176exec ~a --no-auto-compile \"$0\" \"$@\"
177!#~%"
178 sh modules modules guile)
179 (write
180 `(begin
181 (use-modules (guix build utils))
182 (let ((result (apply system* ,autoconf
183 (cdr (command-line)))))
184 (when (and (file-exists? "configure")
185 (not (file-exists? "/bin/sh")))
186 ;; Patch regardless of RESULT, because `autoconf
187 ;; -Werror' can both create a `configure' file and
188 ;; return a non-zero exit code.
189 (patch-shebang "configure"))
190 (exit (status:exit-val result))))
191 port)))
192 (chmod (string-append bin "/autoconf") #o555)))))))
193
194(define-public autoconf-archive
195 (package
196 (name "autoconf-archive")
197 (version "2017.03.21")
198 (source
199 (origin
200 (method url-fetch)
201 (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
202 version ".tar.xz"))
203 (sha256
204 (base32
205 "0rfpapadka2023qhy8294ca5awxpb8d4904js6kv7piby5ax8siq"))))
206 (build-system gnu-build-system)
207 (home-page "https://www.gnu.org/software/autoconf-archive/")
208 (synopsis "Collection of freely reusable Autoconf macros")
209 (description
210 "Autoconf Archive is a collection of over 450 new macros for Autoconf,
211greatly expanding the domain of its functionality. These macros have been
212contributed as free software by the community.")
213 (license gpl3+)))
214
215(define-public autobuild
216 (package
217 (name "autobuild")
218 (version "5.3")
219 (source (origin
220 (method url-fetch)
221 (uri (string-append "mirror://savannah/autobuild/autobuild-"
222 version ".tar.gz"))
223 (sha256
224 (base32
225 "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
226 (build-system gnu-build-system)
227 (inputs `(("perl" ,perl)))
228 (synopsis "Process generated build logs")
229 (description "Autobuild is a package that processes build logs generated
230when building software. Autobuild is primarily focused on packages using
231Autoconf and Automake, but can be used with other build systems too.
232Autobuild generates an HTML summary file, containing links to each build log.
233The summary includes project name, version, build hostname, host type (cross
234compile aware), date of build, and indication of success or failure. The
235output is indexed in many ways to simplify browsing.")
236 (home-page "http://josefsson.org/autobuild/")
237 (license gpl3+)))
238
239(define-public automake
240 (package
241 (name "automake")
242 (version "1.15")
243 (source (origin
244 (method url-fetch)
245 (uri (string-append "mirror://gnu/automake/automake-"
246 version ".tar.xz"))
247 (sha256
248 (base32
249 "0dl6vfi2lzz8alnklwxzfz624b95hb1ipjvd3mk177flmddcf24r"))
250 (patches
251 (search-patches "automake-regexp-syntax.patch"
252 "automake-skip-amhello-tests.patch"
253 "automake-test-gzip-warning.patch"))))
254 (build-system gnu-build-system)
255 (native-inputs
256 `(("autoconf" ,(autoconf-wrapper))
257 ("perl" ,perl)))
258 (native-search-paths
259 (list (search-path-specification
260 (variable "ACLOCAL_PATH")
261 (files '("share/aclocal")))))
262 (arguments
263 '(#:modules ((guix build gnu-build-system)
264 (guix build utils)
265 (srfi srfi-1)
266 (srfi srfi-26)
267 (rnrs io ports))
268 #:phases (alist-cons-before
269 'patch-source-shebangs 'patch-tests-shebangs
270 (lambda _
271 (let ((sh (which "sh")))
272 (substitute* (find-files "t" "\\.(sh|tap)$")
273 (("#![[:blank:]]?/bin/sh")
274 (string-append "#!" sh)))
275
276 ;; Set these variables for all the `configure' runs
277 ;; that occur during the test suite.
278 (setenv "SHELL" sh)
279 (setenv "CONFIG_SHELL" sh)))
280
281 ;; Files like `install-sh', `mdate.sh', etc. must use
282 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
283 ;; in the wild. See <http://bugs.gnu.org/14201> for an
284 ;; example.
285 (alist-cons-after
286 'install 'unpatch-shebangs
287 (lambda* (#:key outputs #:allow-other-keys)
288 (let* ((out (assoc-ref outputs "out"))
289 (dir (string-append out "/share")))
290 (define (starts-with-shebang? file)
291 (equal? (call-with-input-file file
292 (lambda (p)
293 (list (get-u8 p) (get-u8 p))))
294 (map char->integer '(#\# #\!))))
295
296 (for-each (lambda (file)
297 (when (and (starts-with-shebang? file)
298 (executable-file? file))
299 (format #t "restoring shebang on `~a'~%"
300 file)
301 (substitute* file
302 (("^#!.*/bin/sh")
303 "#!/bin/sh")
304 (("^#!.*/bin/env(.*)$" _ args)
305 (string-append "#!/usr/bin/env"
306 args)))))
307 (find-files dir ".*"))))
308 %standard-phases))))
309 (home-page "https://www.gnu.org/software/automake/")
310 (synopsis "Making GNU standards-compliant Makefiles")
311 (description
312 "Automake the part of the GNU build system for producing
313standards-compliant Makefiles. Build requirements are entered in an
314intuitive format and then Automake works with Autoconf to produce a robust
315Makefile, simplifying the entire process for the developer.")
316 (license gpl2+))) ; some files are under GPLv3+
317
318(define-public libtool
319 (package
320 (name "libtool")
321 (version "2.4.6")
322 (source (origin
323 (method url-fetch)
324 (uri (string-append "mirror://gnu/libtool/libtool-"
325 version ".tar.xz"))
326 (sha256
327 (base32
328 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
329 (patches (search-patches "libtool-skip-tests2.patch"))))
330 (build-system gnu-build-system)
331 (propagated-inputs `(("m4" ,m4)))
332 (native-inputs `(("m4" ,m4)
333 ("perl" ,perl)
334 ("help2man" ,help2man) ;because we modify ltmain.sh
335 ("automake" ,automake) ;some tests rely on 'aclocal'
336 ("autoconf" ,(autoconf-wrapper)))) ;others on 'autom4te'
337
338 (arguments
339 `(;; Libltdl is provided as a separate package, so don't install it here.
340 #:configure-flags '("--disable-ltdl-install")
341
342 ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
343 ;; <http://hydra.gnu.org/build/181662>.
344 #:tests? ,(not (string-prefix? "mips64"
345 (or (%current-target-system)
346 (%current-system))))
347
348 #:phases
349 (modify-phases %standard-phases
350 (add-before 'check 'pre-check
351 (lambda* (#:key inputs #:allow-other-keys)
352 ;; Run the test suite in parallel, if possible.
353 (setenv "TESTSUITEFLAGS"
354 (string-append
355 "-j"
356 (number->string (parallel-job-count))))
357 ;; Patch references to /bin/sh.
358 (let ((bash (assoc-ref inputs "bash")))
359 (substitute* "tests/testsuite"
360 (("/bin/sh")
361 (string-append bash "/bin/sh")))
362 #t)))
363 (add-after 'patch-source-shebangs 'restore-ltmain-shebang
364 (lambda* (#:key inputs #:allow-other-keys)
365 (substitute* "build-aux/ltmain.in"
366 (("^#!.*/bin/sh$") "#!/bin/sh"))
367 #t)))))
368
369 (synopsis "Generic shared library support tools")
370 (description
371 "GNU Libtool helps in the creation and use of shared libraries, by
372presenting a single consistent, portable interface that hides the usual
373complexity of working with shared libraries across platforms.")
374 (license gpl3+)
375 (home-page "https://www.gnu.org/software/libtool/")))
376
377(define-public libltdl
378 ;; This is a libltdl package separate from the libtool package. This is
379 ;; useful because, unlike libtool, it has zero extra dependencies (making it
380 ;; readily usable during bootstrap), and it builds very quickly since
381 ;; Libtool's extensive test suite isn't run.
382 (package
383 (name "libltdl")
384 (version "2.4.6")
385 (source (origin
386 (method url-fetch)
387 (uri (string-append "mirror://gnu/libtool/libtool-"
388 version ".tar.xz"))
389 (sha256
390 (base32
391 "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
392 (build-system gnu-build-system)
393 (arguments
394 '(#:configure-flags '("--enable-ltdl-install") ;really install it
395 #:phases (alist-cons-before
396 'configure 'change-directory
397 (lambda _
398 (chdir "libltdl"))
399 %standard-phases)))
400
401 (synopsis "System-independent dlopen wrapper of GNU libtool")
402 (description (package-description libtool))
403 (home-page (package-home-page libtool))
404 (license lgpl2.1+)))