build-system/guile: Add #:not-compiled-file-regexp.

* guix/build/guile-build-system.scm (build): Add
 #:not-compiled-file-regexp and honor it.
* guix/build-system/guile.scm (guile-build): Likewise.
(guile-cross-build): Likewise.
This commit is contained in:
Ludovic Courtès 2019-06-02 20:59:34 +02:00
parent abeb54c00b
commit 30eb738366
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
2 changed files with 24 additions and 12 deletions

View File

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2018 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2018, 2019 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -75,6 +75,7 @@
(search-paths '()) (search-paths '())
(system (%current-system)) (system (%current-system))
(source-directory ".") (source-directory ".")
not-compiled-file-regexp
(compile-flags %compile-flags) (compile-flags %compile-flags)
(imported-modules %guile-build-system-modules) (imported-modules %guile-build-system-modules)
(modules '((guix build guile-build-system) (modules '((guix build guile-build-system)
@ -92,6 +93,7 @@
(source (source
source)) source))
#:source-directory ,source-directory #:source-directory ,source-directory
#:not-compiled-file-regexp ,not-compiled-file-regexp
#:compile-flags ,compile-flags #:compile-flags ,compile-flags
#:phases ,phases #:phases ,phases
#:system ,system #:system ,system
@ -128,6 +130,7 @@
(phases '%standard-phases) (phases '%standard-phases)
(source-directory ".") (source-directory ".")
not-compiled-file-regexp
(compile-flags %compile-flags) (compile-flags %compile-flags)
(imported-modules %guile-build-system-modules) (imported-modules %guile-build-system-modules)
(modules '((guix build guile-build-system) (modules '((guix build guile-build-system)
@ -168,6 +171,7 @@
#:target ,target #:target ,target
#:outputs %outputs #:outputs %outputs
#:source-directory ,source-directory #:source-directory ,source-directory
#:not-compiled-file-regexp ,not-compiled-file-regexp
#:compile-flags ,compile-flags #:compile-flags ,compile-flags
#:inputs %build-target-inputs #:inputs %build-target-inputs
#:native-inputs %build-host-inputs #:native-inputs %build-host-inputs

View File

@ -19,10 +19,12 @@
(define-module (guix build guile-build-system) (define-module (guix build guile-build-system)
#:use-module ((guix build gnu-build-system) #:prefix gnu:) #:use-module ((guix build gnu-build-system) #:prefix gnu:)
#:use-module (guix build utils) #:use-module (guix build utils)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26) #:use-module (srfi srfi-26)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (ice-9 popen) #:use-module (ice-9 popen)
#:use-module (ice-9 rdelim) #:use-module (ice-9 rdelim)
#:use-module (ice-9 regex)
#:use-module (guix build utils) #:use-module (guix build utils)
#:export (target-guile-effective-version #:export (target-guile-effective-version
%standard-phases %standard-phases
@ -134,9 +136,12 @@ Raise an error if one of the processes exit with non-zero."
(source-directory ".") (source-directory ".")
(compile-flags '()) (compile-flags '())
(scheme-file-regexp %scheme-file-regexp) (scheme-file-regexp %scheme-file-regexp)
(not-compiled-file-regexp #f)
target target
#:allow-other-keys) #:allow-other-keys)
"Build files in SOURCE-DIRECTORY that match SCHEME-FILE-REGEXP." "Build files in SOURCE-DIRECTORY that match SCHEME-FILE-REGEXP. Files
matching NOT-COMPILED-FILE-REGEXP, if true, are not compiled but are
installed; this is useful for files that are meant to be included."
(let* ((out (assoc-ref outputs "out")) (let* ((out (assoc-ref outputs "out"))
(guile (assoc-ref (or native-inputs inputs) "guile")) (guile (assoc-ref (or native-inputs inputs) "guile"))
(effective (target-guile-effective-version guile)) (effective (target-guile-effective-version guile))
@ -171,16 +176,19 @@ Raise an error if one of the processes exit with non-zero."
(with-directory-excursion source-directory (with-directory-excursion source-directory
(find-files "." scheme-file-regexp)))) (find-files "." scheme-file-regexp))))
(invoke-each (invoke-each
(map (lambda (file) (filter-map (lambda (file)
(cons* guild (and (or (not not-compiled-file-regexp)
"guild" "compile" (not (string-match not-compiled-file-regexp
"-L" source-directory file)))
"-o" (string-append go-dir (cons* guild
(file-sans-extension file) "guild" "compile"
".go") "-L" source-directory
(string-append source-directory "/" file) "-o" (string-append go-dir
flags)) (file-sans-extension file)
source-files) ".go")
(string-append source-directory "/" file)
flags)))
source-files)
#:max-processes (parallel-job-count) #:max-processes (parallel-job-count)
#:report-progress report-build-progress) #:report-progress report-build-progress)