Changes to update Tomato RAF.
[tomato.git] / release / src / router / dnscrypt / src / libnacl / randombytes / do
blobb2db184aeb178c2976bcb597e901cd63f7cd6972
1 #!/bin/sh -e
3 okabi | (
4 while read abi
5 do
7 rm -f randombytes.o randombytes.h
10 echo devurandom
11 ) | (
12 while read n
14 okc-$abi | (
15 while read c
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 [ -r /dev/urandom ] || 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
41 done
42 exit 0
43 ) || exit 111