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