autotools.scm 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012 Nikita Karetnikov <nikita@karetnikov.org>
  3. ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès <ludo@gnu.org>
  4. ;;; Copyright © 2015 Mathieu Lirzin <mthl@openmailbox.org>
  5. ;;; Copyright © 2014 Manolis Fragkiskos Ragkousis <manolis837@gmail.com>
  6. ;;; Copyright © 2015, 2017, 2018 Mark H Weaver <mhw@netris.org>
  7. ;;; Copyright © 2016 David Thompson <davet@gnu.org>
  8. ;;; Copyright © 2017 Nils Gillmann <ng0@n0.is>
  9. ;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il>
  10. ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
  11. ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
  12. ;;;
  13. ;;; This file is part of GNU Guix.
  14. ;;;
  15. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  16. ;;; under the terms of the GNU General Public License as published by
  17. ;;; the Free Software Foundation; either version 3 of the License, or (at
  18. ;;; your option) any later version.
  19. ;;;
  20. ;;; GNU Guix is distributed in the hope that it will be useful, but
  21. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  22. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  23. ;;; GNU General Public License for more details.
  24. ;;;
  25. ;;; You should have received a copy of the GNU General Public License
  26. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  27. (define-module (gnu packages autotools)
  28. #:use-module (guix licenses)
  29. #:use-module (gnu packages)
  30. #:use-module (gnu packages perl)
  31. #:use-module (gnu packages python)
  32. #:use-module (gnu packages m4)
  33. #:use-module (gnu packages man)
  34. #:use-module (gnu packages bash)
  35. #:use-module (guix utils)
  36. #:use-module (guix packages)
  37. #:use-module (guix download)
  38. #:use-module (guix build-system gnu)
  39. #:use-module (guix build-system trivial)
  40. #:use-module (ice-9 match)
  41. #:export (autoconf-wrapper))
  42. (define-public autoconf
  43. (package
  44. (name "autoconf")
  45. (version "2.69")
  46. (source
  47. (origin
  48. (method url-fetch)
  49. (uri (string-append "mirror://gnu/autoconf/autoconf-"
  50. version ".tar.xz"))
  51. (sha256
  52. (base32
  53. "113nlmidxy9kjr45kg9x3ngar4951mvag1js2a3j8nxcz34wxsv4"))))
  54. (build-system gnu-build-system)
  55. (native-inputs
  56. `(("perl" ,perl)
  57. ("m4" ,m4)))
  58. ;; XXX: testsuite: 209 and 279 failed. The latter is an impurity. It
  59. ;; should use our own "cpp" instead of "/lib/cpp".
  60. (arguments `(#:tests? #f))
  61. (home-page
  62. "http://www.gnu.org/software/autoconf/")
  63. (synopsis "Create source code configuration scripts")
  64. (description
  65. "Autoconf offers the developer a robust set of M4 macros which expand
  66. into shell code to test the features of Unix-like systems and to adapt
  67. automatically their software package to these systems. The resulting shell
  68. scripts are self-contained and portable, freeing the user from needing to
  69. know anything about Autoconf or M4.")
  70. (license gpl3+))) ; some files are under GPLv2+
  71. (define-public autoconf-2.68
  72. (package (inherit autoconf)
  73. (version "2.68")
  74. (source
  75. (origin
  76. (method url-fetch)
  77. (uri (string-append "mirror://gnu/autoconf/autoconf-"
  78. version ".tar.xz"))
  79. (sha256
  80. (base32
  81. "1fjm21k2na07f3vasf288a0zx66lbv0hd3l9bvv3q8p62s3pg569"))))))
  82. (define-public autoconf-2.64
  83. ;; As of GDB 7.8, GDB is still developed using this version of Autoconf.
  84. (package (inherit autoconf)
  85. (version "2.64")
  86. (source
  87. (origin
  88. (method url-fetch)
  89. (uri (string-append "mirror://gnu/autoconf/autoconf-"
  90. version ".tar.xz"))
  91. (sha256
  92. (base32
  93. "0j3jdjpf5ly39dlp0bg70h72nzqr059k0x8iqxvaxf106chpgn9j"))))))
  94. (define-public autoconf-2.13
  95. ;; GNU IceCat 52.x requires autoconf-2.13 to build!
  96. (package (inherit autoconf)
  97. (version "2.13")
  98. (source
  99. (origin
  100. (method url-fetch)
  101. (uri (string-append "mirror://gnu/autoconf/autoconf-"
  102. version ".tar.gz"))
  103. (sha256
  104. (base32
  105. "07krzl4czczdsgzrrw9fiqx35xcf32naf751khg821g5pqv12qgh"))))
  106. (arguments
  107. `(#:tests? #f
  108. #:phases
  109. ;; The 'configure' script in autoconf-2.13 can't cope with "SHELL=" and
  110. ;; "CONFIG_SHELL=" arguments, so we set them as environment variables
  111. ;; and pass a simplified set of arguments.
  112. (modify-phases %standard-phases
  113. (replace 'configure
  114. (lambda* (#:key build inputs outputs #:allow-other-keys)
  115. (let ((bash (which "bash"))
  116. (out (assoc-ref outputs "out")))
  117. (setenv "CONFIG_SHELL" bash)
  118. (setenv "SHELL" bash)
  119. (invoke bash "./configure"
  120. (string-append "--prefix=" out)
  121. (string-append "--build=" build))))))))))
  122. (define (make-autoconf-wrapper autoconf)
  123. "Return a wrapper around AUTOCONF that generates `configure' scripts that
  124. use our own Bash instead of /bin/sh in shebangs. For that reason, it should
  125. only be used internally---users should not end up distributing `configure'
  126. files with a system-specific shebang."
  127. (package (inherit autoconf)
  128. (name (string-append (package-name autoconf) "-wrapper"))
  129. (build-system trivial-build-system)
  130. (inputs `(("guile"
  131. ;; XXX: Kludge to hide the circular dependency.
  132. ,(module-ref (resolve-interface '(gnu packages guile))
  133. 'guile-2.0))
  134. ("autoconf" ,autoconf)
  135. ("bash" ,bash)))
  136. (arguments
  137. '(#:modules ((guix build utils))
  138. #:builder
  139. (begin
  140. (use-modules (guix build utils))
  141. (let* ((out (assoc-ref %outputs "out"))
  142. (bin (string-append out "/bin"))
  143. (autoconf (string-append
  144. (assoc-ref %build-inputs "autoconf")
  145. "/bin/autoconf"))
  146. (guile (string-append
  147. (assoc-ref %build-inputs "guile")
  148. "/bin/guile"))
  149. (sh (string-append
  150. (assoc-ref %build-inputs "bash")
  151. "/bin/sh"))
  152. (modules ((compose dirname dirname dirname)
  153. (search-path %load-path
  154. "guix/build/utils.scm"))))
  155. (mkdir-p bin)
  156. ;; Symlink all the binaries but `autoconf'.
  157. (with-directory-excursion bin
  158. (for-each (lambda (file)
  159. (unless (string=? (basename file) "autoconf")
  160. (symlink file (basename file))))
  161. (find-files (dirname autoconf) ".*")))
  162. ;; Add an `autoconf' binary that wraps the real one.
  163. (call-with-output-file (string-append bin "/autoconf")
  164. (lambda (port)
  165. ;; Shamefully, Guile can be used in shebangs only if a
  166. ;; single argument is passed (-ds); otherwise it gets
  167. ;; them all as a single argument and fails to parse them.
  168. (format port "#!~a
  169. export GUILE_LOAD_PATH=\"~a\"
  170. export GUILE_LOAD_COMPILED_PATH=\"~a\"
  171. exec ~a --no-auto-compile \"$0\" \"$@\"
  172. !#~%"
  173. sh modules modules guile)
  174. (write
  175. `(begin
  176. (use-modules (guix build utils))
  177. (let ((result (apply system* ,autoconf
  178. (cdr (command-line)))))
  179. (when (and (file-exists? "configure")
  180. (not (file-exists? "/bin/sh")))
  181. ;; Patch regardless of RESULT, because `autoconf
  182. ;; -Werror' can both create a `configure' file and
  183. ;; return a non-zero exit code.
  184. (patch-shebang "configure"))
  185. (exit (status:exit-val result))))
  186. port)))
  187. (chmod (string-append bin "/autoconf") #o555)
  188. #t))))
  189. ;; Do not show it in the UI since it's meant for internal use.
  190. (properties '((hidden? . #t)))))
  191. (define-public autoconf-wrapper
  192. (make-autoconf-wrapper autoconf))
  193. (define-public autoconf-archive
  194. (package
  195. (name "autoconf-archive")
  196. (version "2019.01.06")
  197. (source
  198. (origin
  199. (method url-fetch)
  200. (uri (string-append "mirror://gnu/autoconf-archive/autoconf-archive-"
  201. version ".tar.xz"))
  202. (sha256
  203. (base32
  204. "0gqya7nf4j5k98dkky0c3bnr0paciya91vkqazg7knlq621mq68p"))))
  205. (build-system gnu-build-system)
  206. (home-page "https://www.gnu.org/software/autoconf-archive/")
  207. (synopsis "Collection of freely reusable Autoconf macros")
  208. (description
  209. "Autoconf Archive is a collection of over 450 new macros for Autoconf,
  210. greatly expanding the domain of its functionality. These macros have been
  211. contributed as free software by the community.")
  212. (license gpl3+)))
  213. (define-public autobuild
  214. (package
  215. (name "autobuild")
  216. (version "5.3")
  217. (source (origin
  218. (method url-fetch)
  219. (uri (string-append "mirror://savannah/autobuild/autobuild-"
  220. version ".tar.gz"))
  221. (sha256
  222. (base32
  223. "0gv7g61ja9q9zg1m30k4snqwwy1kq7b4df6sb7d2qra7kbdq8af1"))))
  224. (build-system gnu-build-system)
  225. (inputs `(("perl" ,perl)))
  226. (synopsis "Process generated build logs")
  227. (description "Autobuild is a package that processes build logs generated
  228. when building software. Autobuild is primarily focused on packages using
  229. Autoconf and Automake, but can be used with other build systems too.
  230. Autobuild generates an HTML summary file, containing links to each build log.
  231. The summary includes project name, version, build hostname, host type (cross
  232. compile aware), date of build, and indication of success or failure. The
  233. output is indexed in many ways to simplify browsing.")
  234. (home-page "http://josefsson.org/autobuild/")
  235. (license gpl3+)))
  236. (define-public automake
  237. (package
  238. (name "automake")
  239. (version "1.16.1")
  240. (source (origin
  241. (method url-fetch)
  242. (uri (string-append "mirror://gnu/automake/automake-"
  243. version ".tar.xz"))
  244. (sha256
  245. (base32
  246. "08g979ficj18i1w6w5219bgmns7czr03iadf20mk3lrzl8wbn1ax"))
  247. (patches
  248. (search-patches "automake-skip-amhello-tests.patch"))))
  249. (build-system gnu-build-system)
  250. (native-inputs
  251. `(("autoconf" ,autoconf-wrapper)
  252. ("perl" ,perl)))
  253. (native-search-paths
  254. (list (search-path-specification
  255. (variable "ACLOCAL_PATH")
  256. (files '("share/aclocal")))))
  257. (arguments
  258. '(#:modules ((guix build gnu-build-system)
  259. (guix build utils)
  260. (srfi srfi-1)
  261. (srfi srfi-26)
  262. (rnrs io ports))
  263. #:phases
  264. (modify-phases %standard-phases
  265. (add-before 'patch-source-shebangs 'patch-tests-shebangs
  266. (lambda _
  267. (let ((sh (which "sh")))
  268. (substitute* (find-files "t" "\\.(sh|tap)$")
  269. (("#![[:blank:]]?/bin/sh")
  270. (string-append "#!" sh)))
  271. ;; Set these variables for all the `configure' runs
  272. ;; that occur during the test suite.
  273. (setenv "SHELL" sh)
  274. (setenv "CONFIG_SHELL" sh)
  275. #t)))
  276. ;; Files like `install-sh', `mdate.sh', etc. must use
  277. ;; #!/bin/sh, otherwise users could leak erroneous shebangs
  278. ;; in the wild. See <http://bugs.gnu.org/14201> for an
  279. ;; example.
  280. (add-after 'install 'unpatch-shebangs
  281. (lambda* (#:key outputs #:allow-other-keys)
  282. (let* ((out (assoc-ref outputs "out"))
  283. (dir (string-append out "/share")))
  284. (define (starts-with-shebang? file)
  285. (equal? (call-with-input-file file
  286. (lambda (p)
  287. (list (get-u8 p) (get-u8 p))))
  288. (map char->integer '(#\# #\!))))
  289. (for-each (lambda (file)
  290. (when (and (starts-with-shebang? file)
  291. (executable-file? file))
  292. (format #t "restoring shebang on `~a'~%"
  293. file)
  294. (substitute* file
  295. (("^#!.*/bin/sh")
  296. "#!/bin/sh")
  297. (("^#!.*/bin/env(.*)$" _ args)
  298. (string-append "#!/usr/bin/env"
  299. args)))))
  300. (find-files dir ".*"))
  301. #t))))))
  302. (home-page "https://www.gnu.org/software/automake/")
  303. (synopsis "Making GNU standards-compliant Makefiles")
  304. (description
  305. "Automake the part of the GNU build system for producing
  306. standards-compliant Makefiles. Build requirements are entered in an
  307. intuitive format and then Automake works with Autoconf to produce a robust
  308. Makefile, simplifying the entire process for the developer.")
  309. (license gpl2+))) ; some files are under GPLv3+
  310. (define-public libtool
  311. (package
  312. (name "libtool")
  313. (version "2.4.6")
  314. (source (origin
  315. (method url-fetch)
  316. (uri (string-append "mirror://gnu/libtool/libtool-"
  317. version ".tar.xz"))
  318. (sha256
  319. (base32
  320. "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))
  321. (patches (search-patches "libtool-skip-tests2.patch"))))
  322. (build-system gnu-build-system)
  323. (propagated-inputs `(("m4" ,m4)))
  324. (native-inputs `(("m4" ,m4)
  325. ("perl" ,perl)
  326. ;; XXX: this shouldn't be necessary, but without it test
  327. ;; 102 fails because it cannot find ltdl/libltdl.la.
  328. ("libltdl" ,libltdl)
  329. ("help2man" ,help2man) ;because we modify ltmain.sh
  330. ("automake" ,automake) ;some tests rely on 'aclocal'
  331. ("autoconf" ,autoconf-wrapper))) ;others on 'autom4te'
  332. (arguments
  333. `(;; Libltdl is provided as a separate package, so don't install it here.
  334. #:configure-flags '("--disable-ltdl-install")
  335. ;; XXX: There are test failures on mips64el-linux starting from 2.4.4:
  336. ;; <http://hydra.gnu.org/build/181662>.
  337. #:tests? ,(not (string-prefix? "mips64"
  338. (or (%current-target-system)
  339. (%current-system))))
  340. #:phases
  341. (modify-phases %standard-phases
  342. (add-before 'check 'pre-check
  343. (lambda* (#:key inputs #:allow-other-keys)
  344. ;; Run the test suite in parallel, if possible.
  345. (setenv "TESTSUITEFLAGS"
  346. (string-append
  347. "-j"
  348. (number->string (parallel-job-count))))
  349. ;; Patch references to /bin/sh.
  350. (let ((bash (assoc-ref inputs "bash")))
  351. (substitute* "tests/testsuite"
  352. (("/bin/sh")
  353. (string-append bash "/bin/sh")))
  354. #t)))
  355. (add-after 'patch-source-shebangs 'restore-ltmain-shebang
  356. (lambda* (#:key inputs #:allow-other-keys)
  357. (substitute* "build-aux/ltmain.in"
  358. (("^#!.*/bin/sh$") "#!/bin/sh"))
  359. #t)))))
  360. (synopsis "Generic shared library support tools")
  361. (description
  362. "GNU Libtool helps in the creation and use of shared libraries, by
  363. presenting a single consistent, portable interface that hides the usual
  364. complexity of working with shared libraries across platforms.")
  365. (license gpl3+)
  366. (home-page "https://www.gnu.org/software/libtool/")))
  367. (define-public libltdl
  368. ;; This is a libltdl package separate from the libtool package. This is
  369. ;; useful because, unlike libtool, it has zero extra dependencies (making it
  370. ;; readily usable during bootstrap), and it builds very quickly since
  371. ;; Libtool's extensive test suite isn't run.
  372. (package
  373. (name "libltdl")
  374. (version "2.4.6")
  375. (source (origin
  376. (method url-fetch)
  377. (uri (string-append "mirror://gnu/libtool/libtool-"
  378. version ".tar.xz"))
  379. (sha256
  380. (base32
  381. "0vxj52zm709125gwv9qqlw02silj8bnjnh4y07arrz60r31ai1vw"))))
  382. (build-system gnu-build-system)
  383. (arguments
  384. '(#:configure-flags '("--enable-ltdl-install") ;really install it
  385. #:phases (modify-phases %standard-phases
  386. (add-before 'configure 'change-directory
  387. (lambda _ (chdir "libltdl") #t)))))
  388. (synopsis "System-independent dlopen wrapper of GNU libtool")
  389. (description (package-description libtool))
  390. (home-page (package-home-page libtool))
  391. (license lgpl2.1+)))
  392. (define-public pyconfigure
  393. (package
  394. (name "pyconfigure")
  395. (version "0.2.3")
  396. (source (origin
  397. (method url-fetch)
  398. (uri (string-append "mirror://gnu/pyconfigure/pyconfigure-"
  399. version ".tar.gz"))
  400. (sha256
  401. (base32
  402. "0kxi9bg7l6ric39vbz9ykz4a21xlihhh2zcc3297db8amvhqwhrp"))))
  403. (build-system gnu-build-system)
  404. (arguments
  405. `(#:phases
  406. (modify-phases %standard-phases
  407. (add-before 'configure 'patch-python
  408. (lambda _
  409. (substitute* "pyconf.in"
  410. (("/usr/bin/env python") (which "python3")))
  411. #t)))))
  412. (inputs
  413. `(("python" ,python-3)))
  414. (synopsis "@command{configure} interface for Python-based packages")
  415. (description
  416. "GNU pyconfigure provides template files for easily implementing
  417. standards-compliant configure scripts and Makefiles for Python-based packages.
  418. It is designed to work alongside existing Python setup scripts, making it easy
  419. to integrate into existing projects. Powerful and flexible Autoconf macros
  420. are available, allowing you to easily make adjustments to the installation
  421. procedure based on the capabilities of the target computer.")
  422. (home-page "https://www.gnu.org/software/pyconfigure/manual/")
  423. (license
  424. (fsf-free
  425. "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html"))))