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 | 54 | (description |
a22dc0c4 LC |
55 | "Autoconf offers the developer a robust set of M4 macros which expand |
56 | into shell code to test the features of Unix-like systems and to adapt | |
57 | automatically their software package to these systems. The resulting shell | |
58 | scripts are self-contained and portable, freeing the user from needing to | |
59 | know anything about Autoconf or M4.") | |
4a44e743 | 60 | (license gpl3+))) ; some files are under GPLv2+ |
80ffc708 | 61 | |
72b9eebf | 62 | (define-public autoconf-wrapper |
7cd1d7bd LC |
63 | ;; An Autoconf wrapper that generates `configure' scripts that use our |
64 | ;; own Bash instead of /bin/sh in shebangs. For that reason, it | |
65 | ;; should only be used internally---users should not end up | |
66 | ;; distributing `configure' files with a system-specific shebang. | |
67 | (package (inherit autoconf) | |
68 | (location (source-properties->location (current-source-location))) | |
69 | (name (string-append (package-name autoconf) "-wrapper")) | |
70 | (build-system trivial-build-system) | |
71 | (inputs `(("guile" | |
168030ea LC |
72 | ;; XXX: Kludge to hide the circular dependency. |
73 | ,(module-ref (resolve-interface '(gnu packages guile)) | |
74 | 'guile-2.0)) | |
7cd1d7bd LC |
75 | ("autoconf" ,autoconf) |
76 | ("bash" ,bash))) | |
77 | (arguments | |
78 | '(#:modules ((guix build utils)) | |
79 | #:builder | |
80 | (begin | |
81 | (use-modules (guix build utils)) | |
82 | (let* ((out (assoc-ref %outputs "out")) | |
83 | (bin (string-append out "/bin")) | |
84 | (autoconf (string-append | |
85 | (assoc-ref %build-inputs "autoconf") | |
86 | "/bin/autoconf")) | |
87 | (guile (string-append | |
88 | (assoc-ref %build-inputs "guile") | |
89 | "/bin/guile")) | |
90 | (sh (string-append | |
91 | (assoc-ref %build-inputs "bash") | |
92 | "/bin/sh")) | |
93 | (modules ((compose dirname dirname dirname) | |
94 | (search-path %load-path | |
95 | "guix/build/utils.scm")))) | |
96 | (mkdir-p bin) | |
97 | ||
98 | ;; Symlink all the binaries but `autoconf'. | |
99 | (with-directory-excursion bin | |
100 | (for-each (lambda (file) | |
101 | (unless (string=? (basename file) "autoconf") | |
102 | (symlink file (basename file)))) | |
103 | (find-files (dirname autoconf) ".*"))) | |
104 | ||
105 | ;; Add an `autoconf' binary that wraps the real one. | |
106 | (call-with-output-file (string-append bin "/autoconf") | |
107 | (lambda (port) | |
108 | ;; Shamefully, Guile can be used in shebangs only if a | |
109 | ;; single argument is passed (-ds); otherwise it gets | |
110 | ;; them all as a single argument and fails to parse them. | |
111 | (format port "#!~a | |
112 | export GUILE_LOAD_PATH=\"~a\" | |
113 | export GUILE_LOAD_COMPILED_PATH=\"~a\" | |
114 | exec ~a --no-auto-compile \"$0\" \"$@\" | |
115 | !#~%" | |
116 | sh modules modules guile) | |
117 | (write | |
118 | `(begin | |
119 | (use-modules (guix build utils)) | |
120 | (let ((result (apply system* ,autoconf | |
121 | (cdr (command-line))))) | |
f11617d8 LC |
122 | (when (and (file-exists? "configure") |
123 | (not (file-exists? "/bin/sh"))) | |
124 | ;; Patch regardless of RESULT, because `autoconf | |
125 | ;; -Werror' can both create a `configure' file and | |
126 | ;; return a non-zero exit code. | |
127 | (patch-shebang "configure")) | |
128 | (exit (status:exit-val result)))) | |
7cd1d7bd LC |
129 | port))) |
130 | (chmod (string-append bin "/autoconf") #o555))))))) | |
131 | ||
80ffc708 NK |
132 | (define-public automake |
133 | (package | |
134 | (name "automake") | |
35935b8a | 135 | (version "1.14") |
7cd1d7bd LC |
136 | (source (origin |
137 | (method url-fetch) | |
138 | (uri (string-append "mirror://gnu/automake/automake-" | |
139 | version ".tar.xz")) | |
140 | (sha256 | |
141 | (base32 | |
01eafd38 LC |
142 | "0nc0zqq8j336kamizzd86wb19vhbwywv5avcjh3cyx230xfqy671")) |
143 | (patches | |
144 | (list (search-patch "automake-skip-amhello-tests.patch"))))) | |
80ffc708 NK |
145 | (build-system gnu-build-system) |
146 | (inputs | |
7cd1d7bd | 147 | `(("autoconf" ,autoconf-wrapper) |
01eafd38 | 148 | ("perl" ,perl))) |
a9db7d10 LC |
149 | (native-search-paths |
150 | (list (search-path-specification | |
151 | (variable "ACLOCAL_PATH") | |
152 | (directories '("share/aclocal"))))) | |
7cd1d7bd | 153 | (arguments |
01eafd38 | 154 | '(#:modules ((guix build gnu-build-system) |
63b7c6c1 LC |
155 | (guix build utils) |
156 | (srfi srfi-1) | |
157 | (srfi srfi-26) | |
158 | (rnrs io ports)) | |
7cd1d7bd LC |
159 | #:phases (alist-cons-before |
160 | 'patch-source-shebangs 'patch-tests-shebangs | |
161 | (lambda _ | |
162 | (let ((sh (which "sh"))) | |
163 | (substitute* (find-files "t" "\\.(sh|tap)$") | |
164 | (("#![[:blank:]]?/bin/sh") | |
165 | (string-append "#!" sh))) | |
166 | ||
167 | ;; Set these variables for all the `configure' runs | |
168 | ;; that occur during the test suite. | |
169 | (setenv "SHELL" sh) | |
170 | (setenv "CONFIG_SHELL" sh))) | |
9be8d7c8 | 171 | |
63b7c6c1 LC |
172 | ;; Files like `install-sh', `mdate.sh', etc. must use |
173 | ;; #!/bin/sh, otherwise users could leak erroneous shebangs | |
174 | ;; in the wild. See <http://bugs.gnu.org/14201> for an | |
175 | ;; example. | |
176 | (alist-cons-after | |
177 | 'install 'unpatch-shebangs | |
178 | (lambda* (#:key outputs #:allow-other-keys) | |
179 | (let* ((out (assoc-ref outputs "out")) | |
180 | (dir (string-append out "/share"))) | |
181 | (define (starts-with-shebang? file) | |
182 | (equal? (call-with-input-file file | |
183 | (lambda (p) | |
184 | (list (get-u8 p) (get-u8 p)))) | |
185 | (map char->integer '(#\# #\!)))) | |
186 | ||
187 | (for-each (lambda (file) | |
188 | (when (and (starts-with-shebang? file) | |
189 | (executable-file? file)) | |
190 | (format #t "restoring shebang on `~a'~%" | |
191 | file) | |
192 | (substitute* file | |
193 | (("^#!.*/bin/sh") | |
194 | "#!/bin/sh") | |
195 | (("^#!.*/bin/env(.*)$" _ args) | |
196 | (string-append "#!/usr/bin/env" | |
197 | args))))) | |
198 | (find-files dir ".*")))) | |
199 | %standard-phases)))) | |
7cd1d7bd | 200 | (home-page "http://www.gnu.org/software/automake/") |
f50d2669 | 201 | (synopsis "Making GNU standards-compliant Makefiles") |
80ffc708 | 202 | (description |
a22dc0c4 LC |
203 | "Automake the part of the GNU build system for producing standards- |
204 | compliant Makefiles. Build requirements are entered in an intuitive format | |
205 | and then Automake works with Autoconf to produce a robust Makefile, | |
206 | simplifying the entire process for the developer.") | |
7cd1d7bd | 207 | (license gpl2+))) ; some files are under GPLv3+ |
36d4d49e NK |
208 | |
209 | (define-public libtool | |
210 | (package | |
211 | (name "libtool") | |
212 | (version "2.4.2") | |
213 | (source (origin | |
214 | (method url-fetch) | |
215 | (uri (string-append "mirror://gnu/libtool/libtool-" | |
216 | version ".tar.gz")) | |
217 | (sha256 | |
218 | (base32 | |
219 | "0649qfpzkswgcj9vqkkr9rn4nlcx80faxpyqscy2k1x9c94f93dk")))) | |
220 | (build-system gnu-build-system) | |
221 | (native-inputs `(("m4" ,m4) | |
222 | ("perl" ,perl))) | |
2f8a123e LC |
223 | |
224 | ;; Separate binaries from the rest. During bootstrap, only ltdl is | |
225 | ;; used; not depending on the binaries allows us to avoid retaining | |
226 | ;; a reference to the bootstrap bash. | |
227 | (outputs '("bin" ; libtoolize, libtool, etc. | |
228 | "out")) ; libltdl.so, ltdl.h, etc. | |
229 | ||
36d4d49e | 230 | (arguments |
42ff70e2 | 231 | `(#:patches (list (assoc-ref %build-inputs "patch/skip-tests")) |
1984b438 LC |
232 | ,@(if (%current-target-system) |
233 | '() ; no `check' phase when cross-building | |
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))) | |
42ff70e2 | 249 | |
1984b438 LC |
250 | ;; Path references to /bin/sh. |
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 | 259 | (description |
a22dc0c4 LC |
260 | "Libtool is a script to help in the creation of shared libraries. By |
261 | presenting a consistent, portable interface, it hides the complexity of | |
262 | building usable shared libraries.") | |
4a44e743 | 263 | (license gpl3+) |
36d4d49e | 264 | (home-page "http://www.gnu.org/software/libtool/"))) |