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 ;;; 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 © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
@ -25,7 +25,8 @@
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (cmake-build #:export (%cmake-build-system-modules
cmake-build
cmake-build-system)) cmake-build-system))
;; Commentary: ;; Commentary:
@ -35,6 +36,11 @@
;; ;;
;; Code: ;; Code:
(define %cmake-build-system-modules
;; Build-side modules imported by default.
`((guix build cmake-build-system)
,@%gnu-build-system-modules))
(define (default-cmake) (define (default-cmake)
"Return the default CMake package." "Return the default CMake package."
@ -86,9 +92,7 @@
(phases '(@ (guix build cmake-build-system) (phases '(@ (guix build cmake-build-system)
%standard-phases)) %standard-phases))
(system (%current-system)) (system (%current-system))
(imported-modules '((guix build cmake-build-system) (imported-modules %cmake-build-system-modules)
(guix build gnu-build-system)
(guix build utils)))
(modules '((guix build cmake-build-system) (modules '((guix build cmake-build-system)
(guix build utils)))) (guix build utils))))
"Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE "Build SOURCE using CMAKE, and with INPUTS. This assumes that SOURCE

View File

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

View File

@ -24,7 +24,8 @@
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (gnu-build #:export (%gnu-build-system-modules
gnu-build
gnu-build-system gnu-build-system
standard-packages standard-packages
package-with-explicit-inputs package-with-explicit-inputs
@ -41,11 +42,16 @@
;; ;;
;; Code: ;; Code:
(define %default-modules (define %gnu-build-system-modules
;; Build-side modules imported and used by default. ;; Build-side modules imported and used by default.
'((guix build gnu-build-system) '((guix build gnu-build-system)
(guix build utils))) (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 (define* (package-with-explicit-inputs p inputs
#:optional #:optional
(loc (current-source-location)) (loc (current-source-location))
@ -182,7 +188,7 @@ runs `make distcheck' and whose result is one or more source tarballs."
(let* ((args (default-keyword-arguments (package-arguments p) (let* ((args (default-keyword-arguments (package-arguments p)
`(#:phases #f `(#:phases #f
#:modules ,%default-modules #:modules ,%default-modules
#:imported-modules ,%default-modules)))) #:imported-modules ,%gnu-build-system-modules))))
(substitute-keyword-arguments args (substitute-keyword-arguments args
((#:modules modules) ((#:modules modules)
`((guix build gnu-dist) `((guix build gnu-dist)
@ -280,7 +286,7 @@ standard packages used as implicit inputs of the GNU build system."
(phases '%standard-phases) (phases '%standard-phases)
(locale "en_US.UTF-8") (locale "en_US.UTF-8")
(system (%current-system)) (system (%current-system))
(imported-modules %default-modules) (imported-modules %gnu-build-system-modules)
(modules %default-modules) (modules %default-modules)
(substitutable? #t) (substitutable? #t)
allowed-references) allowed-references)
@ -414,10 +420,8 @@ is one of `host' or `target'."
(phases '%standard-phases) (phases '%standard-phases)
(locale "en_US.UTF-8") (locale "en_US.UTF-8")
(system (%current-system)) (system (%current-system))
(imported-modules '((guix build gnu-build-system) (imported-modules %gnu-build-system-modules)
(guix build utils))) (modules %default-modules)
(modules '((guix build gnu-build-system)
(guix build utils)))
(substitutable? #t) (substitutable? #t)
allowed-references) allowed-references)
"Cross-build NAME for TARGET, where TARGET is a GNU triplet. INPUTS are "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 ;;; 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. ;;; This file is part of GNU Guix.
;;; ;;;
@ -24,7 +24,8 @@
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:export (perl-build #:export (%perl-build-system-modules
perl-build
perl-build-system)) perl-build-system))
;; Commentary: ;; Commentary:
@ -35,6 +36,11 @@
;; ;;
;; Code: ;; Code:
(define %perl-build-system-modules
;; Build-side modules imported by default.
`((guix build perl-build-system)
,@%gnu-build-system-modules))
(define (default-perl) (define (default-perl)
"Return the default Perl package." "Return the default Perl package."
@ -83,9 +89,7 @@
(outputs '("out")) (outputs '("out"))
(system (%current-system)) (system (%current-system))
(guile #f) (guile #f)
(imported-modules '((guix build perl-build-system) (imported-modules %perl-build-system-modules)
(guix build gnu-build-system)
(guix build utils)))
(modules '((guix build perl-build-system) (modules '((guix build perl-build-system)
(guix build utils)))) (guix build utils))))
"Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE "Build SOURCE using PERL, and with INPUTS. This assumes that SOURCE

View File

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

View File

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

View File

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