(library
  (name        opam_core)
  (public_name opam-core)
  (synopsis    "OCaml Package Manager core internal stdlib")
  ; TODO: Remove (re_export ...) when CI uses the OCaml version that includes https://github.com/ocaml/ocaml/pull/11989
  (libraries   re (re_export ocamlgraph) unix sha jsonm swhid_core uutf
               (select opamACL.ml from
                       (opam-core.libacl -> opamACL.libacl.ml)
                       (                 -> opamACL.dummy.ml))
               (select opamStubs.ml from
                       (opam-core.stubs -> opamStubs.win32.ml)
                       (                -> opamStubs.dummy.ml)))
  (flags       (:standard
               (:include ../ocaml-flags-standard.sexp)
               (:include ../ocaml-flags-configure.sexp)
               (:include ../ocaml-context-flags.sexp)))
  (wrapped     false))

(rule
  (copy opamStubsTypes.ml opamStubsTypes.mli))

(rule
  (write-file opamCoreConfigDeveloper.ml
    "let value = \"%{read-strings:developer}\""))

(rule
  (write-file opamVersionInfo.ml
              "let version = \"%{read-strings:version}\""))

(rule
  (targets version)
  (deps    ../../shell/get_version.ml ../../configure.ac)
  (action  (with-stdout-to %{targets} (run ocaml ../../shell/get_version.ml ../../configure.ac))))

(rule
  (targets developer)
  (mode    fallback)
  (action  (with-stdout-to %{targets} (echo ""))))
