about summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <git@lukasepple.de>2020-04-23 18:28:54 +0200
committersternenseemann <git@lukasepple.de>2020-04-23 18:30:31 +0200
commit0e6a41190e1f32cb1181067a0e308a69b29bfe92 (patch)
tree9d186784482d4283c5e6c2c318e12437d41096a4
parent6cbcfbb87db71633e127d4e91651d837c28b32e0 (diff)
Fix build errors due to pkg updates, switch to dune
-rw-r--r--.gitignore1
-rw-r--r--CHANGES.md11
-rw-r--r--README.md3
-rw-r--r--dune-project2
-rw-r--r--logbook.nix15
-rw-r--r--logbook.opam (renamed from opam)17
-rw-r--r--pkg/META7
-rwxr-xr-xpkg/pkg.ml9
-rw-r--r--src/dune11
-rw-r--r--src/log.ml2
-rw-r--r--src/logbook.ml2
11 files changed, 39 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore
index 113f970..5a01a1d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,4 @@ tmp
 *.byte
 # nix
 result
+src/.merlin
diff --git a/CHANGES.md b/CHANGES.md
index 9bdf255..5259583 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,4 +1,9 @@
-vX.Y.Z YYYY-MM-DD Location
---------------------------
+v0.2 2020-04-23
+---------------
 
-First release. 
+Fixed build errors, switched to dune.
+
+v0.1 2017-02-18
+---------------
+
+Initial Version.
diff --git a/README.md b/README.md
index 69b708d..3594e0a 100644
--- a/README.md
+++ b/README.md
@@ -20,9 +20,8 @@ The 42nd day of the year.
   More text!
 ```
 
-## Installation & Usage
+## Usage
 
 ```
-opam pin add logbook https://github.com/sternenseemann/logbook.git
 logbook --file example.log [ --private | --public | --semi-private ]
 ```
diff --git a/dune-project b/dune-project
new file mode 100644
index 0000000..a9a7358
--- /dev/null
+++ b/dune-project
@@ -0,0 +1,2 @@
+(lang dune 2.4)
+(name logbook)
diff --git a/logbook.nix b/logbook.nix
index d0b01e1..dc857cb 100644
--- a/logbook.nix
+++ b/logbook.nix
@@ -1,15 +1,12 @@
-{ stdenv, ocaml, topkg, ocamlbuild, findlib, ocaml_lwt
-, jingoo, ptime, angstrom, astring, opam, cow}:
+{ buildDunePackage, ocaml_lwt, jingoo, ptime, angstrom, astring, cow}:
 
-stdenv.mkDerivation rec {
-  version = "0.1";
-  name = "ocaml${ocaml.version}-logbook-${version}";
+buildDunePackage rec {
+  version = "0.2";
+  pname = "logbook";
 
   src = ./.;
 
-  buildInputs = [ ocaml findlib ocamlbuild topkg opam cow
-                  ocaml_lwt jingoo ptime angstrom astring
-                ];
+  buildInputs = [ cow ocaml_lwt jingoo ptime angstrom astring ];
 
-  inherit (topkg) buildPhase installPhase;
+  useDune2 = true;
 }
diff --git a/opam b/logbook.opam
index c1e1277..0e9197c 100644
--- a/opam
+++ b/logbook.opam
@@ -7,19 +7,18 @@ license: "ISC"
 dev-repo: "https://github.com/sternenseemann/logbook.git"
 bug-reports: "https://github.com/sternenseemann/logbook/issues"
 tags: []
-available: [ ocaml-version >= "4.02.0" ]
 depends: [
-  "ocamlfind" {build}
-  "ocamlbuild" {build}
-  "topkg" {build} 
-  "ptime"
-  "angstrom"
-  "astring"
+  "ocaml" {>= "4.07"}
+  "dune" {>= "2.4"}
+  "ptime" {>= "0.8.0"}
+  "angstrom" {>= "0.12.0"}
+  "astring" {>= "0.8.0"}
   "lwt"
   "jingoo"
   "cow"
   ]
 depopts: []
 build: [
-  "ocaml" "pkg/pkg.ml" "build"
-          "--pinned" pinned ]
+  [ "dune" "subst" ] { pinned }
+  [ "dune" "build" "-p" name "-j" jobs ]
+]
diff --git a/pkg/META b/pkg/META
deleted file mode 100644
index d87022d..0000000
--- a/pkg/META
+++ /dev/null
@@ -1,7 +0,0 @@
-description = "tool for personal log files"
-version = "%%VERSION_NUM%%"
-requires = "ptime angstrom astring lwt jingoo omd"
-archive(byte) = "logbook.cma"
-archive(native) = "logbook.cmxa"
-plugin(byte) = "logbook.cma"
-plugin(native) = "logbook.cmxs"
diff --git a/pkg/pkg.ml b/pkg/pkg.ml
deleted file mode 100755
index 0909c4d..0000000
--- a/pkg/pkg.ml
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/usr/bin/env ocaml
-#use "topfind"
-#require "topkg"
-open Topkg
-
-let () =
-  Pkg.describe "logbook" @@ fun c ->
-  Ok [ Pkg.mllib "src/log.mllib";
-       Pkg.bin "src/logbook" ~dst:"logbook"; ]
diff --git a/src/dune b/src/dune
new file mode 100644
index 0000000..1c4a997
--- /dev/null
+++ b/src/dune
@@ -0,0 +1,11 @@
+(library
+  (name log)
+  (public_name logbook)
+  (libraries bytes ptime angstrom astring)
+  (modules log))
+
+(executable
+  (name logbook)
+  (public_name logbook)
+  (libraries logbook lwt lwt.unix jingoo cow)
+  (modules logbook logbook_template logbook_models))
diff --git a/src/log.ml b/src/log.ml
index b2680f8..ef97101 100644
--- a/src/log.ml
+++ b/src/log.ml
@@ -47,7 +47,7 @@ let date =
 let spaced_list p =
   many (p <* skip_many empty_line)
 
-let rec fail_if_none p =
+let fail_if_none p =
   let failer = function
     | None -> fail "Value is None"
     | Some x -> return x
diff --git a/src/logbook.ml b/src/logbook.ml
index 9f5fe44..2bbdfce 100644
--- a/src/logbook.ml
+++ b/src/logbook.ml
@@ -2,7 +2,7 @@ open Lwt
 open Lwt.Infix
 
 let parse_file f =
-  Lwt_io.with_file Lwt_io.Input f (fun c ->
+  Lwt_io.with_file ~mode:Lwt_io.Input f (fun c ->
     Lwt_io.read c >>= (fun s ->
       return (Angstrom.parse_string Log.log_parser s)))