Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build with dune #31

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*.so
*.cmt
*.cmti
.merlin
config/.merlin
test/minigzip
test/minizip
test/testzlib
21 changes: 21 additions & 0 deletions config/discover.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module C = Configurator.V1

let () =
C.main ~name:"zip" (fun c ->

let stale_gzip : C.Pkg_config.package_conf = {
libs = [ "-lz" ];
cflags = []
} in

let conf =
match C.Pkg_config.get c with
| None -> C.die "'pkg-config' missing"
| Some pc ->
match (C.Pkg_config.query pc ~package:"zlib") with
| None -> stale_gzip
| Some deps -> deps
in

C.Flags.write_sexp "c_flags.sexp" conf.cflags;
C.Flags.write_sexp "c_library_flags.sexp" conf.libs)
3 changes: 3 additions & 0 deletions config/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(executable
(name discover)
(libraries dune.configurator))
18 changes: 18 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
(library
(public_name zip)
olafhering marked this conversation as resolved.
Show resolved Hide resolved
(synopsis "OCaml ZIP interface")
(wrapped false)
(modules gzip zip zlib)
(libraries stdlib-shims)
olafhering marked this conversation as resolved.
Show resolved Hide resolved
(c_names zlibstubs)
(c_flags
(:include c_flags.sexp))
(c_library_flags
(:include c_library_flags.sexp)))

(rule
(targets c_flags.sexp c_library_flags.sexp)
(deps
(:discover config/discover.exe))
(action
(run %{discover})))
26 changes: 26 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(lang dune 1.10)

(generate_opam_files true)

(license "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception")

(authors "Xavier Leroy")

(maintainers "Cryptosense <[email protected]>")

(homepage "https://github.com/xavierleroy/camlzip")

(bug_reports "https://github.com/xavierleroy/camlzip/issues")

(package
(name zip)
(synopsis
"Provides easy access to compressed files in ZIP, GZIP and JAR format")
(description "Reading and writing zip and gzip files from OCaml.")
(depends
dune-configurator
dune
stdlib-shims
conf-zlib
(ocaml
(>= 4.02.0))))
23 changes: 23 additions & 0 deletions zip.opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "-p" name "@doc"] {with-doc}
]
maintainer: ["Cryptosense <[email protected]>"]
authors: ["Xavier Leroy"]
bug-reports: "https://github.com/xavierleroy/camlzip/issues"
homepage: "https://github.com/xavierleroy/camlzip"
license: "LGPL-2.1-or-later WITH OCaml-LGPL-linking-exception"
synopsis:
"Provides easy access to compressed files in ZIP, GZIP and JAR format"
description: "Reading and writing zip and gzip files from OCaml."
depends: [
"dune-configurator"
"dune"
"stdlib-shims"
"conf-zlib"
"ocaml" {>= "4.02.0"}
]