From bb42c78a23a96ef79c2b5e3b98c55eef53eac9fe Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 1 Apr 2015 15:34:19 +0200 Subject: 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. --- guix/build-system/cmake.scm | 14 +++++++++----- guix/build-system/glib-or-gtk.scm | 14 +++++++------- guix/build-system/gnu.scm | 20 ++++++++++++-------- guix/build-system/perl.scm | 14 +++++++++----- guix/build-system/python.scm | 12 ++++++++---- guix/build-system/ruby.scm | 14 +++++++++----- guix/build-system/waf.scm | 12 ++++++++---- 7 files changed, 62 insertions(+), 38 deletions(-) (limited to 'guix') diff --git a/guix/build-system/cmake.scm b/guix/build-system/cmake.scm index 0425e9fb39..2e6784251e 100644 --- a/guix/build-system/cmake.scm +++ b/guix/build-system/cmake.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013 Cyril Roelandt ;;; ;;; 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 diff --git a/guix/build-system/glib-or-gtk.scm b/guix/build-system/glib-or-gtk.scm index 7a90587136..85d01961a5 100644 --- a/guix/build-system/glib-or-gtk.scm +++ b/guix/build-system/glib-or-gtk.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015 Ludovic Courtès ;;; Copyright © 2013 Cyril Roelandt ;;; Copyright © 2014 Federico Beffa ;;; @@ -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." diff --git a/guix/build-system/gnu.scm b/guix/build-system/gnu.scm index c91ad2ee0c..e4cbd29395 100644 --- a/guix/build-system/gnu.scm +++ b/guix/build-system/gnu.scm @@ -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 diff --git a/guix/build-system/perl.scm b/guix/build-system/perl.scm index e0f86438a8..7833153676 100644 --- a/guix/build-system/perl.scm +++ b/guix/build-system/perl.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015 Ludovic Courtès ;;; ;;; 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 diff --git a/guix/build-system/python.scm b/guix/build-system/python.scm index 37108650d0..d498cf618b 100644 --- a/guix/build-system/python.scm +++ b/guix/build-system/python.scm @@ -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 diff --git a/guix/build-system/ruby.scm b/guix/build-system/ruby.scm index 08301ec609..83bc93d901 100644 --- a/guix/build-system/ruby.scm +++ b/guix/build-system/ruby.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2014 David Thompson -;;; Copyright © 2014 Ludovic Courtès +;;; Copyright © 2014, 2015 Ludovic Courtès ;;; ;;; 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." diff --git a/guix/build-system/waf.scm b/guix/build-system/waf.scm index 494cb957ac..c67f649fa7 100644 --- a/guix/build-system/waf.scm +++ b/guix/build-system/waf.scm @@ -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 -- cgit v1.2.3