-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathbuild.ncl
More file actions
78 lines (73 loc) · 2.66 KB
/
Copy pathbuild.ncl
File metadata and controls
78 lines (73 loc) · 2.66 KB
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
let { Attrs, BuildSpec, Local, OutputBin, OutputData, Source, Test, .. } = import "minimal.ncl" in
let base = import "../base/build.ncl" in
let ocaml = import "../ocaml/build.ncl" in
let toolchain = import "../toolchain/build.ncl" in
let make = import "../make/build.ncl" in
let coreutils = import "../coreutils/build.ncl" in
let grep = import "../grep/build.ncl" in
let version = "3.24.1" in
{
name = "dune",
build_deps = [
{ file = "build.sh" } | Local,
{
# https://github.com/ocaml/dune/releases/download/3.24.1/dune-3.24.1.tbz
url = "gs://minimal-staging-archives/dune-%{version}.tbz",
sha256 = "0a8eaa62dfcb945802bcaf9a6f2026ca5228333ee391a1bdedd3e70a3f26ea2c",
# minimal's extractor doesn't know `.tbz`; unpack it in build.sh (tar -xf
# autodetects bzip2), mirroring how ghc handles its source archive.
extract = false,
} | Source,
base,
ocaml,
make,
toolchain,
],
# dune self-bootstraps from its own boot/ image using ocaml — fully offline.
runtime_deps = [
ocaml,
],
cmd = "./build.sh",
build_args = {
include version,
},
outputs = {
bin = { glob = "usr/bin/dune" } | OutputBin,
# dune + dune-configurator findlib trees (META/.cmxa/.cmi). dune-configurator
# is REQUIRED for the Jane Street stack's build-time `discover` executables —
# `ocaml boot/bootstrap.ml` produces only the binary, so we build+install it
# explicitly (see build.sh).
libs = { glob = "usr/lib/ocaml/**", allow_executable = true } | OutputData,
},
attrs =
{
upstream_version = version,
license_spdx = "MIT",
source_provenance = {
category = 'GithubRepo,
owner = "ocaml",
repo = "dune",
},
build_cost_multiple = 2,
} | Attrs,
tests = {
version_check =
{
class = 'Standalone,
test_deps = [base, grep, coreutils],
cmds = [
["/bin/bash", "-c", "/usr/bin/dune --version | grep -q '%{version}'"],
],
} | Test,
# The real proof dune works as a build tool: scaffold a tiny dune project,
# build it (resolving the compiler via OCAMLPATH), and run the output.
builds_a_project =
{
class = 'Standalone,
test_deps = [base, ocaml, toolchain, grep, coreutils],
cmds = [
["/bin/bash", "-c", "mkdir -p proj && cd proj && printf '(lang dune 3.0)\\n' > dune-project && printf '(executable (name main))\\n' > dune && printf 'let () = print_string \"ok\"\\n' > main.ml && OCAMLPATH=/usr/lib/ocaml CAML_LD_LIBRARY_PATH=/usr/lib/ocaml/stublibs /usr/bin/dune build ./main.exe && ./_build/default/main.exe | grep -q ok"],
],
} | Test,
},
} | BuildSpec