From e79dabae4498dd278ad9a36b9d165e4d14b6bbbd Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 14:55:11 +0900 Subject: [PATCH 1/9] mv Makefile to Makefile.old to deprecate its use --- Makefile => Makefile.old | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Makefile => Makefile.old (100%) diff --git a/Makefile b/Makefile.old similarity index 100% rename from Makefile rename to Makefile.old From a9f4968456a10da4a3d651f89a0c90c3c12dcd27 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 14:56:00 +0900 Subject: [PATCH 2/9] I don't think Makefile.config should be under version control --- Makefile.config | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 Makefile.config diff --git a/Makefile.config b/Makefile.config deleted file mode 100644 index 998989d..0000000 --- a/Makefile.config +++ /dev/null @@ -1,4 +0,0 @@ -OCAML_STDLIB=/home/xleroy/.opam/4.03.0/lib/ocaml -DBM_INCLUDES= -DBM_LINK=-lgdbm_compat -lgdbm -DBM_DEFINES=-DDBM_USES_GDBM_NDBM From 38cd20e8c5dcfae3c5d6c637bf59a55690da66e5 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 14:58:50 +0900 Subject: [PATCH 3/9] added generation of the jbuild file to the configure script --- configure | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 9a3d094..227aac7 100755 --- a/configure +++ b/configure @@ -92,6 +92,24 @@ echo echo "Configuration successful" echo +# jbuilder config file generation +cat < jbuild +(jbuild_version 1) + +(library + ((name dbm) + (public_name dbm) + (modules (dbm)) + (c_names (cldbm)) + (c_flags ($dbm_defines -I$dbm_include)) + (c_library_flags ($dbm_link)))) + +(executables + ((names (testdbm)) + (modules (testdbm)) + (libraries (dbm)))) +EOF + if test "$dbm_include" = "/usr/include"; then dbm_include="" else @@ -102,4 +120,3 @@ echo "OCAML_STDLIB=$stdlib" > Makefile.config echo "DBM_INCLUDES=$dbm_include" >> Makefile.config echo "DBM_LINK=$dbm_link" >> Makefile.config echo "DBM_DEFINES=$dbm_defines" >> Makefile.config - From 309658a8c787563568273df87e723fc70979d1a6 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 15:00:22 +0900 Subject: [PATCH 4/9] jbuilder needs a dbm.opam file to be in here --- dbm.opam | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 dbm.opam diff --git a/dbm.opam b/dbm.opam new file mode 100644 index 0000000..9b2c70f --- /dev/null +++ b/dbm.opam @@ -0,0 +1,25 @@ +opam-version: "1.2" +maintainer: "https://github.com/ocaml/opam-repository/issues" +authors: "Francois Rouaix et. al." +license: "LGPL-v2 with OCaml linking exception" +homepage: "https://github.com/ocaml/dbm" +bug-reports: "https://github.com/ocaml/dbm/issues" +dev-repo: "https://github.com/ocaml/dbm.git" +build: [ + ["./configure"] + ["jbuilder" "build" "-p" name "-j" jobs] + ["jbuilder" "build" "testdbm.exe"] + ["./_build/default/testdbm.exe"] +] +depends: ["jbuilder" {build}] +depexts: [ + ["libgdbm-dev"] {os-distribution = "debian"} + ["libgdbm-dev"] {os-distribution = "ubuntu"} + ["gdbm"] {os-distribution = "nixos"} + ["gdbm-devel"] {os-distribution = "centos"} + ["gdbm-devel"] {os-distribution = "rhel"} + ["gdbm-devel"] {os-distribution = "fedora"} + ["gdbm-dev"] {os-distribution = "alpine"} + ["gdbm"] {os = "macos" & os-distribution = "homebrew"} + ["gdbm"] {os-distribution = "archlinux"} +] From ffdf53cb3a261dee9aff00f9d2c7cfdbee018315 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 15:08:04 +0900 Subject: [PATCH 5/9] updated the README --- README.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index da9e7c6..747c94e 100644 --- a/README.md +++ b/README.md @@ -8,27 +8,29 @@ See the file `dbm.mli` for documentation of the programming inteface. This library used to be included in the standard OCaml distribution. This is the standalone distribution of this library, with the same functionalities. - ## REQUIREMENTS * OCaml * Either the GDBM library or any NDBM-compatible library. Make sure to install the development files as well. For Debian or Ubuntu, install the package `libgdbm-dev`. - ## INSTALLATION * Run the "configure" script by typing ./configure * Build the library: - make all + jbuilder build @install * Test the library: - make test + jbuilder build testdbm.exe + ./_build/default/testdbm.exe * Install the library: - sudo make install + jbuilder install +* Uninstall the library: + jbuilder build @install # if not done previously + jbuilder uninstall ## USAGE @@ -38,10 +40,6 @@ In bytecode: In native code: ocamlopt dbm.cmxa - ## LICENSE This Library is distributed under the terms of the GNU Library General Public License version 2, with a special exception allowing unconstrained static linking. See file LICENSE for details. - - - From fb2bb2cf23ea9883fff69142ef41068ef723ebba Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 17:19:20 +0900 Subject: [PATCH 6/9] going to opam-1.2 syntax in the depexts section --- dbm.opam | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dbm.opam b/dbm.opam index 9b2c70f..e193765 100644 --- a/dbm.opam +++ b/dbm.opam @@ -13,13 +13,13 @@ build: [ ] depends: ["jbuilder" {build}] depexts: [ - ["libgdbm-dev"] {os-distribution = "debian"} - ["libgdbm-dev"] {os-distribution = "ubuntu"} - ["gdbm"] {os-distribution = "nixos"} - ["gdbm-devel"] {os-distribution = "centos"} - ["gdbm-devel"] {os-distribution = "rhel"} - ["gdbm-devel"] {os-distribution = "fedora"} - ["gdbm-dev"] {os-distribution = "alpine"} - ["gdbm"] {os = "macos" & os-distribution = "homebrew"} - ["gdbm"] {os-distribution = "archlinux"} + [["debian"] ["libgdbm-dev"]] + [["ubuntu"] ["libgdbm-dev"]] + [["nixos"] ["gdbm"]] + [["centos"] ["gdbm-devel"]] + [["rhel"] ["gdbm-devel"]] + [["fedora"] ["gdbm-devel"]] + [["alpine"] ["gdbm-dev"]] + [["homebrew"] ["gdbm"]] + [["archlinux"] ["gdbm"]] ] From 095eb36e78d79fc8e917a82b64a6cc6b229000c7 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 17:25:54 +0900 Subject: [PATCH 7/9] added jbuilder target to run tests in the generation of the jbuild file --- configure | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/configure b/configure index 227aac7..20bee19 100755 --- a/configure +++ b/configure @@ -108,6 +108,11 @@ cat < jbuild ((names (testdbm)) (modules (testdbm)) (libraries (dbm)))) + +(alias + ((name runtest) + (deps (testdbm.exe)) + (action (run \${<})))) EOF if test "$dbm_include" = "/usr/include"; then From c1599e50e311fe9b9275ffe4cc7344fe7fe206a7 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Thu, 10 May 2018 17:29:50 +0900 Subject: [PATCH 8/9] dbm.opam: moved running the unit tests into a build-test section --- dbm.opam | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbm.opam b/dbm.opam index e193765..9213bb2 100644 --- a/dbm.opam +++ b/dbm.opam @@ -8,8 +8,9 @@ dev-repo: "https://github.com/ocaml/dbm.git" build: [ ["./configure"] ["jbuilder" "build" "-p" name "-j" jobs] - ["jbuilder" "build" "testdbm.exe"] - ["./_build/default/testdbm.exe"] +] +build-test: [ + ["jbuilder" "runtest" "-p" name] ] depends: ["jbuilder" {build}] depexts: [ From 94c3afbccc2da2e81bb45b23ce32d5d14bbfde92 Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Fri, 11 May 2018 09:55:20 +0900 Subject: [PATCH 9/9] added -j jobs to the build-test opam target (suggestion from @rgrinberg) --- dbm.opam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dbm.opam b/dbm.opam index 9213bb2..b50b384 100644 --- a/dbm.opam +++ b/dbm.opam @@ -10,7 +10,7 @@ build: [ ["jbuilder" "build" "-p" name "-j" jobs] ] build-test: [ - ["jbuilder" "runtest" "-p" name] + ["jbuilder" "runtest" "-p" name "-j" jobs] ] depends: ["jbuilder" {build}] depexts: [