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 dune, upgrade opam metadata and remove unused code #14

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
_build/
*.native
*.byte
src/.merlin
tests/.merlin
ocplib-endian.install
.merlin
*.install
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.t
script: bash -ex .travis-opam.sh
env:
- OCAML_VERSION=latest TESTS=true PACKAGE=ocplib-endian
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line should be removed since ocaml-ci-scripts removed the support for "latest" version.

- OCAML_VERSION=4.07 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.06 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.05 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.04 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.03 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.02 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.01 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=4.00 TESTS=true PACKAGE=ocplib-endian
- OCAML_VERSION=3.12 TESTS=true PACKAGE=ocplib-endian
os:
- linux
- osx
8 changes: 8 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.2
---

* Port to Dune from jbuilder (@avsm)
* Upgrade opam metadata to 2.0 format (@avsm)
* Remove code for OCaml <4.01 support, as the minimum
supported version is now OCaml 4.02+ (@avsm)

1.1
---------------

Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
.PHONY: all clean test doc

all:
dune build

clean:
dune clean

test:
dune runtest --profile=release

doc:
dune build @doc
45 changes: 0 additions & 45 deletions _tags

This file was deleted.

2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 1.0)
(name ocplib-endian)
23 changes: 10 additions & 13 deletions ocplib-endian.opam
Original file line number Diff line number Diff line change
@@ -1,30 +1,27 @@
opam-version: "1.2"
opam-version: "2.0"
name: "ocplib-endian"
version: "1.1"
descr: """
Optimised functions to read and write int16/32/64 from strings and bigarrays, based on new primitives added in version 4.01

synopsis: "Optimised functions to read and write int16/32/64 from strings and bigarrays"
description: """
The library implements three modules:
* [EndianString](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianString.mli) works directly on strings, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBytes](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBytes.mli) works directly on bytes, and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBigstring](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBigstring.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts;
* [EndianBigstring](https://github.com/OCamlPro/ocplib-endian/blob/master/src/endianBigstring.mli) works on bigstrings (Bigarrays of chars), and provides submodules BigEndian and LittleEndian, with their unsafe counter-parts.
"""
maintainer: "pierre.chambart@ocamlpro.com"
authors: "Pierre Chambart"
homepage: "https://github.com/OCamlPro/ocplib-endian"
bug-reports: "https://github.com/OCamlPro/ocplib-endian/issues"
depends: [
"base-bytes"
"cppo" {>= "1.1.0"}
"jbuilder" {build}
"ocaml" {>= "4.02.3"}
"cppo" {>= "1.1.0" & build}
"dune" {build & >= "1.0"}
]
build: [
["jbuilder" "build" "--only-packages" "ocplib-endian" "--root" "." "-j" jobs "@install"]
]
build-test: [
["jbuilder" "runtest" "--only-packages" "ocplib-endian" "--root" "." "-j" jobs]
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
dev-repo: "git+https://github.com/OCamlPro/ocplib-endian.git"
url {
src: "https://github.com/OCamlPro/ocplib-endian/archive/1.0.tar.gz"
}
}
28 changes: 0 additions & 28 deletions src/be_ocaml_400.ml

This file was deleted.

2 changes: 2 additions & 0 deletions src/common.ml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[@@@warning "-32"]

let sign8 v =
(v lsl ( Sys.word_size - 9 )) asr ( Sys.word_size - 9 )

Expand Down
79 changes: 0 additions & 79 deletions src/common_400.cppo.ml

This file was deleted.

75 changes: 75 additions & 0 deletions src/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
(rule
(targets endianString.mli)
(deps (:< endianString.cppo.mli))
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets endianString.ml)
(deps
(:< endianString.cppo.ml)
common.ml
common_401.ml)
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets endianBytes.mli)
(deps
(:< endianBytes.cppo.mli))
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets endianBytes.ml)
(deps
(:< endianBytes.cppo.ml)
common.ml
common_401.ml)
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets endianBigstring.mli)
(deps
(:< endianBigstring.cppo.mli))
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets endianBigstring.ml)
(deps
(:< endianBigstring.cppo.ml)
common.ml
common_401.ml)
(action
(run %{bin:cppo} %{<} -o %{targets})))

(rule
(targets common_401.ml)
(deps
(:< common_401.cppo.ml)
be_ocaml_401.ml
le_ocaml_401.ml
ne_ocaml_401.ml
common_float.ml)
(action
(run %{bin:cppo} %{<} -o %{targets})))

(library
(name ocplib_endian)
(public_name ocplib-endian)
(synopsis "Optimised functions to read and write int16/32/64 from strings and bytes")
(wrapped false)
(ocamlopt_flags (:standard -inline 1000))
(modules endianString endianBytes)
(libraries bytes))

(library
(name ocplib_endian_bigstring)
(public_name ocplib-endian.bigstring)
(synopsis "Optimised functions to read and write int16/32/64 from bigarrays")
(wrapped false)
(modules endianBigstring)
(ocamlopt_flags (:standard -inline 1000))
(libraries ocplib_endian bigarray bytes))
8 changes: 0 additions & 8 deletions src/endianBigstring.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,6 @@ let unsafe_set_char (s:bigstring) off v =

#include "common.ml"

#if OCAML_VERSION >= (4, 01, 0)

external unsafe_get_16 : bigstring -> int -> int = "%caml_bigstring_get16u"
external unsafe_get_32 : bigstring -> int -> int32 = "%caml_bigstring_get32u"
external unsafe_get_64 : bigstring -> int -> int64 = "%caml_bigstring_get64u"
Expand All @@ -112,9 +110,3 @@ external set_32 : bigstring -> int -> int32 -> unit = "%caml_bigstring_set32"
external set_64 : bigstring -> int -> int64 -> unit = "%caml_bigstring_set64"

#include "common_401.ml"

#else

#include "common_400.ml"

#endif
2 changes: 0 additions & 2 deletions src/endianBigstring.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ module LittleEndian_unsafe : sig

end

#if OCAML_VERSION >= (4, 00, 0)
module NativeEndian : sig
(** Functions reading according to machine endianness *)

Expand All @@ -127,4 +126,3 @@ module NativeEndian_unsafe : sig
include EndianBigstringSig

end
#endif
8 changes: 0 additions & 8 deletions src/endianBytes.cppo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,6 @@ let unsafe_set_char (s:Bytes.t) off v =

#include "common.ml"

#if OCAML_VERSION >= (4, 01, 0)

external unsafe_get_16 : Bytes.t -> int -> int = "%caml_string_get16u"
external unsafe_get_32 : Bytes.t -> int -> int32 = "%caml_string_get32u"
external unsafe_get_64 : Bytes.t -> int -> int64 = "%caml_string_get64u"
Expand All @@ -108,9 +106,3 @@ external set_32 : Bytes.t -> int -> int32 -> unit = "%caml_string_set32"
external set_64 : Bytes.t -> int -> int64 -> unit = "%caml_string_set64"

#include "common_401.ml"

#else

#include "common_400.ml"

#endif
2 changes: 0 additions & 2 deletions src/endianBytes.cppo.mli
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ module LittleEndian_unsafe : sig

end

#if OCAML_VERSION >= (4, 00, 0)
module NativeEndian : sig
(** Functions reading according to machine endianness *)

Expand All @@ -124,4 +123,3 @@ module NativeEndian_unsafe : sig
include EndianBytesSig

end
#endif
Loading