Skip to content

Commit

Permalink
Switched to dune, dune-release, and OPAM 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mmottl committed Oct 25, 2018
1 parent b689cee commit 267f74a
Show file tree
Hide file tree
Showing 17 changed files with 70 additions and 84 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
@@ -1,3 +1,8 @@
### 4.4.1 (2018-10-25)

* Switched to dune, dune-release, and OPAM 2.0


### 4.4.0 (2018-07-08)

* Added support for executing queries with binary results.
Expand Down
6 changes: 3 additions & 3 deletions Makefile
@@ -1,10 +1,10 @@
.PHONY: all clean doc

all:
jbuilder build @install --dev
dune build @install

clean:
jbuilder clean
dune clean

doc:
jbuilder build --dev @doc
dune build @doc
4 changes: 4 additions & 0 deletions dune
@@ -0,0 +1,4 @@
(env
(dev (flags (:standard -w -9 -principal)))
(release (ocamlopt_flags (:standard -O3)))
)
2 changes: 2 additions & 0 deletions dune-project
@@ -0,0 +1,2 @@
(lang dune 1.1)
(name postgresql)
4 changes: 2 additions & 2 deletions examples/Makefile
Expand Up @@ -3,7 +3,7 @@ TARGETS = $(addsuffix .bc, async binary cursor dump populate prompt test_lo)
.PHONY: all clean

all:
@jbuilder build --dev $(TARGETS)
@dune build $(TARGETS)

clean:
@jbuilder clean
@dune clean
4 changes: 4 additions & 0 deletions examples/dune
@@ -0,0 +1,4 @@
(executables
(names async binary cursor dump populate prompt test_lo)
(libraries postgresql)
)
10 changes: 0 additions & 10 deletions examples/jbuild

This file was deleted.

1 change: 0 additions & 1 deletion jbuild-workspace

This file was deleted.

3 changes: 0 additions & 3 deletions postgresql.descr

This file was deleted.

41 changes: 22 additions & 19 deletions postgresql.opam
@@ -1,4 +1,4 @@
opam-version: "1.2"
opam-version: "2.0"
maintainer: "Markus Mottl <markus.mottl@gmail.com>"
authors: [
"Alain Frisch <alain.frisch@lexifi.com>"
Expand All @@ -8,34 +8,37 @@ authors: [
license: "LGPL-2.1+ with OCaml linking exception"
homepage: "https://mmottl.github.io/postgresql-ocaml"
doc: "https://mmottl.github.io/postgresql-ocaml/api"
dev-repo: "https://github.com/mmottl/postgresql-ocaml.git"
dev-repo: "git+https://github.com/mmottl/postgresql-ocaml.git"
bug-reports: "https://github.com/mmottl/postgresql-ocaml/issues"

build: [
["jbuilder" "subst" "-p" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
]

depends: [
"base-bytes"
"ocaml" {>= "4.05"}
"dune" {build & >= "1.4.0"}
"base" {build}
"stdio" {build}
"configurator" {build}
"jbuilder" {build & >= "1.0+beta10"}
"base-bytes"
]

depexts: [
[["debian"] ["libpq-dev"]]
[["freebsd"] ["database/postgresql96-client"]]
[["openbsd"] ["database/postgresql96-client"]]
[["ubuntu"] ["libpq-dev"]]
[["centos"] ["postgresql-devel"]]
[["rhel"] ["postgresql-devel"]]
[["fedora"] ["postgresql-devel"]]
[["alpine"] ["postgresql-dev"]]
[["opensuse"] ["postgresql"]]
[["osx" "homebrew"] ["postgresql"]]
[["osx" "macports"] ["postgresql96"]]
["libpq-dev"] {os-distribution = "debian"}
["database/postgresql96-client"] {os-distribution = "freebsd"}
["database/postgresql96-client"] {os-distribution = "openbsd"}
["libpq-dev"] {os-distribution = "ubuntu"}
["postgresql-devel"] {os-distribution = "centos"}
["postgresql-devel"] {os-distribution = "rhel"}
["postgresql-devel"] {os-distribution = "fedora"}
["postgresql-dev"] {os-distribution = "alpine"}
["postgresql"] {os-distribution = "opensuse"}
["postgresql"] {os = "macos" & os-distribution = "homebrew"}
["postgresql96"] {os = "macos" & os-distribution = "macports"}
]

available: [ ocaml-version >= "4.04" ]
synopsis: "Bindings to the PostgreSQL library"

description: """
Postgresql offers library functions for accessing PostgreSQL databases."""
4 changes: 2 additions & 2 deletions src/Makefile
Expand Up @@ -3,7 +3,7 @@ TARGETS = postgresql.cma libpostgresql_stubs.a
.PHONY: all clean

all:
@jbuilder build --dev $(TARGETS)
@dune build $(TARGETS)

clean:
@jbuilder clean
@dune clean
5 changes: 2 additions & 3 deletions src/config/Makefile
@@ -1,10 +1,9 @@
TARGETS = discover.bc
JBUILDER_ROOT = ../..

.PHONY: all clean

all:
@jbuilder build --dev $(TARGETS)
@dune build $(TARGETS)

clean:
@jbuilder clean
@dune clean
10 changes: 3 additions & 7 deletions src/config/discover.ml
Expand Up @@ -2,7 +2,7 @@ open Base
open Stdio

let () =
let module C = Configurator in
let module C = Configurator.V1 in
C.main ~name:"postgresql" (fun _c ->
let cmd = "pg_config --includedir --libdir --version" in
let ic =
Expand Down Expand Up @@ -56,9 +56,5 @@ let () =
cflags = [pgsql_includedir; major; minor];
libs = [pgsql_libdir; "-lpq"];
} in
let write_sexp file sexp =
Out_channel.write_all file ~data:(Sexp.to_string sexp)
in
write_sexp "c_flags.sexp" (sexp_of_list sexp_of_string conf.cflags);
write_sexp "c_library_flags.sexp"
(sexp_of_list sexp_of_string conf.libs)))
C.Flags.write_sexp "c_flags.sexp" conf.cflags;
C.Flags.write_sexp "c_library_flags.sexp" conf.libs))
4 changes: 4 additions & 0 deletions src/config/dune
@@ -0,0 +1,4 @@
(executables
(names discover)
(libraries base stdio dune.configurator)
)
10 changes: 0 additions & 10 deletions src/config/jbuild

This file was deleted.

17 changes: 17 additions & 0 deletions src/dune
@@ -0,0 +1,17 @@
(library
(public_name postgresql)
(c_names postgresql_stubs)
(c_flags (
(:include c_flags.sexp) -g -O2 -fPIC -DPIC
; NOTE: for debugging before releases
; -Wall -pedantic -Wextra -Wunused -Wno-long-long -Wno-keyword-macro
))
(c_library_flags (:include c_library_flags.sexp))
(libraries threads bigarray)
)

(rule
(targets c_flags.sexp c_library_flags.sexp)
(deps (:discover config/discover.exe))
(action (run %{discover}))
)
24 changes: 0 additions & 24 deletions src/jbuild

This file was deleted.

0 comments on commit 267f74a

Please sign in to comment.