~ruther/guix-local

bb42c78a23a96ef79c2b5e3b98c55eef53eac9fe — Ludovic Courtès 11 years ago 7be8c63
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.
M guix/build-system/cmake.scm => guix/build-system/cmake.scm +9 -5
@@ 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 @@
  #: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 @@
;;
;; 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 @@
                      (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

M guix/build-system/glib-or-gtk.scm => guix/build-system/glib-or-gtk.scm +7 -7
@@ 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 @@
  #: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 @@
  '((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 @@
                                        %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."

M guix/build-system/gnu.scm => guix/build-system/gnu.scm +12 -8
@@ 24,7 24,8 @@
  #: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 @@
;;
;; 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 @@ runs `make distcheck' and whose result is one or more source tarballs."
       (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 @@ standard packages used as implicit inputs of the GNU build system."
                    (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 @@ is one of `host' or `target'."
                          (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

M guix/build-system/perl.scm => guix/build-system/perl.scm +9 -5
@@ 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 @@
  #: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 @@
;;
;; 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 @@
                     (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

M guix/build-system/python.scm => guix/build-system/python.scm +8 -4
@@ 27,7 27,8 @@
  #: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 @@
;;
;; 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 @@ prepended to the name."
                       (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

M guix/build-system/ruby.scm => guix/build-system/ruby.scm +9 -5
@@ 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 @@
  #: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 @@
                     (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."

M guix/build-system/waf.scm => guix/build-system/waf.scm +8 -4
@@ 27,7 27,8 @@
                #: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 @@
;;
;; 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 @@
                       (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