Jbuilder: fix dependencies in the tezos-compiler hack

This commit is contained in:
Grégoire Henry 2018-02-11 19:17:39 +01:00
parent d417a679e6
commit 0f0ec6ab7a
2 changed files with 16 additions and 3 deletions

View File

@ -152,12 +152,14 @@ let main { compile_ml ; pack_objects ; link_shared } =
let anonymous = ref []
and static = ref false
and register = ref false
and build_dir = ref None in
and build_dir = ref None
and output_dep = ref false in
let args_spec = [
"-static", Arg.Set static, " Only build the static library (no .cmxs)";
"-register", Arg.Set register, " Generete the `Registerer` module";
"-bin-annot", Arg.Set Clflags.binary_annotations, " (see ocamlopt)" ;
"-g", Arg.Set Clflags.debug, " (see ocamlopt)" ;
"-output-dep", Arg.Set output_dep, " ..." ;
"-build-dir", Arg.String (fun s -> build_dir := Some s),
"use custom build directory and preserve build artifacts"
] in
@ -239,4 +241,15 @@ let main { compile_ml ; pack_objects ; link_shared } =
if not !static then begin
Clflags.link_everything := true ;
link_shared (output ^ ".cmxs") [resulting_object] ;
end ;
if !output_dep then begin
let dsrc = Digest.file functor_file in
let dimpl = Digest.file resulting_object in
let dintf = Digest.file (Filename.chop_extension resulting_object ^ ".cmi") in
Format.printf "module Toto = struct include %s end ;; \n" for_pack ;
Format.printf "let src_digest = %S ;;\n" (Digest.to_hex dsrc) ;
Format.printf "let impl_digest = %S ;;\n" (Digest.to_hex dimpl) ;
Format.printf "let intf_digest = %S ;;\n" (Digest.to_hex dintf)
end

View File

@ -60,7 +60,7 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
src/TEZOS_PROTOCOL))
(action (with-stdout-to ${path-no-dep:tezos_protocol_%s_dummy_byte.ml}
(chdir ${ROOT}
(run ${bin:tezos-protocol-compiler-byte} -static ${path-no-dep:tezos_protocol_%s} ${path-no-dep:src}))))))
(run ${bin:tezos-protocol-compiler-byte} -static -output-dep ${path-no-dep:tezos_protocol_%s} ${path-no-dep:src}))))))
(rule
((targets (tezos_protocol_%s.o
@ -72,7 +72,7 @@ let () = Format.kasprintf Jbuild_plugin.V1.send {|
src/TEZOS_PROTOCOL))
(action (with-stdout-to ${path-no-dep:tezos_protocol_%s_dummy.ml}
(chdir ${ROOT}
(run ${bin:tezos-protocol-compiler} -static ${path-no-dep:tezos_protocol_%s} ${path-no-dep:src}))))))
(run ${bin:tezos-protocol-compiler} -static -output-dep ${path-no-dep:tezos_protocol_%s} ${path-no-dep:src}))))))
(library
((name tezos_protocol_%s)