Mirror of GNU Guix
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.

110 lines
4.4 KiB

  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2013 Ludovic Courtès <ludo@gnu.org>
  3. ;;;
  4. ;;; This file is part of GNU Guix.
  5. ;;;
  6. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 3 of the License, or (at
  9. ;;; your option) any later version.
  10. ;;;
  11. ;;; GNU Guix is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;;; GNU General Public License for more details.
  15. ;;;
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  18. (define-module (guix build-system perl)
  19. #:use-module (guix store)
  20. #:use-module (guix utils)
  21. #:use-module (guix derivations)
  22. #:use-module (guix build-system)
  23. #:use-module (guix build-system gnu)
  24. #:use-module (guix packages)
  25. #:use-module (ice-9 match)
  26. #:export (perl-build
  27. perl-build-system))
  28. ;; Commentary:
  29. ;;
  30. ;; Standard build procedure for Perl packages using the "makefile
  31. ;; maker"---i.e., "perl Makefile.PL". This is implemented as an extension of
  32. ;; `gnu-build-system'.
  33. ;;
  34. ;; Code:
  35. (define* (perl-build store name source inputs
  36. #:key
  37. (perl (@ (gnu packages perl) perl))
  38. (search-paths '())
  39. (tests? #t)
  40. (make-maker-flags ''())
  41. (phases '(@ (guix build perl-build-system)
  42. %standard-phases))
  43. (outputs '("out"))
  44. (system (%current-system))
  45. (guile #f)
  46. (imported-modules '((guix build perl-build-system)
  47. (guix build gnu-build-system)
  48. (guix build utils)))
  49. (modules '((guix build perl-build-system)
  50. (guix build gnu-build-system)
  51. (guix build utils))))
  52. "Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE
  53. provides a `Makefile.PL' file as its build system."
  54. (define perl-search-paths
  55. (package-native-search-paths perl))
  56. (define builder
  57. `(begin
  58. (use-modules ,@modules)
  59. (perl-build #:name ,name
  60. #:source ,(if (and source (derivation-path? source))
  61. (derivation-path->output-path source)
  62. source)
  63. #:search-paths ',(map search-path-specification->sexp
  64. (append perl-search-paths
  65. search-paths))
  66. #:make-maker-flags ,make-maker-flags
  67. #:system ,system
  68. #:test-target "test"
  69. #:tests? ,tests?
  70. #:outputs %outputs
  71. #:inputs %build-inputs)))
  72. (define guile-for-build
  73. (match guile
  74. ((? package?)
  75. (package-derivation store guile system))
  76. ((and (? string?) (? derivation-path?))
  77. guile)
  78. (#f ; the default
  79. (let* ((distro (resolve-interface '(gnu packages base)))
  80. (guile (module-ref distro 'guile-final)))
  81. (package-derivation store guile system)))))
  82. (let ((perl (package-derivation store perl system)))
  83. (build-expression->derivation store name system
  84. builder
  85. `(,@(if source
  86. `(("source" ,source))
  87. '())
  88. ("perl" ,perl)
  89. ,@inputs
  90. ;; Keep the standard inputs of
  91. ;; `gnu-build-system'.
  92. ,@(standard-inputs system))
  93. #:modules imported-modules
  94. #:outputs outputs
  95. #:guile-for-build guile-for-build)))
  96. (define perl-build-system
  97. (build-system (name 'perl)
  98. (description "The standard Perl build system")
  99. (build perl-build)))
  100. ;;; perl.scm ends here