You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

265 lines
11 KiB

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