makerelease.sh 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/sh
  2. srcdir="$(dirname "$0")"
  3. [ "$(echo "$srcdir" | cut -c1)" = '/' ] || srcdir="$PWD/$srcdir"
  4. srcdir="$srcdir/.."
  5. die() { echo "$*"; exit 1; }
  6. # Import the makerelease.lib
  7. # http://bues.ch/gitweb?p=misc.git;a=blob_plain;f=makerelease.lib;hb=HEAD
  8. for path in $(echo "$PATH" | tr ':' ' '); do
  9. [ -f "$MAKERELEASE_LIB" ] && break
  10. MAKERELEASE_LIB="$path/makerelease.lib"
  11. done
  12. [ -f "$MAKERELEASE_LIB" ] && . "$MAKERELEASE_LIB" || die "makerelease.lib not found."
  13. hook_get_version()
  14. {
  15. local file="$1/awlsim/common/version.py"
  16. local maj="$(cat "$file" | grep -e 'VERSION_MAJOR =' | head -n1 | awk '{print $3;}')"
  17. local min="$(cat "$file" | grep -e 'VERSION_MINOR =' | head -n1 | awk '{print $3;}')"
  18. local ext="$(cat "$file" | grep -e 'VERSION_EXTRA =' | head -n1 | awk '{print $3;}' | cut -d'"' -f2)"
  19. version="${maj}.${min}${ext}"
  20. }
  21. hook_post_checkout()
  22. {
  23. info "Pulling in git submodules"
  24. git submodule update --init submodules/pyprofibus
  25. info "Removing version control files"
  26. default_hook_post_checkout "$@"
  27. rm "$1"/maintenance/update-submodules
  28. info "Checking signatures"
  29. for f in "$1"/progs/putty/*/*.gpg; do
  30. gpg --verify "$f" "$(dirname "$f")/$(basename "$f" .gpg)" ||\
  31. die "Signature check failed."
  32. done
  33. info "Unpacking PuTTY"
  34. for f in "$1"/progs/putty/*/*.zip; do
  35. 7z x -o"$(dirname "$f")/$(basename "$f" .zip)" "$f" ||\
  36. die "Unzip failed"
  37. rm "$f" "$f".gpg ||\
  38. die "Failed to remove archives"
  39. done
  40. }
  41. hook_testbuild()
  42. {
  43. CFLAGS=-O0 CPPFLAGS= CXXFLAGS=-O0 LDFLAGS= \
  44. default_hook_testbuild "$@"
  45. }
  46. hook_regression_tests()
  47. {
  48. default_hook_regression_tests "$@"
  49. # Run selftests
  50. sh "$1/tests/run.sh" -j 0
  51. }
  52. hook_pre_archives()
  53. {
  54. local archive_dir="$1"
  55. local checkout_dir="$2"
  56. default_hook_pre_archives "$@"
  57. info "Building PiLC firmware"
  58. local raspihat_fw_dir="$checkout_dir/pilc/raspi-hat/firmware"
  59. for target in all clean; do
  60. CFLAGS= CPPFLAGS= CXXFLAGS= LDFLAGS= \
  61. make -C "$raspihat_fw_dir" $target
  62. done
  63. }
  64. export AWLSIM_FULL_BUILD=1
  65. export AWLSIM_CYTHON=1
  66. export AWLSIM_CYTHON_PARALLEL=1
  67. project=awlsim
  68. default_archives=py-sdist-bz2
  69. makerelease "$@"