-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile.mirage
68 lines (55 loc) · 1.95 KB
/
Makefile.mirage
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
# Makefile for mirage based package build
#
# For "API" documentation check Makefile.generic
#
# Variables used as "parameters":
# DIST
# SRC_DIR
# COMPONENT
### Load component-specific settings
# Component specific settings. Generic variables:
# SOURCE_PREP - make target to run at "prep" stage
# SOURCE_BUILD_DEP - make target to run at "build-dep" stage
# SOURCE_COPY_IN - make target to run after "copy-in" stage
# SOURCE_COPY_OUT - make target to run after "copy-out" stage
# Above are mainly to extend Makefile with some component-specific actions
# (like handling additional sources)
PACKAGE_LIST = $(MIRAGE_KERNEL_NAME)
DIST_BUILD_DIR = /
OCAML_VERSION ?= system
# opam 1.2 expose only md5 checksum to fetch command
OPAMFETCH := $(MIRAGE_PLUGIN_DIR)/scripts/download-and-log %{url}% %{out}% md5 %{checksum}%
update-repo:
cp $(BUILDER_REPO_DIR)/$(TEMPLATE_FLAVOR).xen $(UPDATE_REPO)/
dist-prep:
@true
install-opam2:
curl https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh -o $(CACHEDIR)/opam-install.sh
sha256sum $(CACHEDIR)/opam-install.sh
yes '' | sh $(CACHEDIR)/opam-install.sh
dist-prepare-chroot: $(shell command -v opam >/dev/null || echo install-opam2)
sudo mount -o remount,nr_inodes=1m /tmp
opam init -y --bare
opam update -y
opam-switch-%:
exec 9>&2 && \
export OPAMFETCH_LOG_FD=9 && \
opam switch set $*-$(OCAML_VERSION) || \
opam switch create $*-$(OCAML_VERSION) ocaml-base-compiler.$(OCAML_VERSION)
dist-build-dep: $(SOURCE_BUILD_DEP)
dist-build-dep: opam-switch-$(COMPONENT)
exec 9>&2 && \
export OPAMFETCH_LOG_FD=9 && \
opam install -y mirage mirage-xen
dist-package:
cd $(CHROOT_DIR)/$(DIST_SRC) && \
eval "`opam config env`" && \
exec 9>&2 && \
export OPAMFETCH_LOG_FD=9 && \
mirage configure -t xen && \
make depends && \
make
dist-copy-out:
mkdir -p $(BUILDER_REPO_DIR)
cp $(CHROOT_DIR)/$(DIST_SRC)/$(MIRAGE_KERNEL_NAME) $(BUILDER_REPO_DIR)/$(COMPONENT).xen
-sha256sum $(BUILDER_REPO_DIR)/$(COMPONENT).xen