gnu: Use synopses from the Womb.
[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 Ludovic Courtès <ludo@gnu.org>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages autotools)
21 #:use-module (guix licenses)
22 #:use-module (gnu packages)
23 #:use-module (gnu packages perl)
24 #:use-module (gnu packages m4)
25 #:use-module (gnu packages bash)
26 #:use-module (guix utils)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial))
31
32 (define-public autoconf
33 (package
34 (name "autoconf")
35 (version "2.69")
36 (source
37 (origin
38 (method url-fetch)
39 (uri (string-append "mirror://gnu/autoconf/autoconf-"
40 version ".tar.xz"))
41 (sha256
42 (base32
43 "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
44 (build-system gnu-build-system)
45 (inputs
46 `(("perl" ,perl)
47 ("m4" ,m4)))
48 ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
49 ;; should use our own "cpp" instead of "/lib/cpp".
50 (arguments `(#:tests? #f))
51 (home-page
52 "http://www.gnu.org/software/autoconf/")
53 (synopsis "Create source code configuration scripts")
54 (description
55 "GNU Autoconf is an extensible package of M4 macros that produce
56 shell scripts to automatically configure software source code
57 packages. These scripts can adapt the packages to many kinds of
58 UNIX-like systems without manual user intervention. Autoconf
59 creates a configuration script for a package from a template
60 file that lists the operating system features that the package
61 can use, in the form of M4 macro calls.")
62 (license gpl3+))) ; some files are under GPLv2+
63
64 (define-public autoconf-wrapper
65 ;; An Autoconf wrapper that generates `configure' scripts that use our
66 ;; own Bash instead of /bin/sh in shebangs. For that reason, it
67 ;; should only be used internally---users should not end up
68 ;; distributing `configure' files with a system-specific shebang.
69 (package (inherit autoconf)
70 (location (source-properties->location (current-source-location)))
71 (name (string-append (package-name autoconf) "-wrapper"))
72 (build-system trivial-build-system)
73 (inputs `(("guile"
74 ;; XXX: Kludge to hide the circular dependency.
75 ,(module-ref (resolve-interface '(gnu packages guile))
76 'guile-2.0))
77 ("autoconf" ,autoconf)
78 ("bash" ,bash)))
79 (arguments
80 '(#:modules ((guix build utils))
81 #:builder
82 (begin
83 (use-modules (guix build utils))
84 (let* ((out (assoc-ref %outputs "out"))
85 (bin (string-append out "/bin"))
86 (autoconf (string-append
87 (assoc-ref %build-inputs "autoconf")
88 "/bin/autoconf"))
89 (guile (string-append
90 (assoc-ref %build-inputs "guile")
91 "/bin/guile"))
92 (sh (string-append
93 (assoc-ref %build-inputs "bash")
94 "/bin/sh"))
95 (modules ((compose dirname dirname dirname)
96 (search-path %load-path
97 "guix/build/utils.scm"))))
98 (mkdir-p bin)
99
100 ;; Symlink all the binaries but `autoconf'.
101 (with-directory-excursion bin
102 (for-each (lambda (file)
103 (unless (string=? (basename file) "autoconf")
104 (symlink file (basename file))))
105 (find-files (dirname autoconf) ".*")))
106
107 ;; Add an `autoconf' binary that wraps the real one.
108 (call-with-output-file (string-append bin "/autoconf")
109 (lambda (port)
110 ;; Shamefully, Guile can be used in shebangs only if a
111 ;; single argument is passed (-ds); otherwise it gets
112 ;; them all as a single argument and fails to parse them.
113 (format port "#!~a
114 export GUILE_LOAD_PATH=\"~a\"
115 export GUILE_LOAD_COMPILED_PATH=\"~a\"
116 exec ~a --no-auto-compile \"$0\" \"$@\"
117 !#~%"
118 sh modules modules guile)
119 (write
120 `(begin
121 (use-modules (guix build utils))
122 (let ((result (apply system* ,autoconf
123 (cdr (command-line)))))
124 (if (and (zero? result)
125 (file-exists? "configure")
126 (not (file-exists? "/bin/sh")))
127 (begin
128 (patch-shebang "configure")
129 #t)
130 (exit (status:exit-val result)))))
131 port)))
132 (chmod (string-append bin "/autoconf") #o555)))))))
133
134 (define-public automake
135 (package
136 (name "automake")
137 (version "1.13.1")
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "mirror://gnu/automake/automake-"
141 version ".tar.xz"))
142 (sha256
143 (base32
144 "12yi1bzkipi7qdmkdy77pazljsa9z7q66hi6c4rq73p7hbv6rkbf"))))
145 (build-system gnu-build-system)
146 (inputs
147 `(("autoconf" ,autoconf-wrapper)
148 ("perl" ,perl)
149 ("patch/skip-amhello"
150 ,(search-patch "automake-skip-amhello-tests.patch"))))
151 (arguments
152 '(#:patches (list (assoc-ref %build-inputs "patch/skip-amhello"))
153 #:modules ((guix build gnu-build-system)
154 (guix build utils)
155 (srfi srfi-1)
156 (srfi srfi-26)
157 (rnrs io ports))
158 #:phases (alist-cons-before
159 'patch-source-shebangs 'patch-tests-shebangs
160 (lambda _
161 (let ((sh (which "sh")))
162 (substitute* (find-files "t" "\\.(sh|tap)$")
163 (("#![[:blank:]]?/bin/sh")
164 (string-append "#!" sh)))
165
166 ;; Set these variables for all the `configure' runs
167 ;; that occur during the test suite.
168 (setenv "SHELL" sh)
169 (setenv "CONFIG_SHELL" sh)))
170
171 ;; Files like `install-sh', `mdate.sh', etc. must use
172 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
173 ;; in the wild. See <http://bugs.gnu.org/14201> for an
174 ;; example.
175 (alist-cons-after
176 'install 'unpatch-shebangs
177 (lambda* (#:key outputs #:allow-other-keys)
178 (let* ((out (assoc-ref outputs "out"))
179 (dir (string-append out "/share")))
180 (define (starts-with-shebang? file)
181 (equal? (call-with-input-file file
182 (lambda (p)
183 (list (get-u8 p) (get-u8 p))))
184 (map char->integer '(#\# #\!))))
185
186 (for-each (lambda (file)
187 (when (and (starts-with-shebang? file)
188 (executable-file? file))
189 (format #t "restoring shebang on `~a'~%"
190 file)
191 (substitute* file
192 (("^#!.*/bin/sh")
193 "#!/bin/sh")
194 (("^#!.*/bin/env(.*)$" _ args)
195 (string-append "#!/usr/bin/env"
196 args)))))
197 (find-files dir ".*"))))
198 %standard-phases))))
199 (home-page "http://www.gnu.org/software/automake/")
200 (synopsis "Making GNU standards-compliant Makefiles")
201 (description
202 "GNU Automake is a tool for automatically generating
203 `Makefile.in' files compliant with the GNU Coding
204 Standards. Automake requires the use of Autoconf.")
205 (license gpl2+))) ; some files are under GPLv3+
206
207 (define-public libtool
208 (package
209 (name "libtool")
210 (version "2.4.2")
211 (source (origin
212 (method url-fetch)
213 (uri (string-append "mirror://gnu/libtool/libtool-"
214 version ".tar.gz"))
215 (sha256
216 (base32
217 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
218 (build-system gnu-build-system)
219 (native-inputs `(("m4" ,m4)
220 ("perl" ,perl)))
221
222 ;; Separate binaries from the rest. During bootstrap, only ltdl is
223 ;; used; not depending on the binaries allows us to avoid retaining
224 ;; a reference to the bootstrap bash.
225 (outputs '("bin" ; libtoolize, libtool, etc.
226 "out")) ; libltdl.so, ltdl.h, etc.
227
228 (arguments
229 `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
230 #:phases (alist-cons-before
231 'check 'pre-check
232 (lambda* (#:key inputs #:allow-other-keys)
233 ;; Run the test suite in parallel, if possible.
234 (let ((ncores
235 (cond
236 ((getenv "NIX_BUILD_CORES")
237 =>
238 (lambda (n)
239 (if (zero? (string->number n))
240 (number->string (current-processor-count))
241 n)))
242 (else "1"))))
243 (setenv "TESTSUITEFLAGS"
244 (string-append "-j" ncores)))
245
246 ;; Path references to /bin/sh.
247 (let ((bash (assoc-ref inputs "bash")))
248 (substitute* "tests/testsuite"
249 (("/bin/sh")
250 (string-append bash "/bin/bash")))))
251 %standard-phases)))
252 (inputs `(("patch/skip-tests"
253 ,(search-patch "libtool-skip-tests.patch"))))
254 (synopsis "Generic shared library support tools")
255 (description
256 "GNU libtool is a generic library support script. Libtool hides the
257 complexity of using shared libraries behind a consistent, portable interface.
258
259 To use libtool, add the new generic library building commands to your
260 Makefile, Makefile.in, or Makefile.am. See the documentation for
261 details.")
262 (license gpl3+)
263 (home-page "http://www.gnu.org/software/libtool/")))