Skip to content

Commit 602f2bc

Browse files
authored
Merge pull request xapi-project#421 from kc284/master
Ported the build from oasis to jbuilder.
2 parents 7d9e310 + aa2a6eb commit 602f2bc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+622
-731
lines changed

.coverage.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
set -ex
4+
5+
COVERAGE_DIR=.coverage
6+
rm -rf $COVERAGE_DIR
7+
mkdir -p $COVERAGE_DIR
8+
pushd $COVERAGE_DIR
9+
if [ -z "$KEEP" ]; then trap "popd; rm -rf $COVERAGE_DIR" EXIT; fi
10+
11+
$(which cp) -r ../* .
12+
13+
opam pin add bisect_ppx 1.3.0 -y
14+
opam install ocveralls -y
15+
16+
export BISECT_ENABLE=YES
17+
jbuilder runtest
18+
19+
outs=$(find . | grep bisect.*.out)
20+
bisect-ppx-report -I $(dirname $outs[1]) -text report $outs
21+
bisect-ppx-report -I $(dirname $outs[1]) -summary-only -text summary $outs
22+
if [ -n "$HTML" ]; then bisect-ppx-report -I $(dirname $outs[1]) -html ../html-report $outs; fi
23+
24+
if [ -n "$TRAVIS" ]; then
25+
echo "\$TRAVIS set; running ocveralls and sending to coveralls.io..."
26+
ocveralls --prefix _build/default $outs --send
27+
else
28+
echo "\$TRAVIS not set; displaying results of bisect-report..."
29+
cat report
30+
cat summary
31+
fi

.gitignore

Lines changed: 8 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,13 @@
1-
lib/version.ml
2-
config.ml
3-
xenopsd-xenlight
4-
xenopsd-libvirt
5-
xenopsd-simulator
6-
xenopsd-qemu
7-
xenopsd-xc
8-
*.1
9-
.pc
10-
*~
11-
*\#*
1+
_build
2+
*.install
3+
.merlin
4+
125
*.orig
136
*.rej
14-
*.a
15-
*.annot
16-
*.aux
17-
*.class
18-
*.cma
19-
*.cmi
20-
*.cmo
21-
*.cmx
22-
*.cmxa
23-
*.d
24-
*.dvi
25-
*.flc
26-
*.log
27-
*.o
28-
*.omc
29-
*.opic
30-
*.opt
31-
*.run
32-
*.pyc
33-
*.omakedb
34-
*.omakedb.lock
35-
*.db
36-
*.exe
37-
*.exe.mdb
38-
.*.swp
39-
*.dat
40-
*.gp
41-
*.spot
42-
*.spit
43-
*.cmt
44-
*.cmti
45-
*.so
46-
*.native
47-
config.mk
48-
dist
49-
_build
50-
setup.bin
51-
setup.data
52-
setup.ml
7+
538
scripts/vif
549
scripts/xen-backend.rules
5510
scripts/xen-backend-xl.rules
56-
_oasis
57-
coverage/
11+
config.mk
12+
config.ml
13+
xentoollog_flags

.merlin

Lines changed: 0 additions & 15 deletions
This file was deleted.

COVERAGE.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Coverage Analysis
32

43
This project can be compiled for coverage analysis using [bisect_ppx]. By
@@ -7,7 +6,7 @@ default, this is not done. To compile for coverage analysis, do:
76
./configure --enable-coverage
87
make
98

10-
This sets the `BISECT_COVERAGE` make and environment variable, which adds a dependency
9+
This sets the `BISECT_ENABLE` make and environment variable, which adds a dependency
1110
on `bisect_ppx` at `make setup.ml` time.
1211
This ensures that a proper dependency gets added to the META file, so that other
1312
projects can successfully link `xenopsd` even if they are themselves not built
@@ -44,8 +43,4 @@ top-level directory:
4443

4544
This creates an HTML document in [coverage/](./coverage].
4645

47-
[bisect_ppx]: https://github.com/aantron/bisect_ppx
48-
49-
50-
51-
46+
[bisect_ppx]: https://github.com/aantron/bisect_ppx

Makefile

Lines changed: 30 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,40 @@
1-
.PHONY: all clean install build test libinstall reinstall uninstall distclean reindent
2-
all: build
1+
include config.mk
32

4-
NAME=xenopsd
5-
J=4
3+
OPAM_PREFIX=$(DESTDIR)$(shell opam config var prefix)
4+
OPAM_LIBDIR=$(DESTDIR)$(shell opam config var lib)
65

7-
ENABLE_TESTS=--enable-tests
8-
COVERAGE=coverage
6+
.PHONY: build clean release test reindent install uninstall
97

10-
clean:
11-
@rm -f setup.data setup.log setup.bin setup.ml _oasis lib/version.ml
12-
@rm -rf _build
13-
@rm -f xenopsd-xc xenopsd-xenlight xenopsd-simulator xenopsd-libvirt
14-
@rm -f xenopsd-xc.1 xenopsd-xenlight.1 xenopsd-simulator.1 xenopsd-libvirt.1
15-
@rm -f *.native
16-
@rm -f /tmp/bisect-xenops*.out || true
17-
@rm -rf $(COVERAGE)
18-
19-
-include config.mk
20-
21-
config.mk:
22-
echo Please re-run configure
23-
exit 1
24-
25-
setup.bin: setup.ml
26-
@ocamlfind ocamlopt -o $@ -linkpkg -package oasis.dynrun setup.ml || ocamlfind ocamlc -o $@ -linkpkg -package oasis.dynrun setup.ml
27-
@rm -f setup.cmi setup.cmo setup.cmx setup.o
28-
29-
setup.data: setup.bin
30-
@./setup.bin -configure $(ENABLE_TESTS) $(ENABLE_XEN) $(ENABLE_XENLIGHT) $(ENABLE_XENGUESTBIN) $(ENABLE_XENTOOLLOG)
8+
build:
9+
jbuilder build @install --dev
3110

32-
setup.ml: _oasis.in
33-
ifeq ($(BISECT_COVERAGE),YES)
34-
rm -f _oasis
35-
sed -e 's/BuildDepends:/BuildDepends: bisect_ppx,/' _oasis.in >_oasis
36-
else
37-
ln -sf _oasis.in _oasis
38-
endif
39-
oasis setup -setup-update dynamic
40-
41-
_build/config.ml: config.ml
42-
@mkdir -p _build
43-
@cp config.ml _build/
11+
clean:
12+
jbuilder clean
4413

45-
build: setup.data setup.bin version.ml _build/config.ml
46-
@./setup.bin -build -j $(J)
47-
ifeq ($(ENABLE_XENLIGHT),--enable-xenlight)
48-
ln -sf ./xenops_xl_main.native xenopsd-xenlight
49-
./xenopsd-xenlight --help=groff > xenopsd-xenlight.1
50-
endif
51-
ln -sf ./xenops_simulator_main.native xenopsd-simulator
52-
./xenopsd-simulator --help=groff > xenopsd-simulator.1
53-
ln -sf ./xenops_xc_main.native xenopsd-xc
54-
./xenopsd-xc --help=groff > xenopsd-xc.1
14+
release:
15+
jbuilder build @install
5516

56-
test: build
57-
@./setup.bin -test
17+
test:
18+
jbuilder runtest --no-buffer
5819

59-
version.ml: VERSION
60-
echo "let version = \"$(shell cat VERSION)\"" > lib/version.ml
20+
reindent:
21+
git ls-files '*.ml*' '**/*.ml*' | xargs ocp-indent --syntax cstruct -i
6122

62-
libinstall: build
63-
@./setup.bin -install
23+
#requires odoc
24+
doc:
25+
jbuilder build @doc
6426

65-
install: libinstall
27+
install:
28+
jbuilder install --prefix=$(OPAM_PREFIX) --libdir=$(OPAM_LIBDIR) xapi-xenopsd
6629
ifeq ($(ENABLE_XENLIGHT),--enable-xenlight)
67-
install -D ./xenops_xl_main.native $(DESTDIR)/$(SBINDIR)/xenopsd-xenlight
68-
install -D ./xenopsd-xenlight.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-xenlight.1
30+
install -D _build/install/default/bin/xenopsd-xenlight $(DESTDIR)/$(SBINDIR)/xenopsd-xenlight
31+
install -D _build/install/default/man/man1/xenopsd-xenlight.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-xenlight.1
6932
endif
70-
install -D ./xenops_simulator_main.native $(DESTDIR)/$(SBINDIR)/xenopsd-simulator
71-
install -D ./xenopsd-simulator.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-simulator.1
72-
install -D ./xenops_xc_main.native $(DESTDIR)/$(SBINDIR)/xenopsd-xc
73-
install -D ./xenopsd-xc.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-xc.1
33+
install -D _build/install/default/bin/xenopsd-simulator $(DESTDIR)/$(SBINDIR)/xenopsd-simulator
34+
install -D _build/install/default/man/man1/xenopsd-simulator.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-simulator.1
35+
install -D _build/install/default/bin/xenopsd-xc $(DESTDIR)/$(SBINDIR)/xenopsd-xc
36+
install -D _build/install/default/man/man1/xenopsd-xc.1 $(DESTDIR)/$(MANDIR)/man1/xenopsd-xc.1
37+
install -D _build/install/default/bin/set-domain-uuid $(DESTDIR)/$(LIBEXECDIR)/set-domain-uuid
7438
install -D ./scripts/vif $(DESTDIR)/$(LIBEXECDIR)/vif
7539
install -D ./scripts/vif-real $(DESTDIR)/$(LIBEXECDIR)/vif-real
7640
install -D ./scripts/block $(DESTDIR)/$(LIBEXECDIR)/block
@@ -82,20 +46,17 @@ endif
8246
install -D ./scripts/setup-pvs-proxy-rules $(DESTDIR)/$(LIBEXECDIR)/setup-pvs-proxy-rules
8347
install -D ./scripts/common.py $(DESTDIR)/$(LIBEXECDIR)/common.py
8448
install -D ./scripts/igmp_query_injector.py $(DESTDIR)/$(LIBEXECDIR)/igmp_query_injector.py
85-
install -D ./set_domain_uuid.native $(DESTDIR)/$(LIBEXECDIR)/set-domain-uuid
8649
DESTDIR=$(DESTDIR) SBINDIR=$(SBINDIR) LIBEXECDIR=$(LIBEXECDIR) ETCDIR=$(ETCDIR) ./scripts/make-custom-xenopsd.conf
8750

88-
reinstall: install
89-
@ocamlfind remove $(NAME) || true
90-
9151
uninstall:
92-
@ocamlfind remove $(NAME) || true
52+
jbuilder uninstall --prefix=$(OPAM_PREFIX) --libdir=$(OPAM_LIBDIR) xapi-xenopsd
9353
rm -f $(DESTDIR)/$(SBINDIR)/xenopsd-xenlight
9454
rm -f $(DESTDIR)/$(SBINDIR)/xenopsd-xc
9555
rm -f $(DESTDIR)/$(SBINDIR)/xenopsd-simulator
9656
rm -f $(DESTDIR)/$(MANDIR)/man1/xenopsd-xenlight.1
9757
rm -f $(DESTDIR)/$(MANDIR)/man1/xenopsd-xc.1
98-
rm -f $(DESTDIR)/$(MANDIR)/man1/xenopsd-simluator.1
58+
rm -f $(DESTDIR)/$(MANDIR)/man1/xenopsd-simulator.1
59+
rm -f $(DESTDIR)/$(LIBEXECDIR)/set-domain-uuid
9960
rm -f $(DESTDIR)/$(ETCDIR)/xenopsd.conf
10061
rm -f $(DESTDIR)/$(LIBEXECDIR)/vif
10162
rm -f $(DESTDIR)/$(LIBEXECDIR)/vif-real
@@ -109,19 +70,4 @@ uninstall:
10970
rm -f $(DESTDIR)/$(LIBEXECDIR)/common.py*
11071
rm -f $(DESTDIR)/$(LIBEXECDIR)/igmp_query_injector.py*
11172

112-
.PHONY: release
113-
release:
114-
# remove -warn-error
115-
grep -v 'warn-error' _oasis > _oasis.tmp
116-
mv _oasis.tmp _oasis
117-
oasis setup
118-
119-
# make report - create coverage/index.html
120-
121-
report:
122-
bisect-ppx-report -I _build -html $(COVERAGE) /tmp/bisect-xenops*out
123-
124-
.PHONY: report
125-
126-
reindent:
127-
git ls-files '*.ml' '*.mli' | xargs ocp-indent --syntax cstruct -i
73+
.DEFAULT_GOAL := release

0 commit comments

Comments
 (0)