build-system: Factorize the list of modules imported on the build side.

* guix/build-system/gnu.scm (%default-modules): Rename to...
  (%gnu-build-system-modules): ... this.
  (%default-modules): New variable.
  (dist-package, gnu-build): Use %GNU-BUILD-SYSTEM-MODULES for
  #:imported-modules.
  (gnu-cross-build): Likewise, and use %DEFAULT-MODULES for #:modules.
* guix/build-system/cmake.scm (%cmake-build-system-modules): New
  variable.
  (cmake-build): Use it for #:imported-modules.
* guix/build-system/glib-or-gtk.scm (%default-imported-modules): Rename
  to...
  (%glib-or-gtk-build-system-modules): ... this.  Refer to
  %GNU-BUILD-SYSTEM-MODULES.  Adjust uses.
* guix/build-system/perl.scm (%perl-build-system-modules): New
  variable.
  (perl-build): Use it for #:imported-modules.
* guix/build-system/python.scm (%python-build-system-modules): New
  variable.
  (python-build): Use it for #:imported-modules.
* guix/build-system/ruby.scm (%ruby-build-system-modules): New variable.
  (ruby-build): Use it for #:imported-modules.
* guix/build-system/waf.scm (%waf-build-system-modules): New variable.
  (waf-build): Use it for #:imported-modules.
This commit is contained in:
Ludovic Courtès 2015-04-01 15:34:19 +02:00
parent 7be8c63e0d
commit bb42c78a23
7 changed files with 62 additions and 38 deletions

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;;
;;; This file is part of GNU Guix.
@ -25,7 +25,8 @@ (define-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (ice-9 match)
#:export (cmake-build
#:export (%cmake-build-system-modules
cmake-build
cmake-build-system))
;; Commentary:
@ -35,6 +36,11 @@ (define-module (guix build-system cmake)
;;
;; Code:
(define %cmake-build-system-modules
;; Build-side modules imported by default.
`((guix build cmake-build-system)
,@%gnu-build-system-modules))
(define (default-cmake)
"Return the default CMake package."
@ -86,9 +92,7 @@ (define* (cmake-build store name inputs
(phases '(@ (guix build cmake-build-system)
%standard-phases))
(system (%current-system))
(imported-modules '((guix build cmake-build-system)
(guix build gnu-build-system)
(guix build utils)))
(imported-modules %cmake-build-system-modules)
(modules '((guix build cmake-build-system)
(guix build utils))))
"Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Federico Beffa <beffa@fbengineering.ch>
;;;
@ -26,7 +26,8 @@ (define-module (guix build-system glib-or-gtk)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (ice-9 match)
#:export (glib-or-gtk-build
#:export (%glib-or-gtk-build-system-modules
glib-or-gtk-build
glib-or-gtk-build-system))
;; Commentary:
@ -67,11 +68,10 @@ (define %default-modules
'((guix build glib-or-gtk-build-system)
(guix build utils)))
(define %default-imported-modules
(define %glib-or-gtk-build-system-modules
;; Build-side modules imported and used by default.
'((guix build gnu-build-system)
(guix build glib-or-gtk-build-system)
(guix build utils)))
`((guix build glib-or-gtk-build-system)
,@%gnu-build-system-modules))
(define (default-glib)
"Return the default glib package from which we use
@ -136,7 +136,7 @@ (define* (glib-or-gtk-build store name inputs
%standard-phases))
(glib-or-gtk-wrap-excluded-outputs ''())
(system (%current-system))
(imported-modules %default-imported-modules)
(imported-modules %glib-or-gtk-build-system-modules)
(modules %default-modules)
allowed-references)
"Build SOURCE with INPUTS. See GNU-BUILD for more details."

View file

@ -24,7 +24,8 @@ (define-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match)
#:export (gnu-build
#:export (%gnu-build-system-modules
gnu-build
gnu-build-system
standard-packages
package-with-explicit-inputs
@ -41,11 +42,16 @@ (define-module (guix build-system gnu)
;;
;; Code:
(define %default-modules
(define %gnu-build-system-modules
;; Build-side modules imported and used by default.
'((guix build gnu-build-system)
(guix build utils)))
(define %default-modules
;; Modules in scope in the build-side environment.
'((guix build gnu-build-system)
(guix build utils)))
(define* (package-with-explicit-inputs p inputs
#:optional
(loc (current-source-location))
@ -182,7 +188,7 @@ (define* (dist-package p source)
(let* ((args (default-keyword-arguments (package-arguments p)
`(#:phases #f
#:modules ,%default-modules
#:imported-modules ,%default-modules))))
#:imported-modules ,%gnu-build-system-modules))))
(substitute-keyword-arguments args
((#:modules modules)
`((guix build gnu-dist)
@ -280,7 +286,7 @@ (define* (gnu-build store name input-drvs
(phases '%standard-phases)
(locale "en_US.UTF-8")
(system (%current-system))
(imported-modules %default-modules)
(imported-modules %gnu-build-system-modules)
(modules %default-modules)
(substitutable? #t)
allowed-references)
@ -414,10 +420,8 @@ (define* (gnu-cross-build store name
(phases '%standard-phases)
(locale "en_US.UTF-8")
(system (%current-system))
(imported-modules '((guix build gnu-build-system)
(guix build utils)))
(modules '((guix build gnu-build-system)
(guix build utils)))
(imported-modules %gnu-build-system-modules)
(modules %default-modules)
(substitutable? #t)
allowed-references)
"Cross-build NAME for TARGET, where TARGET is a GNU triplet. INPUTS are

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -24,7 +24,8 @@ (define-module (guix build-system perl)
#:use-module (guix build-system gnu)
#:use-module (guix packages)
#:use-module (ice-9 match)
#:export (perl-build
#:export (%perl-build-system-modules
perl-build
perl-build-system))
;; Commentary:
@ -35,6 +36,11 @@ (define-module (guix build-system perl)
;;
;; Code:
(define %perl-build-system-modules
;; Build-side modules imported by default.
`((guix build perl-build-system)
,@%gnu-build-system-modules))
(define (default-perl)
"Return the default Perl package."
@ -83,9 +89,7 @@ (define* (perl-build store name inputs
(outputs '("out"))
(system (%current-system))
(guile #f)
(imported-modules '((guix build perl-build-system)
(guix build gnu-build-system)
(guix build utils)))
(imported-modules %perl-build-system-modules)
(modules '((guix build perl-build-system)
(guix build utils))))
"Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE

View file

@ -27,7 +27,8 @@ (define-module (guix build-system python)
#:use-module (guix build-system gnu)
#:use-module (ice-9 match)
#:use-module (srfi srfi-26)
#:export (package-with-python2
#:export (%python-build-system-modules
package-with-python2
python-build
python-build-system))
@ -38,6 +39,11 @@ (define-module (guix build-system python)
;;
;; Code:
(define %python-build-system-modules
;; Build-side modules imported by default.
`((guix build python-build-system)
,@%gnu-build-system-modules))
(define (default-python)
"Return the default Python package."
;; Lazily resolve the binding to avoid a circular dependency.
@ -132,9 +138,7 @@ (define* (python-build store name inputs
(search-paths '())
(system (%current-system))
(guile #f)
(imported-modules '((guix build python-build-system)
(guix build gnu-build-system)
(guix build utils)))
(imported-modules %python-build-system-modules)
(modules '((guix build python-build-system)
(guix build utils))))
"Build SOURCE using PYTHON, and with INPUTS. This assumes that SOURCE

View file

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 David Thompson <davet@gnu.org>
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014, 2015 Ludovic Courtès <ludo@gnu.org>
;;;
;;; This file is part of GNU Guix.
;;;
@ -25,9 +25,15 @@ (define-module (guix build-system ruby)
#:use-module (guix build-system)
#:use-module (guix build-system gnu)
#:use-module (ice-9 match)
#:export (ruby-build
#:export (%ruby-build-system-modules
ruby-build
ruby-build-system))
(define %ruby-build-system-modules
;; Build-side modules imported by default.
`((guix build ruby-build-system)
,@%gnu-build-system-modules))
(define (default-ruby)
"Return the default Ruby package."
;; Lazily resolve the binding to avoid a circular dependency.
@ -72,9 +78,7 @@ (define* (ruby-build store name inputs
(search-paths '())
(system (%current-system))
(guile #f)
(imported-modules '((guix build ruby-build-system)
(guix build gnu-build-system)
(guix build utils)))
(imported-modules %ruby-build-system-modules)
(modules '((guix build ruby-build-system)
(guix build utils))))
"Build SOURCE using RUBY and INPUTS."

View file

@ -27,7 +27,8 @@ (define-module (guix build-system waf)
#:select (default-python default-python2))
#:use-module (ice-9 match)
#:use-module (srfi srfi-26)
#:export (waf-build
#:export (%waf-build-system-modules
waf-build
waf-build-system))
;; Commentary:
@ -38,6 +39,11 @@ (define-module (guix build-system waf)
;;
;; Code:
(define %waf-build-system-modules
;; Build-side modules imported by default.
`((guix build waf-build-system)
,@%gnu-build-system-modules))
(define* (lower name
#:key source inputs native-inputs outputs system target
(python (default-python))
@ -75,9 +81,7 @@ (define* (waf-build store name inputs
(search-paths '())
(system (%current-system))
(guile #f)
(imported-modules '((guix build waf-build-system)
(guix build gnu-build-system)
(guix build utils)))
(imported-modules %waf-build-system-modules)
(modules '((guix build waf-build-system)
(guix build utils))))
"Build SOURCE with INPUTS. This assumes that SOURCE provides a 'waf' file