unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
blob 4355d8e444feb989c6e1a31de12f2727da9a2c70 2954 bytes (raw)
name: guix/build/gerbil-build-system.scm 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
 
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
;;;
;;; 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 gerbil-build-system)
  #:use-module ((guix build gnu-build-system) #:prefix gnu:)
  #:use-module (guix build union)
  #:use-module (guix build utils)
  #:use-module (srfi srfi-26)
  #:export (%standard-phases
            gerbil-build))

;;; Commentary:
;;;
;;; Build-side code for building Gerbil packages.
;;;
;;; Something to note is that there is no standard way to run tests
;;; for Gerbil packages, so there is not `check' phase by default.
;;;
;;; Code:

(define (gerbil-package? name)
  "Whether NAME is a Gerbil package."
  (string-prefix? "gerbil-" name))

(define (gerbil-load-path inputs)
  "Given an alist of inputs, INPUTS, return a list of directories to add
to the GERBIL_LOADPTH environment variable."
  (let* ((labels (map car inputs))
         (gerbil-packages (filter gerbil-package? labels)))
    (map (cut string-append <> "/lib/gerbil")
         gerbil-packages)))
  
(define* (setup-gerbil-environment #:key inputs #:allow-other-keys)
  ;; This is where the compiled modules will end up.
  (setenv "GERBIL_PATH" (string-append (getcwd) "/.build"))
  ;; Where to look for other Gerbil modules.
  (setenv "GERBIL_LOADPATH" (string-join (gerbil-load-path inputs) ":")))
  
(define* (build #:key build-flags #:allow-other-keys)
  ;; The build.ss script contians the build instructions.
  (apply invoke "./build.ss" build-flags))

(define* (install #:key outputs #:allow-other-keys)
  (let ((out (assoc-ref outputs "out")))
    (mkdir-p (string-append out "/lib/gerbil"))
    (copy-recursively ".build/lib" (string-append out "/lib/gerbil"))
    (copy-recursively ".build/bin" (string-append out "/bin"))))

(define %standard-phases
  (modify-phases gnu:%standard-phases
    (delete 'bootstrap)
    (delete 'configure)
    (add-after 'unpack 'setup-gerbil-environment setup-gerbil-environment)
    (replace 'build build)
    (delete 'check)
    (replace 'install install)))

(define* (gerbil-build #:key (phases %standard-phases)
                       #:allow-other-keys #:rest args)
  "Build the given Gerbil packages, applying all of PHASES in order."
  (apply gnu:gnu-build #:phases phases args))

    

debug log:

solving 4355d8e444 ...
found 4355d8e444 in https://yhetil.org/guix-patches/925c0e686f56bcc19b2db7ab1c38767e3bd74b9e.1628172101.git.public@yoctocell.xyz/

applying [1/1] https://yhetil.org/guix-patches/925c0e686f56bcc19b2db7ab1c38767e3bd74b9e.1628172101.git.public@yoctocell.xyz/
diff --git a/guix/build/gerbil-build-system.scm b/guix/build/gerbil-build-system.scm
new file mode 100644
index 0000000000..4355d8e444

1:53: trailing whitespace.
  
1:59: trailing whitespace.
  
1:84: trailing whitespace.
    
Checking patch guix/build/gerbil-build-system.scm...
1:83: new blank line at EOF.
+
Applied patch guix/build/gerbil-build-system.scm cleanly.
warning: 4 lines add whitespace errors.

index at:
100644 4355d8e444feb989c6e1a31de12f2727da9a2c70	guix/build/gerbil-build-system.scm

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).