Skip to content

Commit 80b7b4b

Browse files
committed
dune'd
1 parent 9d46d4c commit 80b7b4b

33 files changed

+132
-376
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@ _build
22
*.install
33
*.native
44
*.byte
5+
.merlin
56

67
*~
78
\.\#*
89
\#*#
910

1011
gmon.out
12+
.gdb_history
1113
*.prof
14+
perf.data*
15+
*.json
1216
rondom

.merlin

Lines changed: 0 additions & 8 deletions
This file was deleted.

.ocamlinit

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#require "cstruct, zarith, sexplib"
2-
#directory "_build/src"
3-
#load "nocrypto.cma"
4-
5-
(* #require "oUnit" *)
6-
(* #directory "_build/tests" *)
7-
(* #load "testlib.cma" *)
1+
#directory "_build/default/src"
2+
#directory "_build/default/src/.nocrypto.objs/byte"
3+
#directory "_build/default/unix"
4+
#directory "_build/default/unix/.nocrypto_entropy_unix.objs/byte"
5+
#directory "_build/default/lwt"
6+
#directory "_build/default/lwt/.nocrypto_entropy_lwt.objs/byte"
87

9-
#directory "_build/unix"
8+
#require "cstruct, ocplib-endian, zarith"
9+
#load "nocrypto.cma"
1010
#load "nocrypto_entropy_unix.cmo"
11+
#load "nocrypto_entropy_lwt.cmo"
1112

1213
open Nocrypto
1314
let _ = Nocrypto_entropy_unix.initialize ()

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ env:
77
- UPDATE_GCC_BINUTILS=1
88
- TESTS=true
99
matrix:
10-
- OCAML_VERSION=4.02
1110
- OCAML_VERSION=4.03
1211
- OCAML_VERSION=4.04
1312
- OCAML_VERSION=4.05
@@ -17,5 +16,6 @@ env:
1716
- OCAML_VERSION=4.06 DEPOPTS="lwt cstruct-lwt"
1817
- OCAML_VERSION=4.04 DEPOPTS="mirage-xen"
1918
- OCAML_VERSION=4.06 DEPOPTS="mirage-solo5 mirage-entropy"
19+
- OCAML_VERSION=4.07
2020
notifications:
2121
email: false

README.md

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,8 @@ delegating to AES-NI.
2020
## Build
2121

2222
```bash
23-
./pkg/pkg.ml build
24-
--with-unix BOOL
25-
--with-lwt BOOL
26-
--xen BOOL
27-
--freestanding BOOL
28-
29-
./pkg/pkg.ml test
23+
dune build
24+
dune runtest
3025
```
3126

3227
## FAQ
@@ -59,11 +54,12 @@ Program terminated with signal SIGILL, Illegal instruction.
5954
autodetection yet. You compiled the library with acceleration, but you are using
6055
it on a machine that does not support it.
6156

62-
`pkg/pkg.ml build --accelerate false` force-disables non-portable code.
57+
The environment variable `NOCRYPTO_ACCELERATE` can be used to override
58+
detection:
6359

64-
`pkg/pkg.ml build --accelerate true` force-enables non-portable code.
60+
- `NOCRYPTO_ACCELERATE=false dune build` force-disables non-portable code.
61+
- `NOCRYPTO_ACCELERATE=true dune build` force-enables non-portable code.
62+
- Otherwise, it matches the capabilities of the build machine.
6563

66-
The flag can also be set via the `NOCRYPTO_ACCELERATE` environment variable.
67-
When unset, it maches the capabilities of the build machine.
6864

6965
[![Build Status](https://travis-ci.org/mirleft/ocaml-nocrypto.svg?branch=master)](https://travis-ci.org/mirleft/ocaml-nocrypto)

_tags

Lines changed: 0 additions & 26 deletions
This file was deleted.

bench/dune

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
(executables
2+
(names speed)
3+
(modules speed)
4+
(libraries nocrypto))

bench/speed.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ let throughput title f =
5050
sizes |> List.iter @@ fun size ->
5151
Gc.full_major () ;
5252
let (iters, time, bw) = burn f size in
53-
Printf.printf " % 5d: %04.f MB/s (%d iters in %.03f s)\n%!"
53+
Printf.printf " % 5d: %04f MB/s (%d iters in %.03f s)\n%!"
5454
size (bw /. mb) iters time
5555

5656
let bm name f = (name, fun () -> f name)

build

Lines changed: 0 additions & 9 deletions
This file was deleted.

config/cfg.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
let evar = "NOCRYPTO_ACCELERATE"
2+
let needs = [`SSSE3; `AES; `PCLMULQDQ]
3+
let flags = ["-DACCELERATE"; "-mssse3"; "-maes"; "-mpclmul"]
4+
5+
let _ =
6+
let auto = match Cpuid.supports needs with Ok true -> flags | _ -> [] in
7+
let fs = match Sys.getenv evar with
8+
"true" -> flags
9+
| "false" -> []
10+
| _ -> auto
11+
| exception Not_found -> auto in
12+
Format.(printf "(@[%a@])%!" (fun ppf -> List.iter (fprintf ppf "%s@ ")) fs)

0 commit comments

Comments
 (0)