Add Which_program to know whether we are dune or jbuilder
Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
parent
9585c8f79d
commit
16d34f4a07
|
@ -90,7 +90,7 @@ case "$TARGET" in
|
||||||
echo -en "travis_fold:end:dune.bootstrap\r"
|
echo -en "travis_fold:end:dune.bootstrap\r"
|
||||||
./boot.exe --subst
|
./boot.exe --subst
|
||||||
echo -en "travis_fold:start:dune.boot\r"
|
echo -en "travis_fold:start:dune.boot\r"
|
||||||
./boot.exe --dev
|
./boot.exe
|
||||||
echo -en "travis_fold:end:dune.boot\r"
|
echo -en "travis_fold:end:dune.boot\r"
|
||||||
if [ $WITH_OPAM -eq 1 ] ; then
|
if [ $WITH_OPAM -eq 1 ] ; then
|
||||||
_build/install/default/bin/dune runtest && \
|
_build/install/default/bin/dune runtest && \
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -1,5 +1,5 @@
|
||||||
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
|
INSTALL_ARGS := $(if $(PREFIX),--prefix $(PREFIX),)
|
||||||
BIN := ./_build/default/bin/main.exe
|
BIN := ./_build/default/bin/main_dune.exe
|
||||||
|
|
||||||
-include Makefile.dev
|
-include Makefile.dev
|
||||||
|
|
||||||
|
|
21
bin/dune
21
bin/dune
|
@ -1,11 +1,20 @@
|
||||||
|
(library
|
||||||
|
(name main)
|
||||||
|
(modules (main))
|
||||||
|
(libraries unix dune cmdliner))
|
||||||
|
|
||||||
(executable
|
(executable
|
||||||
(name main)
|
(name main_dune)
|
||||||
(public_name dune)
|
(public_name dune)
|
||||||
(package dune)
|
(package dune)
|
||||||
(libraries unix dune cmdliner)
|
(modules (main_dune))
|
||||||
|
(libraries which_program_dune main)
|
||||||
(preprocess no_preprocessing))
|
(preprocess no_preprocessing))
|
||||||
|
|
||||||
(install
|
(executable
|
||||||
(section bin)
|
(name main_jbuilder)
|
||||||
(package dune)
|
(public_name jbuilder)
|
||||||
(files (main.exe as jbuilder)))
|
(package dune)
|
||||||
|
(modules (main_jbuilder))
|
||||||
|
(libraries which_program_jbuilder main)
|
||||||
|
(preprocess no_preprocessing))
|
||||||
|
|
|
@ -1538,7 +1538,7 @@ let default =
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
let () =
|
let main () =
|
||||||
Colors.setup_err_formatter_colors ();
|
Colors.setup_err_formatter_colors ();
|
||||||
try
|
try
|
||||||
match Term.eval_choice default all ~catch:false with
|
match Term.eval_choice default all ~catch:false with
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
(* empty *)
|
val main : unit -> unit
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
let () = Main.main ()
|
|
@ -0,0 +1 @@
|
||||||
|
(* empty *)
|
|
@ -0,0 +1 @@
|
||||||
|
let () = Main.main ()
|
|
@ -0,0 +1 @@
|
||||||
|
(* empty *)
|
|
@ -29,7 +29,8 @@ end
|
||||||
|
|
||||||
(* Directories with library names *)
|
(* Directories with library names *)
|
||||||
let dirs =
|
let dirs =
|
||||||
[ "src/stdune/caml" , Some "Caml"
|
[ "src/which_program" , Some "Which_program"
|
||||||
|
; "src/stdune/caml" , Some "Caml"
|
||||||
; "src/stdune" , Some "Stdune"
|
; "src/stdune" , Some "Stdune"
|
||||||
; "src/fiber" , Some "Fiber"
|
; "src/fiber" , Some "Fiber"
|
||||||
; "src/xdg" , Some "Xdg"
|
; "src/xdg" , Some "Xdg"
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
(library
|
||||||
|
(name which_program)
|
||||||
|
(public_name dune.which-program)
|
||||||
|
(synopsis "[Internal] Standard library of Dune")
|
||||||
|
(wrapped false)
|
||||||
|
(flags (:standard (:include no-keep-locs)))
|
||||||
|
(modules_without_implementation which_program))
|
||||||
|
|
||||||
|
; To avoid issues on Windows and OSX
|
||||||
|
(rule (with-stdout-to which_program_dummy.ml (echo "")))
|
||||||
|
|
||||||
|
(rule
|
||||||
|
(with-stdout-to no-keep-locs
|
||||||
|
(run %{OCAML} %{path:gen-no-keep-locs} %{ocaml_version})))
|
|
@ -0,0 +1,7 @@
|
||||||
|
(library
|
||||||
|
(name which_program_dune)
|
||||||
|
(public_name dune.which-program.dune)
|
||||||
|
(wrapped false)
|
||||||
|
(flags (:standard (:include ../no-keep-locs))))
|
||||||
|
|
||||||
|
(rule (copy# ../which_program.mli which_program.mli))
|
|
@ -0,0 +1,2 @@
|
||||||
|
type t = Dune | Jbuilder
|
||||||
|
let t = Dune
|
|
@ -0,0 +1,8 @@
|
||||||
|
(* -*- tuared -*- *)
|
||||||
|
|
||||||
|
let () =
|
||||||
|
let ver = Scanf.sscanf Sys.argv.(1) "%u.%u" (fun a b -> a, b) in
|
||||||
|
if ver >= (4, 03) then
|
||||||
|
print_endline "(-no-keep-locs)"
|
||||||
|
else
|
||||||
|
print_endline "()"
|
|
@ -0,0 +1,7 @@
|
||||||
|
(library
|
||||||
|
(name which_program_jbuilder)
|
||||||
|
(public_name dune.which-program.jbuilder)
|
||||||
|
(wrapped false)
|
||||||
|
(flags (:standard (:include ../no-keep-locs))))
|
||||||
|
|
||||||
|
(rule (copy# ../which_program.mli which_program.mli))
|
|
@ -0,0 +1,2 @@
|
||||||
|
type t = Dune | Jbuilder
|
||||||
|
let t = Jbuilder
|
|
@ -0,0 +1,2 @@
|
||||||
|
type t = Dune | Jbuilder
|
||||||
|
let t = Dune
|
|
@ -0,0 +1,5 @@
|
||||||
|
(** Whether we are 'dune' or 'jbuilder' *)
|
||||||
|
|
||||||
|
type t = Dune | Jbuilder
|
||||||
|
|
||||||
|
val t : t
|
|
@ -12,11 +12,11 @@
|
||||||
ocamlopt test$ext_dll
|
ocamlopt test$ext_dll
|
||||||
|
|
||||||
$ dune build @runtest
|
$ dune build @runtest
|
||||||
|
dynamic alias runtest
|
||||||
|
OK: ./dynamic.exe ./test$ext_dll
|
||||||
static alias runtest
|
static alias runtest
|
||||||
OK: ./static.bc
|
OK: ./static.bc
|
||||||
dynamic alias runtest
|
|
||||||
OK: ./dynamic.exe ./test.bc.so
|
|
||||||
static alias runtest
|
static alias runtest
|
||||||
OK: ./static.exe
|
OK: ./static.exe
|
||||||
dynamic alias runtest
|
dynamic alias runtest
|
||||||
OK: ./dynamic.exe ./test$ext_dll
|
OK: ./dynamic.exe ./test.bc.so
|
||||||
|
|
Loading…
Reference in New Issue