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