Skip to content

Commit

Permalink
Merge pull request #274 from djs55/simplify-build
Browse files Browse the repository at this point in the history
Simplify the opam build
  • Loading branch information
djs55 authored Aug 17, 2017
2 parents c0081b8 + 3d940a8 commit 60019d8
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 26 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
### v0.1.1 (2017-08-17)

* simplify the build by watermarking with `jbuilder subst`
* fix the build of the released package archive

### v0.1.0 (2017-08-17)

* use Mirage 3 interfaces
Expand Down
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@ uninstall:

artefacts: $(ARTEFACTS)

src/bin/depends.ml: src/bin/depends.ml.in
$(OPAMFLAGS) opam config subst src/bin/depends.ml || true
cp src/bin/depends.ml src/bin/depends.tmp
sed -e 's/££VERSION££/$(shell git rev-parse HEAD)/g' src/bin/depends.tmp > src/bin/depends.ml
cp src/bin/depends.ml src/bin/depends.tmp
sed -e 's/££HVSOCK_PINNED££/$(shell opam info hvsock -f pinned)/g' src/bin/depends.tmp > src/bin/depends.ml

vpnkit.tgz: vpnkit.exe
mkdir -p _build/root/Contents/MacOS
cp vpnkit.exe _build/root/Contents/MacOS/vpnkit
Expand All @@ -42,7 +35,7 @@ vpnkit.tgz: vpnkit.exe
tar -C _build/root -cvzf vpnkit.tgz Contents

.PHONY: vpnkit.exe
vpnkit.exe: src/bin/depends.ml
vpnkit.exe:
jbuilder build --dev src/bin/main.exe
cp _build/default/src/bin/main.exe vpnkit.exe

Expand All @@ -68,7 +61,6 @@ clean:
rm -rf _build
rm -f vpnkit.exe
rm -f vpnkit.tgz
rm -f src/bin/depends.ml

REPO=../../mirage/opam-repository
PACKAGES=$(REPO)/packages
Expand Down
4 changes: 0 additions & 4 deletions src/bin/depends.ml.in

This file was deleted.

5 changes: 5 additions & 0 deletions src/bin/jbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
mirage-clock-unix mirage-random
))
(preprocess no_preprocessing)))

(install
((section bin)
(package vpnkit)
(files ((main.exe as vpnkit)))))
10 changes: 4 additions & 6 deletions src/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,9 @@ let hvsock_addr_of_uri ~default_serviceid uri =
(try Sys.set_signal Sys.sigpipe Sys.Signal_ignore
with Invalid_argument _ -> ());
Log.info (fun f ->
f "vpnkit version %s with uwt version %s hvsock version %s %s"
Depends.version
Depends.uwt_version
Depends.hvsock_version Depends.hvsock_pinned
);
f "vpnkit version %%VERSION%% from %%VCS_COMMIT_ID%%"
);

Log.info (fun f -> f "System SOMAXCONN is %d" !Utils.somaxconn);
Utils.somaxconn :=
(match listen_backlog with None -> !Utils.somaxconn | Some x -> x);
Expand Down Expand Up @@ -521,7 +519,7 @@ let command =
$ socket $ port_control_path $ introspection_path $ diagnostics_path
$ max_connections $ vsock_path $ db_path $ db_branch $ dns $ hosts
$ host_names $ listen_backlog $ port_max_idle_time $ debug),
Term.info (Filename.basename Sys.argv.(0)) ~version:Depends.version ~doc ~man
Term.info (Filename.basename Sys.argv.(0)) ~version:"%%VERSION%%" ~doc ~man

let () =
Printexc.record_backtrace true;
Expand Down
10 changes: 3 additions & 7 deletions vpnkit.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ dev-repo: "https://github.com/moby/vpnkit.git"
doc: "https://moby.github.io/vpnkit/"

build: [
[make]
["jbuilder" "subst"] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
]
build-test: [
[make "test"]
]
install: [make "install" "BINDIR=%{bin}%"]
remove: [make "uninstall" "BINDIR=%{bin}%"]

depends: [
"jbuilder" {build}
"jbuilder" {build & >="1.0+beta10"}
"alcotest" {test}
"result"
"tar" {>= "0.8.0"}
Expand Down

0 comments on commit 60019d8

Please sign in to comment.