build.sh 863 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. # -*- coding: utf-8 -*-
  3. basedir="$(realpath "$0" | xargs dirname)"
  4. info()
  5. {
  6. echo "--- $*"
  7. }
  8. error()
  9. {
  10. echo "=== ERROR: $*" >&2
  11. }
  12. warning()
  13. {
  14. echo "=== WARNING: $*" >&2
  15. }
  16. die()
  17. {
  18. error "$*"
  19. exit 1
  20. }
  21. [ -x "$basedir/setup.py" -a -f "$basedir/Cargo.toml" ] ||\
  22. die "basedir sanity check failed"
  23. cd "$basedir" || die "cd basedir failed."
  24. export CFLAGS="-O3 -pipe"
  25. export CPPFLAGS=
  26. export CXXFLAGS=
  27. python3 ./setup.py build || die "Python build failed."
  28. cargo build || die "Cargo build (debug) failed."
  29. cargo test || die "Cargo test failed."
  30. cargo auditable build --release || die "Cargo build (release) failed."
  31. cargo audit bin --deny warnings \
  32. target/release/cms-backd \
  33. target/release/cms-cgi \
  34. target/release/cms-fsd \
  35. target/release/cms-postd \
  36. || die "Cargo audit failed."
  37. # vim: ts=4 sw=4 expandtab