2016-10-07 17:57:08 -04:00
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2017-04-03 09:01:20 -04:00
|
|
|
;;; Copyright © 2016, 2017 Andy Patterson <ajpatter@uwaterloo.ca>
|
2022-08-03 05:46:17 -04:00
|
|
|
;;; Copyright © 2020, 2021, 2022 Guillaume Le Vaillant <glv@posteo.net>
|
2022-07-01 11:17:32 -04:00
|
|
|
;;; Copyright © 2022 Pierre Neidhardt <mail@ambrevar.xyz>
|
2016-10-07 17:57:08 -04:00
|
|
|
;;;
|
|
|
|
;;; This file is part of GNU Guix.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is free software; you can redistribute it and/or modify it
|
|
|
|
;;; under the terms of the GNU General Public License as published by
|
|
|
|
;;; the Free Software Foundation; either version 3 of the License, or (at
|
|
|
|
;;; your option) any later version.
|
|
|
|
;;;
|
|
|
|
;;; GNU Guix is distributed in the hope that it will be useful, but
|
|
|
|
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;;; GNU General Public License for more details.
|
|
|
|
;;;
|
|
|
|
;;; You should have received a copy of the GNU General Public License
|
|
|
|
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
(define-module (guix build asdf-build-system)
|
|
|
|
#:use-module ((guix build gnu-build-system) #:prefix gnu:)
|
|
|
|
#:use-module (guix build utils)
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
#:use-module (guix build union)
|
2016-10-07 17:57:08 -04:00
|
|
|
#:use-module (guix build lisp-utils)
|
|
|
|
#:use-module (srfi srfi-1)
|
2017-04-03 09:01:23 -04:00
|
|
|
#:use-module (srfi srfi-11)
|
2016-10-07 17:57:08 -04:00
|
|
|
#:use-module (srfi srfi-26)
|
|
|
|
#:use-module (ice-9 rdelim)
|
|
|
|
#:use-module (ice-9 receive)
|
|
|
|
#:use-module (ice-9 regex)
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
#:use-module (ice-9 format)
|
|
|
|
#:use-module (ice-9 ftw)
|
|
|
|
#:export (%standard-phases
|
|
|
|
%standard-phases/source
|
|
|
|
asdf-build
|
|
|
|
asdf-build/source))
|
|
|
|
|
|
|
|
;; Commentary:
|
|
|
|
;;
|
|
|
|
;; System for building ASDF packages; creating executable programs and images
|
|
|
|
;; from them.
|
|
|
|
;;
|
|
|
|
;; Code:
|
|
|
|
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(define %object-prefix "/lib/common-lisp")
|
2016-10-07 17:57:08 -04:00
|
|
|
|
2017-04-03 09:01:27 -04:00
|
|
|
(define (%lisp-source-install-prefix)
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(string-append %source-install-prefix "/" (%lisp-type)))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
|
|
|
(define %system-install-prefix
|
2017-04-03 09:01:20 -04:00
|
|
|
(string-append %source-install-prefix "/systems"))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(define (main-system-name output)
|
2021-05-06 04:32:56 -04:00
|
|
|
;; FIXME: Find a more reliable way to get the main system name.
|
|
|
|
(let* ((full-name (strip-store-file-name output))
|
|
|
|
(lisp-prefix (string-append (%lisp-type) "-"))
|
|
|
|
(package-name (if (string-prefix? lisp-prefix full-name)
|
|
|
|
(string-drop full-name (string-length lisp-prefix))
|
|
|
|
full-name)))
|
|
|
|
(package-name->name+version package-name)))
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
|
2017-04-03 09:01:27 -04:00
|
|
|
(define (lisp-source-directory output name)
|
|
|
|
(string-append output (%lisp-source-install-prefix) "/" name))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
|
|
|
(define (source-directory output name)
|
2017-04-03 09:01:20 -04:00
|
|
|
(string-append output %source-install-prefix "/source/" name))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
2017-04-03 09:01:27 -04:00
|
|
|
(define (library-directory output)
|
2016-10-07 17:57:08 -04:00
|
|
|
(string-append output %object-prefix
|
2017-04-03 09:01:27 -04:00
|
|
|
"/" (%lisp-type)))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
|
|
|
(define (output-translation source-path
|
2017-04-03 09:01:27 -04:00
|
|
|
object-output)
|
2021-06-06 19:55:50 -04:00
|
|
|
"Return a translation for the system's source path to its binary output."
|
2016-10-07 17:57:08 -04:00
|
|
|
`((,source-path
|
|
|
|
:**/ :*.*.*)
|
2017-04-03 09:01:27 -04:00
|
|
|
(,(library-directory object-output)
|
2016-10-07 17:57:08 -04:00
|
|
|
:**/ :*.*.*)))
|
|
|
|
|
2017-04-03 09:01:21 -04:00
|
|
|
(define (copy-files-to-output out name)
|
|
|
|
"Copy all files from the current directory to OUT. Create an extra link to
|
|
|
|
any system-defining files in the source to a convenient location. This is
|
|
|
|
done before any compiling so that the compiled source locations will be
|
|
|
|
valid."
|
|
|
|
(let ((source (getcwd))
|
|
|
|
(target (source-directory out name))
|
|
|
|
(system-path (string-append out %system-install-prefix)))
|
2020-01-12 08:29:41 -05:00
|
|
|
;; SBCL keeps the modification time of the source file in the compiled
|
|
|
|
;; file, and the source files might just have been patched by a custom
|
|
|
|
;; phase. Therefore we reset the modification time of all the source
|
|
|
|
;; files before compiling.
|
|
|
|
(for-each (lambda (file)
|
|
|
|
(let ((s (lstat file)))
|
2020-05-07 08:25:51 -04:00
|
|
|
(unless (or (eq? (stat:type s) 'symlink)
|
|
|
|
(not (access? file W_OK)))
|
2020-01-12 08:29:41 -05:00
|
|
|
(utime file 0 0 0 0))))
|
|
|
|
(find-files source #:directories? #t))
|
2020-01-08 08:54:01 -05:00
|
|
|
(copy-recursively source target #:keep-mtime? #t)
|
2016-10-07 17:57:08 -04:00
|
|
|
(mkdir-p system-path)
|
|
|
|
(for-each
|
|
|
|
(lambda (file)
|
|
|
|
(symlink file
|
|
|
|
(string-append system-path "/" (basename file))))
|
|
|
|
(find-files target "\\.asd$"))
|
|
|
|
#t))
|
|
|
|
|
2020-05-07 08:25:51 -04:00
|
|
|
(define* (install #:key inputs outputs #:allow-other-keys)
|
|
|
|
"Copy and symlink all the source files.
|
|
|
|
The source files are taken from the corresponding compile package (e.g. SBCL)
|
|
|
|
if it's present in the native-inputs."
|
2017-04-08 23:48:38 -04:00
|
|
|
(define output (assoc-ref outputs "out"))
|
2020-05-07 08:25:51 -04:00
|
|
|
(define package-name
|
|
|
|
(package-name->name+version
|
|
|
|
(strip-store-file-name output)))
|
|
|
|
(define (no-prefix pkgname)
|
2020-09-15 16:00:29 -04:00
|
|
|
(let ((index (string-index pkgname #\-)))
|
|
|
|
(if index
|
|
|
|
(string-drop pkgname (1+ index))
|
|
|
|
pkgname)))
|
2020-05-07 08:25:51 -04:00
|
|
|
(define parent
|
|
|
|
(match (assoc package-name inputs
|
|
|
|
(lambda (key alist-car)
|
|
|
|
(let* ((alt-key (no-prefix key))
|
|
|
|
(alist-car (no-prefix alist-car)))
|
|
|
|
(or (string=? alist-car key)
|
|
|
|
(string=? alist-car alt-key)))))
|
|
|
|
(#f #f)
|
|
|
|
(p (cdr p))))
|
|
|
|
(define parent-name
|
|
|
|
(and parent
|
|
|
|
(package-name->name+version (strip-store-file-name parent))))
|
|
|
|
(define parent-source
|
|
|
|
(and parent
|
|
|
|
(string-append parent "/share/common-lisp/"
|
2020-09-15 16:00:29 -04:00
|
|
|
(let ((index (string-index parent-name #\-)))
|
|
|
|
(if index
|
|
|
|
(string-take parent-name index)
|
|
|
|
parent-name)))))
|
2020-05-07 08:25:51 -04:00
|
|
|
|
|
|
|
(define (first-subdirectory directory) ; From gnu-build-system.
|
|
|
|
"Return the file name of the first sub-directory of DIRECTORY."
|
|
|
|
(match (scandir directory
|
|
|
|
(lambda (file)
|
|
|
|
(and (not (member file '("." "..")))
|
|
|
|
(file-is-directory? (string-append directory "/"
|
|
|
|
file)))))
|
|
|
|
((first . _) first)))
|
|
|
|
(define source-directory
|
|
|
|
(if (and parent-source
|
|
|
|
(file-exists? parent-source))
|
|
|
|
(string-append parent-source "/" (first-subdirectory parent-source))
|
|
|
|
"."))
|
|
|
|
|
|
|
|
(with-directory-excursion source-directory
|
|
|
|
(copy-files-to-output output package-name)))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(define* (copy-source #:key outputs asd-systems #:allow-other-keys)
|
2017-04-03 09:01:21 -04:00
|
|
|
"Copy the source to the library output."
|
|
|
|
(let* ((out (library-output outputs))
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(install-path (string-append out %source-install-prefix))
|
|
|
|
(system-name (main-system-name out)))
|
|
|
|
(copy-files-to-output out system-name)
|
2016-10-07 17:57:08 -04:00
|
|
|
;; Hide the files from asdf
|
|
|
|
(with-directory-excursion install-path
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(rename-file "source" (%lisp-type))
|
2016-10-07 17:57:08 -04:00
|
|
|
(delete-file-recursively "systems")))
|
|
|
|
#t)
|
|
|
|
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(define* (configure #:key inputs #:allow-other-keys)
|
|
|
|
;; Create a directory having the configuration files for
|
|
|
|
;; all the dependencies in 'etc/common-lisp/'.
|
|
|
|
(let ((out (string-append (getcwd) "/.cl-union")))
|
|
|
|
(match inputs
|
|
|
|
(((name . directories) ...)
|
|
|
|
(union-build out (filter directory-exists? directories)
|
|
|
|
#:create-all-directories? #t
|
|
|
|
#:log-port (%make-void-port "w"))))
|
|
|
|
(setenv "CL_UNION" out)
|
|
|
|
(setenv "XDG_CONFIG_DIRS" (string-append out "/etc")))
|
|
|
|
#t)
|
|
|
|
|
2022-08-03 05:46:17 -04:00
|
|
|
(define* (build #:key outputs inputs asd-systems asd-operation
|
2016-10-07 17:57:08 -04:00
|
|
|
#:allow-other-keys)
|
|
|
|
"Compile the system."
|
2017-04-03 09:01:21 -04:00
|
|
|
(let* ((out (library-output outputs))
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(system-name (main-system-name out))
|
|
|
|
(source-path (string-append out (%lisp-source-install-prefix)))
|
2016-10-07 17:57:08 -04:00
|
|
|
(translations (wrap-output-translations
|
|
|
|
`(,(output-translation source-path
|
2022-07-01 11:17:32 -04:00
|
|
|
out)))))
|
2016-10-07 17:57:08 -04:00
|
|
|
(setenv "ASDF_OUTPUT_TRANSLATIONS"
|
|
|
|
(replace-escaped-macros (format #f "~S" translations)))
|
|
|
|
(setenv "HOME" out) ; ecl's asdf sometimes wants to create $HOME/.cache
|
2022-08-03 05:46:17 -04:00
|
|
|
(compile-systems asd-systems
|
|
|
|
(lisp-source-directory out system-name)
|
|
|
|
asd-operation))
|
2016-10-07 17:57:08 -04:00
|
|
|
#t)
|
|
|
|
|
2022-07-01 11:17:32 -04:00
|
|
|
(define* (check #:key tests? outputs inputs asd-test-systems
|
2016-10-07 17:57:08 -04:00
|
|
|
#:allow-other-keys)
|
|
|
|
"Test the system."
|
2017-04-08 23:48:38 -04:00
|
|
|
(let* ((out (library-output outputs))
|
2022-07-01 11:17:32 -04:00
|
|
|
(system-name (main-system-name out)))
|
2016-10-07 17:57:08 -04:00
|
|
|
(if tests?
|
2022-07-01 11:17:32 -04:00
|
|
|
(test-system asd-test-systems (lisp-source-directory out system-name))
|
2016-10-07 17:57:08 -04:00
|
|
|
(format #t "test suite not run~%")))
|
|
|
|
#t)
|
|
|
|
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(define* (create-asdf-configuration #:key inputs outputs #:allow-other-keys)
|
|
|
|
"Create the ASDF configuration files for the built systems."
|
|
|
|
(let* ((system-name (main-system-name (assoc-ref outputs "out")))
|
|
|
|
(out (library-output outputs))
|
|
|
|
(conf-dir (string-append out "/etc/common-lisp"))
|
|
|
|
(deps-conf-dir (string-append (getenv "CL_UNION") "/etc/common-lisp"))
|
|
|
|
(source-dir (lisp-source-directory out system-name))
|
|
|
|
(lib-dir (string-append (library-directory out) "/" system-name)))
|
|
|
|
(make-asdf-configuration system-name conf-dir deps-conf-dir
|
|
|
|
source-dir lib-dir)
|
|
|
|
#t))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
2017-04-03 09:01:27 -04:00
|
|
|
(define* (cleanup-files #:key outputs
|
2017-04-03 09:01:23 -04:00
|
|
|
#:allow-other-keys)
|
2016-10-07 17:57:08 -04:00
|
|
|
"Remove any compiled files which are not a part of the final bundle."
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(let* ((out (library-output outputs))
|
|
|
|
(cache-directory (string-append out "/.cache")))
|
|
|
|
;; Remove the cache directory in case the lisp implementation wrote
|
|
|
|
;; something in there when compiling or testing a system.
|
|
|
|
(when (directory-exists? cache-directory)
|
|
|
|
(delete-file-recursively cache-directory)))
|
2016-10-07 17:57:08 -04:00
|
|
|
#t)
|
|
|
|
|
2017-04-03 09:01:27 -04:00
|
|
|
(define* (strip #:rest args)
|
2016-10-07 17:57:08 -04:00
|
|
|
;; stripping sbcl binaries removes their entry program and extra systems
|
2017-04-03 09:01:27 -04:00
|
|
|
(or (string=? (%lisp-type) "sbcl")
|
2016-10-07 17:57:08 -04:00
|
|
|
(apply (assoc-ref gnu:%standard-phases 'strip) args)))
|
|
|
|
|
|
|
|
(define %standard-phases/source
|
|
|
|
(modify-phases gnu:%standard-phases
|
2018-03-11 16:46:30 -04:00
|
|
|
(delete 'bootstrap)
|
2016-10-07 17:57:08 -04:00
|
|
|
(delete 'configure)
|
|
|
|
(delete 'check)
|
|
|
|
(delete 'build)
|
|
|
|
(replace 'install install)))
|
|
|
|
|
|
|
|
(define %standard-phases
|
|
|
|
(modify-phases gnu:%standard-phases
|
2018-03-11 16:46:30 -04:00
|
|
|
(delete 'bootstrap)
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(replace 'configure configure)
|
|
|
|
(add-before 'configure 'copy-source copy-source)
|
2016-10-07 17:57:08 -04:00
|
|
|
(replace 'build build)
|
|
|
|
(replace 'check check)
|
build-system: asdf: Switch from bundles to regular compilation.
* gnu/packages/lisp.scm (sbcl, ecl)[native-search-paths]: Add
'XDG_CONFIG_DIRS'.
* guix/build-system/asdf.scm (asdf-build): Replace 'asd-file' and
'asd-system-name' keywords by 'asd-files' and 'asd-systems'.
* guix/build/asdf-build-system.scm (%object-prefix,
%lisp-source-install-prefix): Update variables.
(install): Update variable.
(main-system-name): New variable.
(copy-source): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(configure): New variable.
(build, check): Replace 'asd-file' and 'asd-system-name' keywords by
'asd-files' and 'asd-systems'.
(create-asd-file, symlink-asd-files): Remove variables.
(create-asdf-configuration): New variable.
(cleanup-files): Update variable.
(%standard-phases): Remove 'create-asd-file' and 'symlink-asd-files' phases.
Add 'configure' and 'create-asdf-configuration' phases.
* guix/build/lisp-utils.scm (%bundle-install-prefix, normalize-dependency,
inputs->asd-file-map, asdf-load-all, compile-system): Remove variables.
(compile-systems): New variable.
(system-dependencies, compiled-system, generate-system-definition): Remove
variable.
(test-system): Replace 'asd-file' parameter by 'asd-files'.
(generate-executable-for-system): Update variable.
(generate-dependency-links, make-asd-file, bundle-asd-file): Remove
variables.
(make-asdf-configuration): New variable.
(build-program, build-image): Set 'XDG_CONFIG_DIRS'.
(generate-executable): Update variable.
2020-09-07 08:57:57 -04:00
|
|
|
(add-after 'check 'create-asdf-configuration create-asdf-configuration)
|
|
|
|
(add-after 'create-asdf-configuration 'cleanup cleanup-files)
|
|
|
|
(delete 'install)
|
|
|
|
(replace 'strip strip)))
|
2016-10-07 17:57:08 -04:00
|
|
|
|
|
|
|
(define* (asdf-build #:key inputs
|
|
|
|
(phases %standard-phases)
|
|
|
|
#:allow-other-keys
|
|
|
|
#:rest args)
|
|
|
|
(apply gnu:gnu-build
|
|
|
|
#:inputs inputs
|
|
|
|
#:phases phases
|
|
|
|
args))
|
|
|
|
|
|
|
|
(define* (asdf-build/source #:key inputs
|
|
|
|
(phases %standard-phases/source)
|
|
|
|
#:allow-other-keys
|
|
|
|
#:rest args)
|
|
|
|
(apply gnu:gnu-build
|
|
|
|
#:inputs inputs
|
|
|
|
#:phases phases
|
|
|
|
args))
|
|
|
|
|
|
|
|
;;; asdf-build-system.scm ends here
|