(* -*- tuareg -*- *)

open Jbuild_plugin.V1

let os, libs =
  match List.assoc "os_type" ocamlc_config with
  | "Win32" -> "windows", "ctypes ctypes.foreign"
  | _os -> begin match List.assoc "system" ocamlc_config with
    | "linux" -> "linux", "unix"
    | "macosx" -> "macos", "unix"
    | _system -> "linux", "unix" (* TODO: fix me *)
    end

let () =
  Printf.ksprintf send
    {|
(library
 (public_name directories)
 (wrapped false)
 (modules directories common)
 (private_modules common)
 (libraries %s))

(copy_files# %s/*)
|}
  libs os
