do 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh -e
  2. okabi | (
  3. while read abi
  4. do
  5. rm -f randombytes.o randombytes.h
  6. (
  7. echo devurandom
  8. ) | (
  9. while read n
  10. do
  11. okc-$abi | (
  12. while read c
  13. do
  14. echo "=== `date` === Trying $n.c with $c..." >&2
  15. rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c
  16. cp $n.c randombytes-impl.c || continue
  17. cp $n.h randombytes-impl.h || continue
  18. $c -c randombytes-impl.c || continue
  19. $c -o test test.c randombytes-impl.o || continue
  20. ./test || continue
  21. echo "=== `date` === Success. Using $n.c." >&2
  22. mkdir -p lib/$abi
  23. mv randombytes-impl.o lib/$abi/randombytes.o
  24. mkdir -p include/$abi
  25. mv randombytes-impl.h include/$abi/randombytes.h
  26. exit 0
  27. done
  28. exit 111
  29. ) && exit 0
  30. done
  31. exit 111
  32. ) || (
  33. echo ===== Giving up. >&2
  34. rm -f test randombytes-impl.o randombytes-impl.h randombytes-impl.c
  35. exit 111
  36. ) || exit 111
  37. done
  38. exit 0
  39. ) || exit 111