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

Port to jbuilder #30

Merged
merged 6 commits into from Jun 6, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 1 addition & 5 deletions .gitignore
@@ -1,7 +1,3 @@
_build
.*.swp
setup.data
setup.log
portable.native
*.install
*~
.merlin
5 changes: 0 additions & 5 deletions .merlin

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -18,7 +18,7 @@ addons:
- time
env:
global:
- PINS="mirage-console:. mirage-console-lwt:."
- PINS="mirage-clock:. mirage-clock-lwt:. mirage-clock-unix:. mirage-clock-freestanding:."
- OCAML_VERSION=4.03

matrix:
Expand Down
17 changes: 13 additions & 4 deletions CHANGES.md
@@ -1,19 +1,28 @@
### 1.2.0 (2016-12-21)
v1.3.0
------

* port to Jbuilder

v1.2.0 2016-12-21
-----------------

* import `V1.MCLOCK` and `V1.PCLOCK` from `mirage-types` under `mirage-clock`
and `mirage-clock-lwt`

### 1.1.0 (2015-01-05):
v1.1.0 2015-01-05
-----------------

* xen: pure OCaml implementation of `Clock.gmtime`

### 1.0.0 (2013-12-07):
v1.0.0 2013-12-07
-----------------

* Remove unnecessary cstruct dependency.
* Install ocamlfind packages as `mirage-clock-xen` and `mirage-clock-unix`.
* Fix META file descriptions.
* Add Travis tests.

### 0.9.9 (2013-12-05):
v0.9.9 2013-12-05
-----------------

* Initial public release, based on mirage/mirage-platform#0.9.8
24 changes: 15 additions & 9 deletions Makefile
@@ -1,11 +1,17 @@
all:
ocaml pkg/pkg.ml build -n mirage-clock -q
ocaml pkg/pkg.ml build -n mirage-clock-lwt -q
ocaml pkg/pkg.ml build -n mirage-clock-unix -q
ocaml pkg/pkg.ml build -n mirage-clock-freestanding -q

.PHONY: build clean test

build:
jbuilder build @install

test:
jbuilder runtest

install:
jbuilder install

uninstall:
jbuilder uninstall

clean:
ocaml pkg/pkg.ml clean -n mirage-clock
ocaml pkg/pkg.ml clean -n mirage-clock-lwt
ocaml pkg/pkg.ml clean -n mirage-clock-unix
ocaml pkg/pkg.ml clean -n mirage-clock-freestanding
rm -rf _build *.install
14 changes: 0 additions & 14 deletions _tags

This file was deleted.

16 changes: 16 additions & 0 deletions config/discover.ml
@@ -0,0 +1,16 @@
open Base
open Stdio
module C = Configurator

let write_sexp fn sexp =
Out_channel.write_all fn ~data:(Sexp.to_string sexp)

let () =
C.main ~name:"mirage-clock-unix" (fun c ->
let ccflags =
match C.ocaml_config_var c "system" with
| Some "linux" -> ["-lrt"]
| _ -> [] in
write_sexp "cclib.sexp" (Sexp.List (List.map ~f:(fun x -> Sexp.Atom x) ccflags));
Out_channel.write_all "cclib" ~data:(String.concat ccflags ~sep:" ")
)
10 changes: 10 additions & 0 deletions config/jbuild
@@ -0,0 +1,10 @@
(executables
((names (discover))
(libraries (base stdio configurator))))

(rule
((targets (cclib.sexp cclib))
(deps (discover.exe))
(action (run ${<} -ocamlc ${OCAMLC}))))

(jbuild_version 1)
4 changes: 0 additions & 4 deletions doc/api.odocl

This file was deleted.

6 changes: 6 additions & 0 deletions freestanding/jbuild
@@ -0,0 +1,6 @@
(library
((name mirage_clock_freestanding)
(wrapped false)
(public_name mirage-clock-freestanding)
(libraries (mirage-clock mirage-clock-lwt))
))
2 changes: 0 additions & 2 deletions freestanding/mirage-clock-freestanding.mldylib

This file was deleted.

2 changes: 0 additions & 2 deletions freestanding/mirage-clock-freestanding.mllib

This file was deleted.

1 change: 0 additions & 1 deletion freestanding/mirage-clock.mllib

This file was deleted.

9 changes: 9 additions & 0 deletions lib_test/jbuild
@@ -0,0 +1,9 @@
(executables
((names (portable))
(libraries (lwt.unix mirage-clock-unix))
))

(alias
((name runtest)
(deps (portable.exe))
(action (run ${<}))))
5 changes: 5 additions & 0 deletions lwt/jbuild
@@ -0,0 +1,5 @@
(library
((name mirage_clock_lwt)
(public_name mirage-clock-lwt)
(libraries (mirage-clock lwt))
))
File renamed without changes.
8 changes: 3 additions & 5 deletions mirage-clock-freestanding.opam
Expand Up @@ -8,13 +8,11 @@ license: "ISC"
tags: ["org:mirage"]
depends: [
"ocamlfind" {build}
"ocamlbuild" {build}
"jbuilder" {build & >="1.0+beta8"}
"topkg" {build & >= "0.8.0"}
"topkg-jbuilder" {build}
"mirage-clock" {>= "1.2.0"}
"mirage-clock-lwt" {>= "1.2.0"}
"lwt"
]
build: [
"ocaml" "pkg/pkg.ml" "build"
"--pkg-name" name
"--pinned" "%{pinned}%" ]
build: [["jbuilder" "build" "-p" name "-j" jobs]]
9 changes: 3 additions & 6 deletions mirage-clock-lwt.opam
Expand Up @@ -10,13 +10,10 @@ license: "ISC"
tags: ["org:mirage"]
depends: [
"ocamlfind" {build}
"ocamlbuild" {build}
"jbuilder" {build & >="1.0+beta8"}
"topkg" {build & >= "0.8.0"}
"topkg-jbuilder" {build}
"mirage-clock" {>= "1.2.0"}
"lwt"
]
build: [ "ocaml" "pkg/pkg.ml" "build" "--pkg-name" name "--pinned" "%{pinned}%" ]
build-test: [
[ "ocaml" "pkg/pkg.ml" "build" "--pkg-name" name "--pinned" "%{pinned}%" "--tests" "true" ]
[ "ocaml" "pkg/pkg.ml" "test" "--pkg-name" name ]
]
build: [["jbuilder" "build" "-p" name "-j" jobs]]
14 changes: 6 additions & 8 deletions mirage-clock-unix.opam
Expand Up @@ -11,16 +11,14 @@ tags: ["org:mirage"]

depends: [
"ocamlfind" {build}
"ocamlbuild" {build}
"jbuilder" {build & >="1.0+beta8"}
"topkg" {build & >= "0.8.0"}
"topkg-jbuilder" {build}
"mirage-clock" {>= "1.2.0"}
"mirage-clock-lwt" {>= "1.2.0"}
"lwt"
"configurator" {build}
]
build: [
"ocaml" "pkg/pkg.ml" "build" "-n" name "--pinned" "%{pinned}%" "--tests" "false"
]
build-test: [
[ "ocaml" "pkg/pkg.ml" "build" "-n" name "--pinned" "%{pinned}%" "--tests" "true" ]
[ "ocaml" "pkg/pkg.ml" "test" "-n" name ]
]
build: [["jbuilder" "build" "-p" name "-j" jobs]]
build-test: [["jbuilder" "runtest" "-p" name "-j" jobs ]]

6 changes: 3 additions & 3 deletions mirage-clock.opam
Expand Up @@ -5,13 +5,13 @@ homepage: "https://github.com/mirage/mirage-clock"
bug-reports: "https://github.com/mirage/mirage-clock/issues"
dev-repo: "git://github.com/mirage/mirage-clock"
doc: "https://mirage.github.io/mirage-clock/"

license: "ISC"
tags: ["org:mirage"]
depends: [
"ocamlfind" {build}
"ocamlbuild" {build}
"jbuilder" {build & >="1.0+beta8"}
"topkg" {build & >= "0.8.0"}
"topkg-jbuilder" {build}
"mirage-device" {>= "1.0.0"}
]
build: [ "ocaml" "pkg/pkg.ml" "build" "--pkg-name" name "--pinned" "%{pinned}%" ]
build: [["jbuilder" "build" "-p" name "-j" jobs]]
24 changes: 0 additions & 24 deletions myocamlbuild.ml

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/META

This file was deleted.

8 changes: 0 additions & 8 deletions pkg/META.freestanding

This file was deleted.

3 changes: 0 additions & 3 deletions pkg/META.lwt

This file was deleted.

8 changes: 0 additions & 8 deletions pkg/META.unix

This file was deleted.

43 changes: 1 addition & 42 deletions pkg/pkg.ml
@@ -1,43 +1,2 @@
#!/usr/bin/env ocaml
#use "topfind"
#require "topkg"
open Topkg

let meta_file = Pkg.meta_file ~install:false

let opam_file no_lint name =
Pkg.opam_file ~install:false ~lint_deps_excluding:(Some no_lint) name

let metas = [
meta_file "pkg/META";
meta_file "pkg/META.lwt";
meta_file "pkg/META.unix";
meta_file "pkg/META.freestanding";
]

let opams = [
opam_file ["lwt"; "mirage-clock"; "mirage-clock-lwt"] "mirage-clock.opam";
opam_file ["mirage-device"; "mirage-clock-lwt"] "mirage-clock-lwt.opam";
opam_file ["mirage-device"] "mirage-clock-unix.opam";
opam_file ["mirage-device"] "mirage-clock-freestanding.opam";
]

let () =
Pkg.describe ~metas ~opams "mirage-clock" @@ fun c ->
match Conf.pkg_name c with
| "mirage-clock" ->
Ok [ Pkg.lib "pkg/META";
Pkg.lib ~exts:Exts.interface "src/mirage_clock" ]
| "mirage-clock-lwt" ->
Ok [ Pkg.lib "pkg/META.lwt" ~dst:"META";
Pkg.lib ~exts:Exts.interface "lwt/mirage_clock_lwt" ]
| "mirage-clock-unix" ->
Ok [ Pkg.lib "pkg/META.unix" ~dst:"META";
Pkg.mllib "unix/mirage-clock-unix.mllib";
Pkg.clib "unix/libmirage-clock-unix_stubs.clib";
Pkg.test "lib_test/portable"]
| "mirage-clock-freestanding" ->
Ok [ Pkg.lib "pkg/META.freestanding" ~dst:"META";
Pkg.mllib "freestanding/mirage-clock-freestanding.mllib" ]
| other ->
R.error_msgf "unknown package name: %s" other
#require "topkg-jbuilder.auto"
5 changes: 5 additions & 0 deletions src/jbuild
@@ -0,0 +1,5 @@
(library
((name mirage_clock)
(public_name mirage-clock)
(libraries (mirage-device))
))
File renamed without changes.
9 changes: 9 additions & 0 deletions unix/jbuild
@@ -0,0 +1,9 @@
(library
((name mirage_clock_unix)
(wrapped false)
(public_name mirage-clock-unix)
(libraries (mirage-clock mirage-clock-lwt))
(c_names (clock_stubs))
(c_flags ((:standard \ -Wall -g -O2)))
(c_library_flags (:standard (:include ../config/cclib.sexp)))
))
1 change: 0 additions & 1 deletion unix/libmirage-clock-unix_stubs.clib

This file was deleted.

2 changes: 0 additions & 2 deletions unix/mirage-clock-unix.mldylib

This file was deleted.

2 changes: 0 additions & 2 deletions unix/mirage-clock-unix.mllib

This file was deleted.