summaryrefslogtreecommitdiff
path: root/nacl/randombytes/do
diff options
context:
space:
mode:
Diffstat (limited to 'nacl/randombytes/do')
-rw-r--r--nacl/randombytes/do43
1 files changed, 43 insertions, 0 deletions
diff --git a/nacl/randombytes/do b/nacl/randombytes/do
new file mode 100644
index 00000000..42586282
--- /dev/null
+++ b/nacl/randombytes/do
@@ -0,0 +1,43 @@
1#!/bin/sh -e
2
3okabi | (
4 while read abi
5 do
6
7 rm -f randombytes.o randombytes.h
8
9 (
10 echo devurandom
11 ) | (
12 while read n
13 do
14 okc-$abi | (
15 while read c
16 do
17 echo "=== `date` === Trying $n.c with $c..." >&2
18 rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c
19 cp $n.c randombytes-impl.c || continue
20 cp $n.h randombytes-impl.h || continue
21 $c -c randombytes-impl.c || continue
22 $c -o test test.c randombytes-impl.o || continue
23 ./test || continue
24 echo "=== `date` === Success. Using $n.c." >&2
25 mkdir -p lib/$abi
26 mv randombytes-impl.o lib/$abi/randombytes.o
27 mkdir -p include/$abi
28 mv randombytes-impl.h include/$abi/randombytes.h
29 exit 0
30 done
31 exit 111
32 ) && exit 0
33 done
34 exit 111
35 ) || (
36 echo ===== Giving up. >&2
37 rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c
38 exit 111
39 ) || exit 111
40
41 done
42 exit 0
43) || exit 111