Skip to content

Commit

Permalink
Merge pull request #42 from nojb/master
Browse files Browse the repository at this point in the history
Do not export unnecessary symbols + port to dune + Windows fixes
  • Loading branch information
djs55 authored Feb 7, 2020
2 parents cd6d9c7 + 1b059f8 commit db5da34
Show file tree
Hide file tree
Showing 18 changed files with 792 additions and 822 deletions.
12 changes: 6 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
all:
jbuilder build --dev @install
dune build --dev @install

test:
jbuilder runtest
dune runtest

doc:
jbuilder build @doc
dune build @doc

install:
jbuilder install
dune install

uninstall:
jbuilder uninstall
dune uninstall

clean:
jbuilder clean
dune clean

.PHONY: all test doc install uninstall clean
2 changes: 1 addition & 1 deletion bitfn.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static inline uint64_t swap64(uint64_t a)
#include <architecture/byte_order.h>
#elif defined(__FreeBSD__)
#include <sys/endian.h>
#elif WIN32
#elif _WIN32
/* nothing */
#else
#include <endian.h>
Expand Down
7 changes: 7 additions & 0 deletions c_flags.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let flags =
match Sys.win32 with
| true -> "()"
| false -> "(-Wall -O3 -funroll-loops)"

let () =
print_endline flags
13 changes: 13 additions & 0 deletions dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
(rule (with-stdout-to c_flags.sexp (run %{ocaml} %{dep:c_flags.ml})))

(library
(name sha)
(public_name sha)
(synopsis "SHA-1 and SHA-2 family implementations")
(wrapped false)
(modules sha1 sha256 sha512)
(flags -warn-error -3)
(foreign_stubs
(language c)
(flags (:include c_flags.sexp))
(names sha1_stubs sha256_stubs sha512_stubs)))
24 changes: 24 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(lang dune 2.0)

(name sha)

(source (github djs55/ocaml-sha))

(license ISC)

(authors "Vincent Hanquez"
"Thomas Gazagnaire"
"Goswin von Brederlow"
"Eric Cooper"
"Florent Monnier"
"Forrest L Norvell"
"Vincent Bernadoff"
"David Scott")

(maintainers [email protected])

(package
(name sha)
(depends (dune (>= 2.0)) (ounit :with-test)))

(generate_opam_files true)
10 changes: 0 additions & 10 deletions jbuild

This file was deleted.

51 changes: 32 additions & 19 deletions sha.opam
Original file line number Diff line number Diff line change
@@ -1,22 +1,35 @@
opam-version: "1.2"
maintainer: "[email protected]"
authors: [
"Vincent Hanquez" "Thomas Gazagnaire" "Goswin von Brederlow"
"Eric Cooper" "Florent Monnier" "Forrest L Norvell"
"Vincent Bernadoff" "David Scott"
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
maintainer: ["[email protected]"]
authors: [
"Vincent Hanquez"
"Thomas Gazagnaire"
"Goswin von Brederlow"
"Eric Cooper"
"Florent Monnier"
"Forrest L Norvell"
"Vincent Bernadoff"
"David Scott"
]
homepage: "https://github.com/djs55/ocaml-sha"
bug-reports: "https://github.com/djs55/ocaml-sha/issues"
dev-repo: "https://github.com/djs55/ocaml-sha.git"
license: "ISC"

build: [["jbuilder" "build" "-p" name "-j" jobs]]

build-test: [["jbuilder" "runtest" "-p" name]]

license: "ISC"
homepage: "https://github.com/djs55/ocaml-sha"
bug-reports: "https://github.com/djs55/ocaml-sha/issues"
depends: [
"jbuilder" {build & >= "1.0+beta13"}
"ounit" {test}
"dune" {>= "2.0"}
"ounit" {with-test}
]

available: [ ocaml-version >= "4.02.0" ]
build: [
["dune" "subst"] {pinned}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/djs55/ocaml-sha.git"
Loading

0 comments on commit db5da34

Please sign in to comment.