opam-version: "2.0"
maintainer:   "anil@recoil.org"
authors:      ["Anil Madhavapeddy" "Richard Mortier" "Thomas Gazagnaire"
               "Pierre Chambart" "David Kaloper" "Jeremy Yallop" ]
homepage:     "https://github.com/mirage/ocaml-cstruct"
license:      "ISC"
dev-repo: "git+https://github.com/mirage/ocaml-cstruct.git"
bug-reports:  "https://github.com/mirage/ocaml-cstruct/issues"
tags: [
  "org:mirage"
  "org:xapi-project"
]
build: [
  [
    "./configure"
    "--prefix"
    prefix
    "--%{lwt+base-unix:enable}%-lwt"
    "--%{camlp4:enable}%-camlp4"
    "--%{ppx_tools:enable}%-ppx"
    "--%{async:enable}%-async"
    "--%{base-unix:enable}%-unix"
  ]
  [make]
  [
    "./configure"
    "--prefix"
    prefix
    "--%{lwt:enable}%-lwt"
    "--%{camlp4:enable}%-camlp4"
    "--%{ppx_tools:enable}%-ppx"
    "--%{async:enable}%-async"
    "--%{base-unix:enable}%-unix"
    "--enable-tests"
  ] {with-test}
  [make] {with-test}
  ["./test.sh"] {with-test}
]
install: [
  [make "install"]
  [make "js-install"]
]
remove:  [
  [make "js-uninstall"]
  ["ocamlfind" "remove" "cstruct"]
]
depends: [
  "ocaml" {>= "4.01.0" & < "4.03.0"}
  "ocamlfind" {build}
  "type_conv" {build}
  "ounit" {with-test}
  "ocplib-endian"
  "sexplib" {< "v0.15"}
  "base-bytes"
  "conf-time"
]
depopts: [
  "camlp4"
  "ppx_tools"
  "async"
  "lwt"
  "base-unix"
]
synopsis: "access C structures via a camlp4 extension"
description: """
Cstruct is a library and syntax extension to make it easier to access C-like
structures directly from OCaml. It supports both reading and writing to these
structures, and they are accessed via the Bigarray module.

An example pcap description is:

```
cstruct pcap_header {
  uint32_t magic_number;   (* magic number *)
  uint16_t version_major;  (* major version number *)
  uint16_t version_minor;  (* minor version number *)
  uint32_t thiszone;       (* GMT to local correction *)
  uint32_t sigfigs;        (* accuracy of timestamps *)
  uint32_t snaplen;        (* max length of captured packets, in octets *)
  uint32_t network         (* data link type *)
} as little_endian
```"""
url {
  src: "https://github.com/mirage/ocaml-cstruct/archive/v1.8.0.tar.gz"
  checksum: "md5=61de655438620caebb0e011cd96d5bf9"
}
