Port everything to dune

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-05-28 12:25:43 +07:00 committed by Frédéric Bour
parent 250fb96be1
commit 0e1085b920
36 changed files with 158 additions and 1577 deletions

19
.gitignore vendored
View File

@ -1,16 +1,3 @@
*.annot
*.cmo
*.cma
*.cmi
*.a
*.o
*.cmx
*.cmxs
*.cmxa
*.so
# OCamlMakefile
*/OCamlMakefile
._bcdi
._d
._ncdi
_build
.merlin
*.install

117
Makefile
View File

@ -1,117 +0,0 @@
SUB = hll jmphash pcg orderme doubledouble physh baltree trope binpacking valmari
SUB_TEST = hll orderme doubledouble trope binpacking valmari
all::
for i in $(SUB); do $(MAKE) -C $$i $@; done
doc::
mkdir -p doc
for i in $(SUB); do \
rm -rf doc/$$i; \
$(MAKE) -C $$i htdoc; \
mv $$i/doc/$$i doc/; \
mv doc/$$i/html doc/$$i/doc; \
rmdir $$i/doc; \
done
clean::
for i in $(SUB); do $(MAKE) -C $$i $@; done
for i in $(SUB); do rm -f $$i/OCamlMakefile; done
RESULT = grenier
LIBINSTALL_FILES = \
hll/hll.mli \
hll/hll.cmi \
hll/hll.cmx \
hll/hll_consts.cmi \
hll/hll_consts.cmx \
hll/hll.a \
hll/hll.cma \
hll/hll.cmxa \
jmphash/jmphash.mli \
jmphash/jmphash.cmi \
jmphash/jmphash.cmx \
jmphash/jmphash.a \
jmphash/jmphash.cma \
jmphash/jmphash.cmxa \
pcg/pcg.mli \
pcg/pcg.cmi \
pcg/pcg.cmx \
pcg/pcg.a \
pcg/pcg.cma \
pcg/pcg.cmxa \
orderme/order_list.mli \
orderme/order_indir.mli \
orderme/order_managed.mli \
orderme/order_list.cmi \
orderme/order_list.cmx \
orderme/order_indir.cmi \
orderme/order_indir.cmx \
orderme/order_managed.cmi \
orderme/order_managed.cmx \
orderme/orderme.a \
orderme/orderme.cma \
orderme/orderme.cmxa \
doubledouble/doubledouble.mli \
doubledouble/doubledouble.cmi \
doubledouble/doubledouble.cmo \
doubledouble/doubledouble.cmx \
physh/physh.mli \
physh/physh.cmi \
physh/physh.cmx \
physh/physh.a \
physh/physh.cma \
physh/physh.cmxa \
physh/lib_physh_stubs.a \
physh/dll_physh_stubs.so \
baltree/bt1.mli \
baltree/bt1.cmi \
baltree/bt1.cmx \
baltree/bt2.mli \
baltree/bt2.cmi \
baltree/bt2.cmx \
baltree/mbt.mli \
baltree/mbt.cmi \
baltree/mbt.cmx \
baltree/baltree.a \
baltree/baltree.cma \
baltree/baltree.cmxa \
binpacking/maxrects.mli \
binpacking/maxrects.cmi \
binpacking/maxrects.cmx \
binpacking/binpacking.a \
binpacking/binpacking.cma \
binpacking/binpacking.cmxa \
trope/trope.mli \
trope/trope.cmi \
trope/trope.cmx \
trope/trope.a \
trope/trope.cma \
trope/trope.cmxa \
valmari/finite.mli \
valmari/finite.cmi \
valmari/partition.mli \
valmari/partition.cmi \
valmari/valmari.mli \
valmari/valmari.cmi \
valmari/valmari.a \
valmari/valmari.cma \
valmari/valmari.cmxa
-include OCamlMakefile
install: libinstall
uninstall: libuninstall
reinstall:
-$(MAKE) uninstall
$(MAKE) install
OCAMLFLAGS += -g
OCAMLLDFLAGS += -g
test:
for i in $(SUB_TEST); do $(MAKE) -C $$i test; done

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +0,0 @@
all: byte-code-library native-code-library
SOURCES = bt1.mli bt1.ml bt2.mli bt2.ml mbt.mli mbt.ml
RESULT = baltree
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)

View File

@ -25,7 +25,7 @@ let disbalanced smin smax = smaller_ell smin (smax lsr 1)
(** {1 Smart but not too much constructors} *)
(** Construct node and check balance *)
let node_ l x r =
let _node_ l x r =
let sl = size l and sr = size r in
if sl < sr then
assert (not (disbalanced sl sr))

View File

@ -25,7 +25,7 @@ let disbalanced smin smax = smaller_ell smin (smax lsr 1)
(** {1 Smart but not too much constructors} *)
(** Construct node and check balance *)
let node_ l x0 x1 r =
let _node_ l x0 x1 r =
let sl = size l and sr = size r in
if sl < sr then
assert (not (disbalanced sl sr))

5
baltree/jbuild Normal file
View File

@ -0,0 +1,5 @@
(library
((name grenier_baltree)
(public_name grenier.baltree)
(wrapped false)
(synopsis "Balanced trees")))

View File

@ -38,7 +38,7 @@ module Make(M : MEASURE) = struct
(** {1 Smart but not too much constructors} *)
(** Construct node and check balance *)
let node_ l x r =
let _node_ l x r =
let sl = size l and sr = size r in
if sl < sr then
assert (not (disbalanced sl sr))

View File

@ -1,10 +0,0 @@
all: byte-code-library native-code-library
SOURCES = maxrects.mli maxrects.ml
RESULT = binpacking
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)
test: all
ocaml test.ml

16
binpacking/jbuild Normal file
View File

@ -0,0 +1,16 @@
(library
((name grenier_binpacking)
(public_name grenier.binpacking)
(wrapped false)
(modules (:standard \ test))
(synopsis "Binpacking in 2d")))
(executable
((name test)
(modules (test))
(libraries (grenier_binpacking))))
(alias
((name runtest)
(deps (./test.exe))
(action (run ${<}))))

View File

@ -1,5 +1,3 @@
#load "binpacking.cma";;
let assertf b fmt =
if b then
(* Can be made more efficient with OCaml >= 4.03, but 4.02 has

View File

@ -1,12 +0,0 @@
all: byte-code-library native-code-library
SOURCES = doubledouble.mli doubledouble.ml
RESULT = doubledouble
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)
test: all
ocaml test_basic.ml
ocaml test_io.ml
ocaml test_compute.ml

37
doubledouble/jbuild Normal file
View File

@ -0,0 +1,37 @@
(library
((name grenier_doubledouble)
(public_name grenier.doubledouble)
(wrapped false)
(modules (doubledouble))
(synopsis
"High precision floating point arithmetic (around 106 bits)")))
(executable
((name test_basic)
(modules (test_basic))
(libraries (grenier_doubledouble))))
(alias
((name runtest)
(deps (./test_basic.exe))
(action (run ${<}))))
(executable
((name test_compute)
(modules (test_compute))
(libraries (grenier_doubledouble))))
(alias
((name runtest)
(deps (./test_compute.exe))
(action (run ${<}))))
(executable
((name test_io)
(modules (test_io))
(libraries (grenier_doubledouble))))
(alias
((name runtest)
(deps (./test_io.exe))
(action (run ${<}))))

View File

@ -1,4 +1,3 @@
#load "doubledouble.cma";;
(**
Copyright (c) 2013, Frédéric Bour <frederic.bour (at) lakaban.net>
All rights reserved.

View File

@ -1,4 +1,3 @@
#load "doubledouble.cma";;
(**
Copyright (c) 2013, Frédéric Bour <frederic.bour (at) lakaban.net>
All rights reserved.

View File

@ -1,4 +1,3 @@
#load "doubledouble.cma";;
(**
Copyright (c) 2013, Frédéric Bour <frederic.bour (at) lakaban.net>
All rights reserved.

View File

@ -1,17 +1,15 @@
opam-version: "1.2"
name: "grenier"
version: "0.6"
maintainer: "Frederic Bour <frederic.bour@lakaban.net>"
authors: "Frederic Bour <frederic.bour@lakaban.net>"
homepage: "https://github.com/let-def/grenier"
bug-reports: "https://github.com/let-def/grenier"
license: "ISC"
dev-repo: "https://github.com/let-def/grenier.git"
build: [make]
build-test: [make "test"]
install: [make "install"]
remove: ["ocamlfind" "remove" "grenier"]
build: [
["jbuilder" "subst" "-n" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
]
depends: [
"ocamlfind" {build}
"jbuilder" {build}
]
available: [ ocaml-version >= "4.02" ]

View File

@ -1,7 +0,0 @@
all: byte-code-library native-code-library
SOURCES = hll_consts.ml hll.mli hll.ml
RESULT = hll
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)

16
hll/jbuild Normal file
View File

@ -0,0 +1,16 @@
(library
((name grenier_hll)
(public_name grenier.hll)
(wrapped false)
(modules (:standard \ test))
(synopsis "HyperLogLog in OCaml")))
(executable
((name test)
(modules (test))
(libraries (grenier_hll))))
(alias
((name runtest)
(deps (test.exe))
(action (run ${<}))))

View File

@ -1,5 +1,3 @@
#load "hll.cma";;
let run_test error seed count =
let hll = Hll.make ~error in
Printf.printf "counting %d elements using HLL with %.02f%% error rate (seed = %Ld)\n"

View File

@ -1,7 +0,0 @@
all: byte-code-library native-code-library
SOURCES = jmphash.mli jmphash.ml
RESULT = jmphash
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)

5
jmphash/jbuild Normal file
View File

@ -0,0 +1,5 @@
(library
((name grenier_jmphash)
(public_name grenier.jmphash)
(wrapped false)
(synopsis "Jump Consistent Hashing in OCaml")))

View File

@ -1,18 +0,0 @@
all: byte-code-library native-code-library
SOURCES = order_list.mli order_list.ml \
order_indir.mli order_indir.ml \
order_managed.mli order_managed.ml
RESULT = orderme
test: all
ocamlopt -o test_order.native unix.cmxa -cclib -L. orderme.cmxa test_order.ml
./test_order.native 100
bench:
ocamlopt -o bench_order.native unix.cmxa -cclib -L. orderme.cmxa bench_order.ml
./bench_order.native 5_000_000
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)

View File

@ -5,7 +5,7 @@ let t () = (Unix.times()).Unix.tms_utime
let once name (module M : S) count =
let bench () =
let r = ref (M.root()) in
for i = 1 to count do
for _ = 1 to count do
r := M.after !r;
done
in

16
orderme/jbuild Normal file
View File

@ -0,0 +1,16 @@
(library
((name grenier_orderme)
(public_name grenier.orderme)
(wrapped false)
(modules (:standard \ test_order bench_order))
(synopsis "Solution to Order-Maintenance and List-labeling problems")))
(executable
((name test_order)
(modules (test_order))
(libraries (grenier_orderme unix))))
(alias
((name runtest)
(deps (test_order.exe))
(action (run ${<}))))

View File

@ -149,7 +149,7 @@ let after t =
let tag1 = t.tag in
let tag2 = if is_local_last t then max_int else t.next.tag in
let tag = average tag1 tag2 in
let {next; repr; order} = t in
let {next; repr; order; _} = t in
let t' = {repr; tag; order; prev = t; next} in
if is_global_last t then
t'.next <- t'
@ -166,7 +166,7 @@ let before t =
let tag1 = if is_local_first t then min_int else t.prev.tag in
let tag2 = t.tag in
let tag = average tag1 tag2 in
let {prev; repr; order} = t in
let {prev; repr; order; _} = t in
let t' = {repr; tag; order; prev; next = t} in
if is_global_first t then
t'.prev <- t'
@ -185,7 +185,7 @@ let forget t =
if is_local_first t && is_local_last t then
Order_list.forget t.repr;
(* Update linked list *)
let {next; prev} = t in
let {next; prev; _} = t in
if is_global_first t then
next.prev <- next
else

View File

@ -57,7 +57,7 @@ let root () =
let forget t =
if is_valid t then begin
let {prev; next; counter} = t in
let {prev; next; counter; _} = t in
if is_first t then
next.prev <- next
else if is_last t then
@ -163,7 +163,7 @@ let after t =
linked list (e.g if used through Order_managed).
*)
let t' = {prev = t; next = t; tag; counter = t.counter} in
let {next; counter} = t in
let {next; counter; _} = t in
if t == next then
t'.next <- t'
else (
@ -187,7 +187,7 @@ let before t =
linked list (e.g if used through Order_managed).
*)
let t' = {prev = t; next = t; tag; counter = t.counter} in
let {prev; counter} = t in
let {prev; counter; _} = t in
if t == prev then
t'.prev <- t'
else (

View File

@ -1,7 +0,0 @@
all: byte-code-library native-code-library
SOURCES = pcg.mli pcg.ml
RESULT = pcg
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)

5
pcg/jbuild Normal file
View File

@ -0,0 +1,5 @@
(library
((name grenier_pcg)
(public_name grenier.pcg)
(wrapped false)
(synopsis "PCG random generator in OCaml")))

View File

@ -1,33 +0,0 @@
all: physh.cma physh.cmxa
%.o: %.c
ocamlc -c -ccopt "-O2 -std=gnu99" $<
dll_physh_stubs.so lib_physh_stubs.a: ml_physh_set.o ml_physh_map.o
ocamlmklib \
-o _physh_stubs $^ \
-ccopt -O2 -ccopt -std=gnu99
physh.cmi: physh.mli
ocamlc -c $<
physh.cmo: physh.ml physh.cmi
ocamlc -c $<
physh.cma: physh.cmo dll_physh_stubs.so
ocamlc -a -custom -o $@ $< \
-dllib dll_physh_stubs.so \
-cclib -l_physh_stubs
physh.cmx: physh.ml physh.cmi
ocamlopt -c $<
physh.cmxa physh.a: physh.cmx dll_physh_stubs.so
ocamlopt -a -o $@ $< \
-cclib -l_physh_stubs \
-ccopt -O2 -ccopt -std=gnu99
.PHONY: clean
clean:
rm -f *.[oa] *.so *.cm[ixoa] *.cmxa

6
physh/jbuild Normal file
View File

@ -0,0 +1,6 @@
(library
((name physh)
(public_name grenier.physh)
(wrapped false)
(c_names (ml_physh_map ml_physh_set))
(synopsis "Physical hashtable and hashset")))

6
trope/jbuild Normal file
View File

@ -0,0 +1,6 @@
(library
((name grenier_trope)
(public_name grenier.trope)
(wrapped false)
(synopsis "Track positions accross rope(-like) operations")
(libraries (grenier.orderme grenier.baltree))))

View File

@ -405,7 +405,7 @@ let insert_after t c len =
in
fst (update t aux)
let put_before t c0 value =
let _put_before t c0 value =
validate t c0 "Trope.put_before: cursor not in buffer";
let aux t =
let c = O.before c0 in
@ -426,7 +426,7 @@ let put_before t c0 value =
in
update t aux
let put_after t c0 value =
let _put_after t c0 value =
validate t c0 "Trope.put_after: cursor not in buffer";
let aux t =
let c = O.after c0 in

View File

@ -1,18 +0,0 @@
all: byte-code-library native-code-library
SOURCES = finite.mli finite.ml partition.mli partition.ml valmari.mli valmari.ml
RESULT = valmari
OCAMLMAKEFILE=../OCamlMakefile
-include $(OCAMLMAKEFILE)
test.exe: all
ocamlopt -o $@ valmari.cmxa test/test.ml
test: test.exe
./test.exe test/Sample.dfa > test/Sample.output
./test.exe test/Lex.dfa > test/Lex.output
diff test/Sample.output test/Sample.reference
diff test/Lex.output test/Lex.reference
.PHONY: test

5
valmari/jbuild Normal file
View File

@ -0,0 +1,5 @@
(library
((name valmari)
(public_name grenier.valmari)
(wrapped false)
(synopsis "DFA minimization")))

21
valmari/test/jbuild Normal file
View File

@ -0,0 +1,21 @@
(executable
((name test)
(libraries (valmari))))
(rule
((deps (Lex.dfa))
(targets (Lex.expected))
(action (with-stdout-to ${@} (run ./test.exe ${<})))))
(rule
((deps (Sample.dfa))
(targets (Sample.expected))
(action (with-stdout-to ${@} (run ./test.exe ${<})))))
(alias
((name runtest)
(action (diff Lex.expected Lex.reference))))
(alias
((name runtest)
(action (diff Sample.expected Sample.reference))))