-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.ss
executable file
·68 lines (58 loc) · 2.53 KB
/
build.ss
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
#!/usr/bin/env gxi
;; -*- Gerbil -*-
(import
:gerbil/expander
#;(only-in :std/error dump-stack-trace?) ;; Only in v0.19
(only-in :std/cli/getopt rest-arguments option)
(only-in :std/cli/multicall define-entry-point call-entry-point define-multicall-main)
:std/misc/list
:std/misc/process
:std/source
:std/srfi/1
:std/sugar)
(def srcdir (path-normalize (path-directory (this-source-file))))
(current-directory srcdir)
(add-load-path! srcdir)
(import-module ':clan/building #t #t)
(def (files)
(cons* "t/test-support.ss" ;; temporary, until dependents are updated
[exe: "scripts/random-run.ss" bin: "random-run"]
(clan/building#all-gerbil-modules
exclude-dirs: [clan/building#default-exclude-dirs ... "scripts"])))
;; In your build file, you can (import :clan/building) and use (init-build-environment! ...),
;; and later use (define-entry-point ...).
;; But in this build, file we have to bootstrap without imported macros.
(clan/building#%set-build-environment!
srcdir
name: "Gerbil-utils"
spec: files)
(define-multicall-main)
(define-entry-point (nix . opts)
(help: "build using nix-build"
getopt: [(rest-arguments 'nix-options help: "options to pass on to nix")])
(clan/building#create-version-file)
(run-process ["nix-build" opts ...])
(void))
(define-entry-point (docker . opts)
(help: "build a Gerbil NixOS docker image"
getopt: [(rest-arguments 'docker-options help: "options to pass on to docker")])
(void (run-process ["./scripts/make-docker-image.ss" opts ...]
stdin-redirection: #f stdout-redirection: #f)))
(define-entry-point (nixpkgs nixpkgs-file: (nixpkgs-file #f))
(help: "build all gerbil packages and their dependencies"
getopt: [(option 'nixpkgs-file "-f" "--file" help: "path or url for nixpkgs")])
(void (run-process ["nix-env" "--show-trace"
(when/list nixpkgs-file ["--file" nixpkgs-file])...
"-iA" "gerbil-unstable" "gerbilPackages-unstable"])))
(define-entry-point (publish-nixpkgs nixpkgs-file: (nixpkgs-file #f))
(help: "publish all gerbil packages and their dependencies to cachix"
getopt: [(option 'nixpkgs-file "-f" "--file" help: "path or url for nixpkgs")])
(clan/base#!>
(run-process ["nix" "path-info"
(when/list nixpkgs-file ["--file" nixpkgs-file])...
"-r" "gerbil-unstable" "gerbilPackages-unstable"])
(cut string-split <> #\newline)
(cut cons* "cachix" "push" "mukn" <>)
(cut run-process/batch <>)
void))
#;(dump-stack-trace? #t) ;; Only in v0.19