(executable
  (name main)
  (modes byte exe)
  (public_name wyrd)
  (modules (:standard \ locale))
  (flags (:standard -w -3-32))
  (ocamlopt_flags (:include ocamlopt_flags.sexp))
  (libraries unix str curses locale yojson))

(library
  (name locale)
  (public_name wyrd.locale)
  (modules locale)
  (foreign_stubs
    (language c)
    (names locale_wrap)))

(rule
  (target ocamlopt_flags.sexp)
  (enabled_if
    (= %{profile} static))
  (action
    (write-file %{target} "(:standard -cclib -static)")))

(rule
  (target ocamlopt_flags.sexp)
  (enabled_if
    (<> %{profile} static))
  (action
    (write-file %{target} "(:standard)")))

(rule
  (target install.ml)
  (action (with-stdout-to %{target}
    (system "sed \
        -e 's|@prefix@|%{env:PREFIX=@prefix@}|' \
        -e 's|@prefix@|%{env:OPAM_SWITCH_PREFIX=@prefix@}|' \
        -e 's|@prefix@|/usr/local|' \
        -e 's|@sysconfdir@|%{env:WYRD_SYSCONFDIR=@sysconfdir@}|' \
        -e 's|@sysconfdir@|${prefix}/etc|' \
        -e 's|@PACKAGE_VERSION@|%{env:WYRD_VERSION=@PACKAGE_VERSION@}|' \
        -e 's|@PACKAGE_VERSION@|%{version:wyrd}|' \
      %{deps}")))
  (deps (file install.ml.in)))

(install
  (files ChangeLog COPYING)
  (section doc))
