(* -*- tuareg -*- *) let prefix = "proto_" let dirname = Filename.basename @@ Filename.dirname @@ Filename.dirname @@ Sys.getcwd () let predefined_version = None (* to be substituted in opam packages *) let lib_version = match predefined_version with | Some version -> version | None -> let x = String.length prefix in let n = String.length dirname in if not (n >= x && String.sub dirname 0 x = prefix) then failwith "unexpected directory name" ; String.sub dirname x (n - x) let version = String.concat "-" (String.split_on_char '_' lib_version) let () = Format.kasprintf Jbuild_plugin.V1.send {| (rule (targets environment.ml) (action (write-file %%{targets} "include Tezos_protocol_environment_shell.MakeV1(struct let name = \"%s\" end)() module CamlinternalFormatBasics = struct include CamlinternalFormatBasics end "))) (rule (targets registerer.mli) (action (write-file %%{targets} "(* empty *)"))) (rule (targets registerer.ml) (deps tezos_embedded_protocol_environment_%s.cmxa (:src_dir TEZOS_PROTOCOL)) (action (with-stdout-to %%{targets} (chdir %%{workspace_root} (run %%{bin:tezos-embedded-protocol-packer} "%%{src_dir}" "%s"))))) (library (name tezos_embedded_protocol_environment_%s) (public_name tezos-embedded-protocol-%s.environment) (library_flags (:standard -linkall)) (libraries tezos-protocol-environment-shell) (modules Environment)) (library (name tezos_embedded_raw_protocol_%s) (public_name tezos-embedded-protocol-%s.raw) (libraries tezos_embedded_protocol_environment_%s) (library_flags (:standard -linkall)) (flags (:standard -nopervasives -nostdlib -safe-string -w +a-4-6-7-9-29-32-40..42-44-45-48 -warn-error -a+8 -open Tezos_embedded_protocol_environment_%s__Environment -open Pervasives -open Error_monad)) (modules :standard \ Environment Registerer)) (library (name tezos_embedded_protocol_%s) (public_name tezos-embedded-protocol-%s) (library_flags (:standard -linkall)) (libraries tezos_embedded_raw_protocol_%s tezos-protocol-updater tezos-protocol-environment-shell) (flags (:standard -w +a-4-6-7-9-29-32-40..42-44-45-48 -warn-error -a+8)) (modules Registerer)) |} version lib_version lib_version lib_version version lib_version version lib_version lib_version lib_version version lib_version