build: 'sync-descriptions' now compares GNU package descriptions.
[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>
4050e5d6 3;;; Copyright © 2012, 2013 Ludovic Courtès <ludo@gnu.org>
80ffc708 4;;;
233e7676 5;;; This file is part of GNU Guix.
80ffc708 6;;;
233e7676 7;;; GNU Guix is free software; you can redistribute it and/or modify it
80ffc708
NK
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;;;
233e7676 12;;; GNU Guix is distributed in the hope that it will be useful, but
80ffc708
NK
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
233e7676 18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
80ffc708 19
1ffa7090 20(define-module (gnu packages autotools)
4a44e743 21 #:use-module (guix licenses)
59a43334 22 #:use-module (gnu packages)
1ffa7090
LC
23 #:use-module (gnu packages perl)
24 #:use-module (gnu packages m4)
7cd1d7bd
LC
25 #:use-module (gnu packages bash)
26 #:use-module (guix utils)
80ffc708
NK
27 #:use-module (guix packages)
28 #:use-module (guix download)
7cd1d7bd
LC
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system trivial))
80ffc708
NK
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/")
f50d2669 53 (synopsis "Create source code configuration scripts")
80ffc708
NK
54 (description
55 "GNU Autoconf is an extensible package of M4 macros that produce
56shell scripts to automatically configure software source code
57packages. These scripts can adapt the packages to many kinds of
58UNIX-like systems without manual user intervention. Autoconf
59creates a configuration script for a package from a template
60file that lists the operating system features that the package
61can use, in the form of M4 macro calls.")
4a44e743 62 (license gpl3+))) ; some files are under GPLv2+
80ffc708 63
72b9eebf 64(define-public autoconf-wrapper
7cd1d7bd
LC
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"
168030ea
LC
74 ;; XXX: Kludge to hide the circular dependency.
75 ,(module-ref (resolve-interface '(gnu packages guile))
76 'guile-2.0))
7cd1d7bd
LC
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
114export GUILE_LOAD_PATH=\"~a\"
115export GUILE_LOAD_COMPILED_PATH=\"~a\"
116exec ~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)))))
f11617d8
LC
124 (when (and (file-exists? "configure")
125 (not (file-exists? "/bin/sh")))
126 ;; Patch regardless of RESULT, because `autoconf
127 ;; -Werror' can both create a `configure' file and
128 ;; return a non-zero exit code.
129 (patch-shebang "configure"))
130 (exit (status:exit-val result))))
7cd1d7bd
LC
131 port)))
132 (chmod (string-append bin "/autoconf") #o555)))))))
133
80ffc708
NK
134(define-public automake
135 (package
136 (name "automake")
35935b8a 137 (version "1.14")
7cd1d7bd
LC
138 (source (origin
139 (method url-fetch)
140 (uri (string-append "mirror://gnu/automake/automake-"
141 version ".tar.xz"))
142 (sha256
143 (base32
01eafd38
LC
144 "0nc0zqq8j336kamizzd86wb19vhbwywv5avcjh3cyx230xfqy671"))
145 (patches
146 (list (search-patch "automake-skip-amhello-tests.patch")))))
80ffc708
NK
147 (build-system gnu-build-system)
148 (inputs
7cd1d7bd 149 `(("autoconf" ,autoconf-wrapper)
01eafd38 150 ("perl" ,perl)))
a9db7d10
LC
151 (native-search-paths
152 (list (search-path-specification
153 (variable "ACLOCAL_PATH")
154 (directories '("share/aclocal")))))
7cd1d7bd 155 (arguments
01eafd38 156 '(#:modules ((guix build gnu-build-system)
63b7c6c1
LC
157 (guix build utils)
158 (srfi srfi-1)
159 (srfi srfi-26)
160 (rnrs io ports))
7cd1d7bd
LC
161 #:phases (alist-cons-before
162 'patch-source-shebangs 'patch-tests-shebangs
163 (lambda _
164 (let ((sh (which "sh")))
165 (substitute* (find-files "t" "\\.(sh|tap)$")
166 (("#![[:blank:]]?/bin/sh")
167 (string-append "#!" sh)))
168
169 ;; Set these variables for all the `configure' runs
170 ;; that occur during the test suite.
171 (setenv "SHELL" sh)
172 (setenv "CONFIG_SHELL" sh)))
9be8d7c8 173
63b7c6c1
LC
174 ;; Files like `install-sh', `mdate.sh', etc. must use
175 ;; #!/bin/sh, otherwise users could leak erroneous shebangs
176 ;; in the wild. See <http://bugs.gnu.org/14201> for an
177 ;; example.
178 (alist-cons-after
179 'install 'unpatch-shebangs
180 (lambda* (#:key outputs #:allow-other-keys)
181 (let* ((out (assoc-ref outputs "out"))
182 (dir (string-append out "/share")))
183 (define (starts-with-shebang? file)
184 (equal? (call-with-input-file file
185 (lambda (p)
186 (list (get-u8 p) (get-u8 p))))
187 (map char->integer '(#\# #\!))))
188
189 (for-each (lambda (file)
190 (when (and (starts-with-shebang? file)
191 (executable-file? file))
192 (format #t "restoring shebang on `~a'~%"
193 file)
194 (substitute* file
195 (("^#!.*/bin/sh")
196 "#!/bin/sh")
197 (("^#!.*/bin/env(.*)$" _ args)
198 (string-append "#!/usr/bin/env"
199 args)))))
200 (find-files dir ".*"))))
201 %standard-phases))))
7cd1d7bd 202 (home-page "http://www.gnu.org/software/automake/")
f50d2669 203 (synopsis "Making GNU standards-compliant Makefiles")
80ffc708
NK
204 (description
205 "GNU Automake is a tool for automatically generating
206`Makefile.in' files compliant with the GNU Coding
207Standards. Automake requires the use of Autoconf.")
7cd1d7bd 208 (license gpl2+))) ; some files are under GPLv3+
36d4d49e
NK
209
210(define-public libtool
211 (package
212 (name "libtool")
213 (version "2.4.2")
214 (source (origin
215 (method url-fetch)
216 (uri (string-append "mirror://gnu/libtool/libtool-"
217 version ".tar.gz"))
218 (sha256
219 (base32
220 "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk"))))
221 (build-system gnu-build-system)
222 (native-inputs `(("m4" ,m4)
223 ("perl" ,perl)))
2f8a123e
LC
224
225 ;; Separate binaries from the rest. During bootstrap, only ltdl is
226 ;; used; not depending on the binaries allows us to avoid retaining
227 ;; a reference to the bootstrap bash.
228 (outputs '("bin" ; libtoolize, libtool, etc.
229 "out")) ; libltdl.so, ltdl.h, etc.
230
36d4d49e 231 (arguments
42ff70e2 232 `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
1984b438
LC
233 ,@(if (%current-target-system)
234 '() ; no `check' phase when cross-building
235 '(#:phases (alist-cons-before
236 'check 'pre-check
237 (lambda* (#:key inputs #:allow-other-keys)
238 ;; Run the test suite in parallel, if possible.
239 (let ((ncores
240 (cond
241 ((getenv "NIX_BUILD_CORES")
242 =>
243 (lambda (n)
244 (if (zero? (string->number n))
245 (number->string (current-processor-count))
246 n)))
247 (else "1"))))
248 (setenv "TESTSUITEFLAGS"
249 (string-append "-j" ncores)))
42ff70e2 250
1984b438
LC
251 ;; Path references to /bin/sh.
252 (let ((bash (assoc-ref inputs "bash")))
253 (substitute* "tests/testsuite"
254 (("/bin/sh")
255 (string-append bash "/bin/bash")))))
256 %standard-phases)))))
36d4d49e
NK
257 (inputs `(("patch/skip-tests"
258 ,(search-patch "libtool-skip-tests.patch"))))
f50d2669 259 (synopsis "Generic shared library support tools")
36d4d49e
NK
260 (description
261 "GNU libtool is a generic library support script. Libtool hides the
262complexity of using shared libraries behind a consistent, portable interface.
263
264To use libtool, add the new generic library building commands to your
265Makefile, Makefile.in, or Makefile.am. See the documentation for
266details.")
4a44e743 267 (license gpl3+)
36d4d49e 268 (home-page "http://www.gnu.org/software/libtool/")))