Commit | Line | Data |
---|---|---|
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 | |
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.") | |
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 | |
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 | ||
80ffc708 NK |
134 | (define-public automake |
135 | (package | |
136 | (name "automake") | |
c9ee0485 | 137 | (version "1.13.1") |
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 | |
c9ee0485 | 144 | "12yi1bzkipi7qdmkdy77pazljsa9z7q66hi6c4rq73p7hbv6rkbf")))) |
80ffc708 NK |
145 | (build-system gnu-build-system) |
146 | (inputs | |
7cd1d7bd LC |
147 | `(("autoconf" ,autoconf-wrapper) |
148 | ("perl" ,perl) | |
149 | ("patch/skip-amhello" | |
150 | ,(search-patch "automake-skip-amhello-tests.patch")))) | |
a9db7d10 LC |
151 | (native-search-paths |
152 | (list (search-path-specification | |
153 | (variable "ACLOCAL_PATH") | |
154 | (directories '("share/aclocal"))))) | |
7cd1d7bd LC |
155 | (arguments |
156 | '(#:patches (list (assoc-ref %build-inputs "patch/skip-amhello")) | |
63b7c6c1 LC |
157 | #:modules ((guix build gnu-build-system) |
158 | (guix build utils) | |
159 | (srfi srfi-1) | |
160 | (srfi srfi-26) | |
161 | (rnrs io ports)) | |
7cd1d7bd LC |
162 | #:phases (alist-cons-before |
163 | 'patch-source-shebangs 'patch-tests-shebangs | |
164 | (lambda _ | |
165 | (let ((sh (which "sh"))) | |
166 | (substitute* (find-files "t" "\\.(sh|tap)$") | |
167 | (("#![[:blank:]]?/bin/sh") | |
168 | (string-append "#!" sh))) | |
169 | ||
170 | ;; Set these variables for all the `configure' runs | |
171 | ;; that occur during the test suite. | |
172 | (setenv "SHELL" sh) | |
173 | (setenv "CONFIG_SHELL" sh))) | |
9be8d7c8 | 174 | |
63b7c6c1 LC |
175 | ;; Files like `install-sh', `mdate.sh', etc. must use |
176 | ;; #!/bin/sh, otherwise users could leak erroneous shebangs | |
177 | ;; in the wild. See <http://bugs.gnu.org/14201> for an | |
178 | ;; example. | |
179 | (alist-cons-after | |
180 | 'install 'unpatch-shebangs | |
181 | (lambda* (#:key outputs #:allow-other-keys) | |
182 | (let* ((out (assoc-ref outputs "out")) | |
183 | (dir (string-append out "/share"))) | |
184 | (define (starts-with-shebang? file) | |
185 | (equal? (call-with-input-file file | |
186 | (lambda (p) | |
187 | (list (get-u8 p) (get-u8 p)))) | |
188 | (map char->integer '(#\# #\!)))) | |
189 | ||
190 | (for-each (lambda (file) | |
191 | (when (and (starts-with-shebang? file) | |
192 | (executable-file? file)) | |
193 | (format #t "restoring shebang on `~a'~%" | |
194 | file) | |
195 | (substitute* file | |
196 | (("^#!.*/bin/sh") | |
197 | "#!/bin/sh") | |
198 | (("^#!.*/bin/env(.*)$" _ args) | |
199 | (string-append "#!/usr/bin/env" | |
200 | args))))) | |
201 | (find-files dir ".*")))) | |
202 | %standard-phases)))) | |
7cd1d7bd | 203 | (home-page "http://www.gnu.org/software/automake/") |
f50d2669 | 204 | (synopsis "Making GNU standards-compliant Makefiles") |
80ffc708 NK |
205 | (description |
206 | "GNU Automake is a tool for automatically generating | |
207 | `Makefile.in' files compliant with the GNU Coding | |
208 | Standards. Automake requires the use of Autoconf.") | |
7cd1d7bd | 209 | (license gpl2+))) ; some files are under GPLv3+ |
36d4d49e NK |
210 | |
211 | (define-public libtool | |
212 | (package | |
213 | (name "libtool") | |
214 | (version "2.4.2") | |
215 | (source (origin | |
216 | (method url-fetch) | |
217 | (uri (string-append "mirror://gnu/libtool/libtool-" | |
218 | version ".tar.gz")) | |
219 | (sha256 | |
220 | (base32 | |
221 | "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk")))) | |
222 | (build-system gnu-build-system) | |
223 | (native-inputs `(("m4" ,m4) | |
224 | ("perl" ,perl))) | |
2f8a123e LC |
225 | |
226 | ;; Separate binaries from the rest. During bootstrap, only ltdl is | |
227 | ;; used; not depending on the binaries allows us to avoid retaining | |
228 | ;; a reference to the bootstrap bash. | |
229 | (outputs '("bin" ; libtoolize, libtool, etc. | |
230 | "out")) ; libltdl.so, ltdl.h, etc. | |
231 | ||
36d4d49e | 232 | (arguments |
42ff70e2 LC |
233 | `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests")) |
234 | #:phases (alist-cons-before | |
235 | 'check 'pre-check | |
236 | (lambda* (#:key inputs #:allow-other-keys) | |
237 | ;; Run the test suite in parallel, if possible. | |
238 | (let ((ncores | |
239 | (cond | |
240 | ((getenv "NIX_BUILD_CORES") | |
241 | => | |
242 | (lambda (n) | |
243 | (if (zero? (string->number n)) | |
244 | (number->string (current-processor-count)) | |
245 | n))) | |
246 | (else "1")))) | |
247 | (setenv "TESTSUITEFLAGS" | |
248 | (string-append "-j" ncores))) | |
249 | ||
250 | ;; Path references to /bin/sh. | |
42ff70e2 LC |
251 | (let ((bash (assoc-ref inputs "bash"))) |
252 | (substitute* "tests/testsuite" | |
253 | (("/bin/sh") | |
254 | (string-append bash "/bin/bash"))))) | |
255 | %standard-phases))) | |
36d4d49e NK |
256 | (inputs `(("patch/skip-tests" |
257 | ,(search-patch "libtool-skip-tests.patch")))) | |
f50d2669 | 258 | (synopsis "Generic shared library support tools") |
36d4d49e NK |
259 | (description |
260 | "GNU libtool is a generic library support script. Libtool hides the | |
261 | complexity of using shared libraries behind a consistent, portable interface. | |
262 | ||
263 | To use libtool, add the new generic library building commands to your | |
264 | Makefile, Makefile.in, or Makefile.am. See the documentation for | |
265 | details.") | |
4a44e743 | 266 | (license gpl3+) |
36d4d49e | 267 | (home-page "http://www.gnu.org/software/libtool/"))) |