(executable
 (name mte)
 (modules mte)
 (link_flags :standard -cclib "-z solo5-abi=hvt")
 (libraries mte)
 (foreign_stubs
  (language c)
  (names manifest)))

(library
 (name mte)
 (wrapped false)
 (modules :standard \ mte b32)
 (libraries
  ;
  mkernel
  mnet
  mnet-happy-eyeballs
  mnet-dns
  vifu
  gmp
  mirage-crypto
  mirage-crypto-rng
  mirage-crypto-rng-mkernel
  mirage-ptime.solo5
  ;
  b32
  ;
  caqti
  caqti-miou
  caqti-mnet
  caqti-driver-pgx
  pgx
  ;
  bin
  jsont
  cohttp ; just for header stuff
  duration
  kdf.hkdf
  digestif
  fmt
  fmt.tty
  logs
  logs.fmt))

(library ; crockford base32
 (name b32)
 (modules b32)
 (libraries base32))

(rule
 (target assets_crunch.ml)
 (deps
  (source_tree ../assets))
 (action
  (with-stdout-to
   %{null}
   (run ocaml-crunch -m plain ../assets -o %{target}))))

(rule
 (targets manifest.c)
 (deps manifest.json)
 (enabled_if
  (= %{context_name} "solo5"))
 (action
  (run solo5-elftool gen-manifest manifest.json manifest.c)))

(rule
 (targets manifest.c)
 (enabled_if
  (= %{context_name} "default"))
 (action
  (write-file manifest.c "")))
