From e1a7faf42e96757e103eb55a8b6d5848bb1f61f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20B=C3=BCnzli?= Date: Wed, 9 Feb 2022 22:08:23 +0100 Subject: [PATCH] B0ify. --- .gitignore | 4 --- .merlin | 3 ++- B0.ml | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++ BRZO | 1 + CHANGES.md | 4 +-- README.md | 24 ++++++++---------- doc/index.mld | 6 +---- opam | 30 +++++++++++++++++------ 8 files changed, 105 insertions(+), 34 deletions(-) create mode 100644 B0.ml create mode 100644 BRZO diff --git a/.gitignore b/.gitignore index f854d6d..f6c8eb3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ _b0 _build tmp -*~ -\#*# -*.native -*.byte *.install \ No newline at end of file diff --git a/.merlin b/.merlin index f072738..6b703ba 100644 --- a/.merlin +++ b/.merlin @@ -1,3 +1,4 @@ +PKG b0.kit S src S test -B _build/** \ No newline at end of file +B _b0/** \ No newline at end of file diff --git a/B0.ml b/B0.ml new file mode 100644 index 0000000..35be707 --- /dev/null +++ b/B0.ml @@ -0,0 +1,67 @@ +open B0_kit.V000 +open B00_std + +(* OCaml library names *) + +let react = B0_ocaml.libname "react" +let react_top = B0_ocaml.libname "react.top" + +let unix = B0_ocaml.libname "unix" +let compiler_libs_toplevel = B0_ocaml.libname "compiler-libs.toplevel" + +(* Libraries *) + +let react_lib = + let srcs = Fpath.[ `File (v "src/react.mli"); `File (v "src/react.ml") ] in + let requires = [] in + B0_ocaml.lib react ~doc:"The react library" ~srcs ~requires + +let react_top_lib = + let srcs = Fpath.[ `File (v "src/react_top.ml") ] in + let requires = [compiler_libs_toplevel] in + let doc = "The react toplevel support library" in + B0_ocaml.lib react_top ~doc ~srcs ~requires + +(* Tests *) + +let test_exe ?(requires = []) src ~doc = + let src = Fpath.v src in + let srcs = Fpath.[`File src] in + let meta = B0_meta.(empty |> tag test) in + let requires = react :: requires in + B0_ocaml.exe (Fpath.basename ~no_ext:true src) ~srcs ~doc ~meta ~requires + +let test = test_exe "test/test.ml" ~doc:"Test suite" +let clock = + test_exe "test/clock.ml" ~doc:"Reactive clock example" ~requires:[unix] + +let breakout = + test_exe "test/breakout.ml" ~doc:"Breakout game example" ~requires:[unix] + +(* Packs *) + +let default = + let meta = + let open B0_meta in + empty + |> tag B0_opam.tag + |> add authors ["The react programmers"] + |> add maintainers ["Daniel Bünzli "] + |> add homepage "https://erratique.ch/software/react" + |> add online_doc "https://erratique.ch/software/react/doc/" + |> add licenses ["ISC"] + |> add repo "git+https://erratique.ch/repos/react.git" + |> add issues "https://github.com/dbuenzli/react/issues" + |> add description_tags + ["reactive"; "declarative"; "signal"; "event"; "frp"; "org:erratique"] + |> add B0_opam.Meta.depends + [ "ocaml", {|>= "4.08.0"|}; + "ocamlfind", {|build|}; + "ocamlbuild", {|build|}; + "topkg", {|build & >= "1.0.3"|}; + ] + |> add B0_opam.Meta.build + {|[["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%"]]|} + in + B0_pack.v "default" ~doc:"react package" ~meta ~locked:true @@ + B0_unit.list () diff --git a/BRZO b/BRZO new file mode 100644 index 0000000..5a47b6b --- /dev/null +++ b/BRZO @@ -0,0 +1 @@ +(srcs-x pkg) \ No newline at end of file diff --git a/CHANGES.md b/CHANGES.md index 1fbeef9..a8e5456 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,7 +1,7 @@ -- Require OCaml >= 4.05. -- Handle deprecation of `Pervasives`. +- Require OCaml 4.08. +- Handle deprecation of `Pervasives` (and thus support OCaml 5.00) v1.2.1 2017-03-16 La Forclaz (VS) --------------------------------- diff --git a/README.md b/README.md index f5bcb80..506cda3 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ React — Declarative events and signals for OCaml -------------------------------------------------------------------------------- +================================================ Release %%VERSION%% React is an OCaml module for functional reactive programming (FRP). It @@ -10,11 +10,9 @@ signal, it lets the client chooses the concrete timeline. React is made of a single, independent, module and distributed under the ISC license. -Home page: http://erratique.ch/software/react -Contact: Daniel Bünzli `` +Homepage: - -## Installation +# Installation React can be installed with `opam`: @@ -23,21 +21,19 @@ React can be installed with `opam`: If you don't use `opam` consult the [`opam`](opam) file for build instructions. +# Documentation -## Documentation - -The documentation and API reference is automatically generated by -`ocamldoc` from the interfaces. It can be consulted [online][3] -and there is a generated version in the `doc` directory of the -distribution. +The documentation and API reference is automatically generated by from +the source interfaces. It can be consulted [online][doc] or via `odig +doc react`. -[3]: http://erratique.ch/software/react/doc/React +[doc]: http://erratique.ch/software/react/doc/ -## Sample programs +# Sample programs If you installed React with `opam` sample programs are located in -the directory `opam config var react:doc`. +the directory `opam var react:doc`. In the distribution sample programs are located in the `test` directory of the distribution. They can be built with: diff --git a/doc/index.mld b/doc/index.mld index f5a0548..088b2a3 100644 --- a/doc/index.mld +++ b/doc/index.mld @@ -5,8 +5,4 @@ provides support to program with time varying values : declarative events and signals. React doesn't define any primitive event or signal, it lets the client chooses the concrete timeline. -{1:api API} - -{!modules: -React -} +{!modules: React } diff --git a/opam b/opam index 506e277..f1141aa 100644 --- a/opam +++ b/opam @@ -1,16 +1,30 @@ opam-version: "2.0" +name: "react" +synopsis: "Declarative events and signals for OCaml" +description: """\ +Release %%VERSION%% + +React is an OCaml module for functional reactive programming (FRP). It +provides support to program with time varying values : declarative +events and signals. React doesn't define any primitive event or +signal, it lets the client chooses the concrete timeline. + +React is made of a single, independent, module and distributed under +the ISC license. + +Homepage: """ maintainer: "Daniel Bünzli " +authors: "The react programmers" +license: "ISC" +tags: ["reactive" "declarative" "signal" "event" "frp" "org:erratique"] homepage: "https://erratique.ch/software/react" -authors: ["The react programmers"] -doc: "https://erratique.ch/software/react/doc/React" -dev-repo: "git+https://erratique.ch/repos/react.git" +doc: "https://erratique.ch/software/react/doc/" bug-reports: "https://github.com/dbuenzli/react/issues" -tags: [ "reactive" "declarative" "signal" "event" "frp" "org:erratique" ] -license: "ISC" depends: [ + "ocaml" {>= "4.08.0"} "ocamlfind" {build} "ocamlbuild" {build} - "topkg" {build & >= "1.0.1"} + "topkg" {build & >= "1.0.3"} ] -available: [ ocaml-version >= "4.05.0" ] -build: [[ "ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{pinned}%" ]] \ No newline at end of file +build: ["ocaml" "pkg/pkg.ml" "build" "--dev-pkg" "%{dev}%"] +dev-repo: "git+https://erratique.ch/repos/react.git"