Skip to content

Commit 14a3d24

Browse files
author
Vincent Bernardoff
committed
Use oasis' Makefile, added test tuntap dependant on a configure flag
1 parent b8224d1 commit 14a3d24

File tree

6 files changed

+229
-36
lines changed

6 files changed

+229
-36
lines changed

Makefile

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
1-
.PHONY: all clean install build
2-
all: build doc
1+
# OASIS_START
2+
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
33

4-
NAME=fd-send-recv
5-
J=4
4+
SETUP = ocaml setup.ml
65

7-
export OCAMLRUNPARAM=b
6+
build: setup.data
7+
$(SETUP) -build $(BUILDFLAGS)
88

9-
setup.bin: setup.ml
10-
@ocamlopt.opt -o $@ $< || ocamlopt -o $@ $< || ocamlc -o $@ $<
11-
@rm -f setup.cmx setup.cmi setup.o setup.cmo
9+
doc: setup.data build
10+
$(SETUP) -doc $(DOCFLAGS)
1211

13-
setup.data: setup.bin
14-
@./setup.bin -configure
12+
test: setup.data build
13+
$(SETUP) -test $(TESTFLAGS)
1514

16-
build: setup.data setup.bin
17-
@./setup.bin -build -j $(J)
15+
all:
16+
$(SETUP) -all $(ALLFLAGS)
1817

19-
doc: setup.data setup.bin
20-
@./setup.bin -doc -j $(J)
18+
install: setup.data
19+
$(SETUP) -install $(INSTALLFLAGS)
2120

22-
install: setup.bin
23-
@./setup.bin -install
21+
uninstall: setup.data
22+
$(SETUP) -uninstall $(UNINSTALLFLAGS)
2423

25-
test: setup.bin build
26-
@./setup.bin -test
24+
reinstall: setup.data
25+
$(SETUP) -reinstall $(REINSTALLFLAGS)
2726

28-
reinstall: setup.bin
29-
@ocamlfind remove $(NAME) || true
30-
@./setup.bin -reinstall
27+
clean:
28+
$(SETUP) -clean $(CLEANFLAGS)
3129

32-
clean:
33-
@ocamlbuild -clean
34-
@rm -f setup.data setup.log setup.bin
30+
distclean:
31+
$(SETUP) -distclean $(DISTCLEANFLAGS)
32+
33+
setup.data:
34+
$(SETUP) -configure $(CONFIGUREFLAGS)
35+
36+
.PHONY: build doc test all install uninstall reinstall clean distclean configure
37+
38+
# OASIS_STOP

_oasis

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
1-
OASISFormat: 0.2
1+
OASISFormat: 0.3
22
Name: fd-send-recv
33
Version: 0.1
44
Synopsis: Bindings to sendmsg/recvmsg which allow fds to be sent/received
55
Authors: Jonathan Ludlam <[email protected]>
66
License: LGPL-2.1 with OCaml linking exception
7-
Plugins: META (0.2)
7+
Plugins: META (0.3), DevFiles (0.3)
88
BuildTools: ocamlbuild
99

10+
Flag tuntap
11+
Description: Enable the tuntap test (require package tuntap)
12+
Default: false
13+
1014
Library fd_send_recv
1115
CompiledObject: best
1216
Path: lib
@@ -29,16 +33,29 @@ Executable test
2933
BuildDepends: threads, fd-send-recv
3034
CompiledObject: best
3135

36+
3237
Executable test_fork
3338
Path: test
3439
MainIs: test_fork.ml
3540
BuildDepends: fd-send-recv
3641
CompiledObject: best
3742

43+
Executable test_tuntap
44+
Build$: flag(tuntap)
45+
Install$: flag(tuntap)
46+
Path: test
47+
MainIs: test_tuntap.ml
48+
BuildDepends: fd-send-recv, tuntap
49+
CompiledObject: best
50+
3851
Test test
3952
Command: ./test.native
4053
Run: true
4154

4255
Test test_fork
4356
Command: ./test_fork.native
4457
Run: true
58+
59+
Test test_tuntap
60+
Command: ./test_tuntap.native
61+
Run: true

_tags

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# OASIS_START
2-
# DO NOT EDIT (digest: 137da791be3f21034254fec37be76734)
2+
# DO NOT EDIT (digest: 7d2c24e0ffcc78f7d52b748e72137b2e)
33
# Ignore VCS directories, you can use the same kind of rule outside
44
# OASIS_START/STOP if you want to exclude directories that contains
55
# useless stuff for the build process
@@ -26,7 +26,12 @@
2626
# Executable test_fork
2727
<test/test_fork.{native,byte}>: use_fd_send_recv
2828
<test/test_fork.{native,byte}>: pkg_unix
29+
# Executable test_tuntap
30+
<test/test_tuntap.{native,byte}>: use_fd_send_recv
31+
<test/test_tuntap.{native,byte}>: pkg_tuntap
32+
<test/test_tuntap.{native,byte}>: pkg_unix
2933
<test/*.ml{,i}>: use_fd_send_recv
34+
<test/*.ml{,i}>: pkg_tuntap
3035
<test/*.ml{,i}>: pkg_unix
3136
# OASIS_STOP
3237
<lib>: include

configure

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/bin/sh
2+
3+
# OASIS_START
4+
# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
5+
set -e
6+
7+
FST=true
8+
for i in "$@"; do
9+
if $FST; then
10+
set --
11+
FST=false
12+
fi
13+
14+
case $i in
15+
--*=*)
16+
ARG=${i%%=*}
17+
VAL=${i##*=}
18+
set -- "$@" "$ARG" "$VAL"
19+
;;
20+
*)
21+
set -- "$@" "$i"
22+
;;
23+
esac
24+
done
25+
26+
ocaml setup.ml -configure "$@"
27+
# OASIS_STOP

setup.ml

Lines changed: 116 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(* setup.ml generated for the first time by OASIS v0.3.1 *)
22

33
(* OASIS_START *)
4-
(* DO NOT EDIT (digest: 191706ac62aaead93b537f0b6b72194e) *)
4+
(* DO NOT EDIT (digest: 0ee01babea67a544f01f0f92ee08aa60) *)
55
(*
66
Regenerated by OASIS v0.3.0
77
Visit http://oasis.forge.ocamlcore.org for more information and
@@ -5715,6 +5715,14 @@ let setup_t =
57155715
[(OASISExpr.EBool true, ("./test_fork.native", []))];
57165716
cmd_clean = [(OASISExpr.EBool true, None)];
57175717
cmd_distclean = [(OASISExpr.EBool true, None)];
5718+
});
5719+
("test_tuntap",
5720+
CustomPlugin.Test.main
5721+
{
5722+
CustomPlugin.cmd_main =
5723+
[(OASISExpr.EBool true, ("./test_tuntap.native", []))];
5724+
cmd_clean = [(OASISExpr.EBool true, None)];
5725+
cmd_distclean = [(OASISExpr.EBool true, None)];
57185726
})
57195727
];
57205728
doc = [("api", OCamlbuildDocPlugin.doc_build "doc")];
@@ -5738,6 +5746,14 @@ let setup_t =
57385746
[(OASISExpr.EBool true, ("./test_fork.native", []))];
57395747
cmd_clean = [(OASISExpr.EBool true, None)];
57405748
cmd_distclean = [(OASISExpr.EBool true, None)];
5749+
});
5750+
("test_tuntap",
5751+
CustomPlugin.Test.clean
5752+
{
5753+
CustomPlugin.cmd_main =
5754+
[(OASISExpr.EBool true, ("./test_tuntap.native", []))];
5755+
cmd_clean = [(OASISExpr.EBool true, None)];
5756+
cmd_distclean = [(OASISExpr.EBool true, None)];
57415757
})
57425758
];
57435759
clean_doc = [("api", OCamlbuildDocPlugin.doc_clean "doc")];
@@ -5759,12 +5775,20 @@ let setup_t =
57595775
[(OASISExpr.EBool true, ("./test_fork.native", []))];
57605776
cmd_clean = [(OASISExpr.EBool true, None)];
57615777
cmd_distclean = [(OASISExpr.EBool true, None)];
5778+
});
5779+
("test_tuntap",
5780+
CustomPlugin.Test.distclean
5781+
{
5782+
CustomPlugin.cmd_main =
5783+
[(OASISExpr.EBool true, ("./test_tuntap.native", []))];
5784+
cmd_clean = [(OASISExpr.EBool true, None)];
5785+
cmd_distclean = [(OASISExpr.EBool true, None)];
57625786
})
57635787
];
57645788
distclean_doc = [];
57655789
package =
57665790
{
5767-
oasis_version = "0.2";
5791+
oasis_version = "0.3";
57685792
ocaml_version = None;
57695793
findlib_version = None;
57705794
name = "fd-send-recv";
@@ -5822,6 +5846,18 @@ let setup_t =
58225846
files_ab = [];
58235847
sections =
58245848
[
5849+
Flag
5850+
({
5851+
cs_name = "tuntap";
5852+
cs_data = PropList.Data.create ();
5853+
cs_plugin_data = [];
5854+
},
5855+
{
5856+
flag_description =
5857+
Some
5858+
"Enable the tuntap test (require package tuntap)";
5859+
flag_default = [(OASISExpr.EBool true, false)];
5860+
});
58255861
Library
58265862
({
58275863
cs_name = "fd_send_recv";
@@ -5865,7 +5901,11 @@ let setup_t =
58655901
pre_command = [(OASISExpr.EBool true, None)];
58665902
post_command = [(OASISExpr.EBool true, None)];
58675903
};
5868-
doc_build = [(OASISExpr.EBool true, true)];
5904+
doc_build =
5905+
[
5906+
(OASISExpr.ENot (OASISExpr.EFlag "docs"), false);
5907+
(OASISExpr.EFlag "docs", true)
5908+
];
58695909
doc_install = [(OASISExpr.EBool true, false)];
58705910
doc_install_dir = "$docdir";
58715911
doc_title = "Documentation and API reference";
@@ -5926,6 +5966,41 @@ let setup_t =
59265966
bs_nativeopt = [(OASISExpr.EBool true, [])];
59275967
},
59285968
{exec_custom = false; exec_main_is = "test_fork.ml"; });
5969+
Executable
5970+
({
5971+
cs_name = "test_tuntap";
5972+
cs_data = PropList.Data.create ();
5973+
cs_plugin_data = [];
5974+
},
5975+
{
5976+
bs_build =
5977+
[
5978+
(OASISExpr.EBool true, false);
5979+
(OASISExpr.EFlag "tuntap", true)
5980+
];
5981+
bs_install =
5982+
[
5983+
(OASISExpr.EBool true, false);
5984+
(OASISExpr.EFlag "tuntap", true)
5985+
];
5986+
bs_path = "test";
5987+
bs_compiled_object = Best;
5988+
bs_build_depends =
5989+
[
5990+
InternalLibrary "fd_send_recv";
5991+
FindlibPackage ("tuntap", None)
5992+
];
5993+
bs_build_tools = [ExternalTool "ocamlbuild"];
5994+
bs_c_sources = [];
5995+
bs_data_files = [];
5996+
bs_ccopt = [(OASISExpr.EBool true, [])];
5997+
bs_cclib = [(OASISExpr.EBool true, [])];
5998+
bs_dlllib = [(OASISExpr.EBool true, [])];
5999+
bs_dllpath = [(OASISExpr.EBool true, [])];
6000+
bs_byteopt = [(OASISExpr.EBool true, [])];
6001+
bs_nativeopt = [(OASISExpr.EBool true, [])];
6002+
},
6003+
{exec_custom = false; exec_main_is = "test_tuntap.ml"; });
59296004
Test
59306005
({
59316006
cs_name = "test";
@@ -5942,7 +6017,11 @@ let setup_t =
59426017
post_command = [(OASISExpr.EBool true, None)];
59436018
};
59446019
test_working_directory = None;
5945-
test_run = [(OASISExpr.EBool true, true)];
6020+
test_run =
6021+
[
6022+
(OASISExpr.ENot (OASISExpr.EFlag "tests"), false);
6023+
(OASISExpr.EFlag "tests", true)
6024+
];
59466025
test_tools = [ExternalTool "ocamlbuild"];
59476026
});
59486027
Test
@@ -5961,25 +6040,53 @@ let setup_t =
59616040
post_command = [(OASISExpr.EBool true, None)];
59626041
};
59636042
test_working_directory = None;
5964-
test_run = [(OASISExpr.EBool true, true)];
6043+
test_run =
6044+
[
6045+
(OASISExpr.ENot (OASISExpr.EFlag "tests"), false);
6046+
(OASISExpr.EFlag "tests", true)
6047+
];
6048+
test_tools = [ExternalTool "ocamlbuild"];
6049+
});
6050+
Test
6051+
({
6052+
cs_name = "test_tuntap";
6053+
cs_data = PropList.Data.create ();
6054+
cs_plugin_data = [];
6055+
},
6056+
{
6057+
test_type = (`Test, "custom", Some "0.3");
6058+
test_command =
6059+
[(OASISExpr.EBool true, ("./test_tuntap.native", []))
6060+
];
6061+
test_custom =
6062+
{
6063+
pre_command = [(OASISExpr.EBool true, None)];
6064+
post_command = [(OASISExpr.EBool true, None)];
6065+
};
6066+
test_working_directory = None;
6067+
test_run =
6068+
[
6069+
(OASISExpr.ENot (OASISExpr.EFlag "tests"), false);
6070+
(OASISExpr.EFlag "tests", true)
6071+
];
59656072
test_tools = [ExternalTool "ocamlbuild"];
59666073
})
59676074
];
5968-
plugins = [(`Extra, "META", Some "0.2")];
6075+
plugins =
6076+
[(`Extra, "META", Some "0.3"); (`Extra, "DevFiles", Some "0.3")];
59696077
schema_data = PropList.Data.create ();
59706078
plugin_data = [];
59716079
};
59726080
oasis_fn = Some "_oasis";
59736081
oasis_version = "0.3.0";
5974-
oasis_digest =
5975-
Some "\004;\028u\162\132\202\213P\196\155\022\189\007C\006";
6082+
oasis_digest = Some "\134^\152\180\168\209\237\224QO\217\139u\024\024v";
59766083
oasis_exec = None;
59776084
oasis_setup_args = [];
59786085
setup_update = false;
59796086
};;
59806087

59816088
let setup () = BaseSetup.setup setup_t;;
59826089

5983-
# 5984 "setup.ml"
6090+
# 6091 "setup.ml"
59846091
(* OASIS_STOP *)
59856092
let () = setup ();;

0 commit comments

Comments
 (0)