Skip to content

Commit

Permalink
Refactor dune rules
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Jun 24, 2022
1 parent 23d363f commit 65dd5cf
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 52 deletions.
8 changes: 4 additions & 4 deletions bin/dune
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(install
(section bin)
(files cilly cilly.native))
(files
cilly
cilly.native))

(rule
(deps ../src/main.exe)
(targets cilly.native)
(alias cilly)
(action (copy ../src/main.exe cilly.native)))

31 changes: 31 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
(rule
(alias configure)
(deps
configure.ac
configure
Makefile.in
config.sub
config.guess
config.h.in
config.mk.in
stamp-h.in
install-sh
lib/perl5/App/Cilly/CilConfig.pm.in
(source_tree src)) ; src/cil.mli doesn't work
(targets
Makefile
config.status
config.h
config.mk
stamp-h
; HACK: workaround for https://github.com/ocaml/dune/issues/3374
src__machdep-ml.c
src__cilversion.ml
lib__perl5__App__Cilly__CilConfig.pm)
(action (progn
(run ./configure)
; HACK: workaround for https://github.com/ocaml/dune/issues/3374
; HACK: use "run cp" instead of "copy" to avoid implicit unsupported subdir deps
(run cp src/machdep-ml.c src__machdep-ml.c)
(run cp src/cilversion.ml src__cilversion.ml)
(run cp lib/perl5/App/Cilly/CilConfig.pm lib__perl5__App__Cilly__CilConfig.pm))))
1 change: 0 additions & 1 deletion goblint-cil.opam
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ depends: [
]
conflicts: ["cil"]
build: [
["./configure"]
["dune" "subst"] {dev}
[
"dune"
Expand Down
2 changes: 2 additions & 0 deletions lib/perl5/App/Cilly/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
; HACK: workaround for https://github.com/ocaml/dune/issues/3374
(rule (action (copy ../../../../lib__perl5__App__Cilly__CilConfig.pm CilConfig.pm)))
19 changes: 16 additions & 3 deletions lib/perl5/App/dune
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
(rule
(deps
../../../configure.ac ../../../config.status ../../../configure ../../../Makefile ../../../Makefile.in ../../../install-sh ../../../config.sub ../../../config.guess ../../../config.h.in ../../../stamp-h.in ../../../src/cil.mli ../../../src/machdep-ml.c.in ../../../src/machdep-ml.c ../../../src/cilversion.ml.in ../../../aclocal.m4 ../../../config.h Cilly.pm.in ../../../config.mk.in)
(alias cilly)
(deps (alias ../../../configure) Cilly.pm.in)
(targets Cilly.pm)
(action (chdir ../../.. (progn (run mkdir -p _build) (run make lib/perl5/App/Cilly.pm)))))
(locks ../../../make)
(action (chdir ../../.. (progn
(run mkdir -p _build)
(run make lib/perl5/App/Cilly.pm)))))

(install
(section lib_root)
(files
(Cilly.pm as perl5/App/Cilly.pm)
(Cilly/CilCompiler.pm as perl5/App/Cilly/CilCompiler.pm)
(Cilly/CilConfig.pm as perl5/App/Cilly/CilConfig.pm)
(Cilly/KeptFile.pm as perl5/App/Cilly/KeptFile.pm)
(Cilly/OutputFile.pm as perl5/App/Cilly/OutputFile.pm)
(Cilly/TempFile.pm as perl5/App/Cilly/TempFile.pm)))
10 changes: 0 additions & 10 deletions lib/perl5/dune

This file was deleted.

48 changes: 14 additions & 34 deletions src/dune
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,33 @@
(modules (:standard \ main))
)

; HACK: workaround for https://github.com/ocaml/dune/issues/3374
(rule (action (copy ../src__machdep-ml.c machdep-ml.c)))
(rule (action (copy ../src__cilversion.ml cilversion.ml)))

(rule
(alias machdep)
(deps
../configure.ac ../config.status ../configure ../Makefile ../Makefile.in ../install-sh ../config.sub ../config.guess ../config.h.in ../stamp-h.in cil.mli machdep-ml.c.in cilversion.ml.in ../aclocal.m4 machdep-ml.c ../config.h)
(deps (alias ../configure) machdep-ml.c)
(targets machdep.ml)
(locks make)
(locks ../make)
(action (chdir .. (progn
(run make machdep)
(run cp _build/machdep.ml src)
))))
(run cp _build/machdep.ml src)))))

(rule
(deps (package goblint-cil) ../src/main.exe (source_tree ../lib/perl5/App/Cilly) ../bin/cilly ../configure.ac ../Makefile.in ../install-sh ../config.sub ../config.guess ../lib/perl5/App/Cilly.pm.in ../lib/perl5/Makefile.PL ../config.h.in ../stamp-h.in cil.mli machdep-ml.c.in cilversion.ml.in ../config.mk.in)
(locks make)
(action (chdir .. (progn
(run ./configure)
(run make machdep)
(run make lib/perl5/App/Cilly.pm)
(chdir lib/perl5 (progn
(run perl Makefile.PL)
(run make)
))
(run cp src/main.exe bin/cilly.native)
(bash "mkdir -p share/cil && echo $(cd ../install/default/lib; pwd) > share/cil/ocamlpath") ; TODO: what is this?
)))
(alias cilly)
)

(rule
(deps (package goblint-cil) (alias cilly) (source_tree ../test))
(locks make)
(action (chdir .. (progn
(run make test)
)))
(alias runtest)
)
(deps (package goblint-cil))
(action (chdir .. (bash "mkdir -p share/cil && echo $(cd ../install/default/lib; pwd) > share/cil/ocamlpath")))) ; TODO: what is this?

(ocamllex formatlex)
(ocamlyacc formatparse)

(executable
(public_name main) ; TODO: remove
(modes exe)
(modules main)
(libraries goblint-cil)
(link_flags (-linkall))
)
(name main)
(modules main)
(modes native)
(libraries goblint-cil)
(flags :standard -linkall))

(env
(dev
Expand Down
5 changes: 5 additions & 0 deletions test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(rule
(alias runtest)
(deps (alias_rec ../cilly) (source_tree .))
(locks ../make)
(action (chdir .. (run make test))))

0 comments on commit 65dd5cf

Please # to comment.