1
0

release.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/sh
  2. set -eux
  3. V=$1
  4. D=$(realpath "$0")
  5. D=$(dirname "$D")
  6. cd "$D"
  7. export TZ=UTC
  8. mkdir -p build
  9. export WINEARCH=win64
  10. export WINEPREFIX=$(realpath ./build/winepfx)
  11. OPATH=$PATH
  12. rm -rf out
  13. mkdir -p out
  14. # prepare source
  15. SV=mkp224o-$V
  16. SO=$(realpath ./out/$SV)
  17. git clone ../../ "$SO"
  18. git -C ../../ diff | git -C "$SO" apply --allow-empty
  19. cd "$SO"
  20. rm -rf .git
  21. ./autogen.sh
  22. rm -rf *.cache
  23. echo v$V > version.txt
  24. cd ../..
  25. # build windows bins
  26. B=$(realpath ./build)
  27. for w in x86_64 i686
  28. do
  29. cd "$B"
  30. rm -rf $w
  31. mkdir $w
  32. cd $w
  33. p=$w-w64-mingw32
  34. case $w in
  35. i686)
  36. CFLAGS="-march=i686 -mtune=generic"
  37. W=32
  38. ;;
  39. x86_64)
  40. CFLAGS="-march=x86-64 -mtune=generic"
  41. W=64
  42. ;;
  43. esac
  44. CFLAGS="-O3 $CFLAGS -fomit-frame-pointer"
  45. export PATH=/usr/$p/bin:$OPATH
  46. ../../out/$SV/configure --enable-regex --enable-donna --with-pcre2="/usr/$p/bin/pcre2-config" CC="${p}-gcc" CFLAGS="$CFLAGS"
  47. make main util
  48. $p-strip mkp224o.exe
  49. $p-strip calcest.exe
  50. cd ..
  51. BO="$SO-w$W"
  52. mkdir -p "$BO"
  53. cp $w/mkp224o.exe "$BO/"
  54. cp $w/calcest.exe "$BO/"
  55. cd "$BO"
  56. $p-ldd mkp224o.exe | grep -v 'not found' | awk '{print $3}' | xargs -r cp -v -t ./
  57. done
  58. export PATH=$OPATH
  59. # compress stuff
  60. cd "$D/out"
  61. tar --portability --no-acls --no-selinux --no-xattrs --owner root:0 --group=root:0 --sort=name -c -f $SV-src.tar $SV
  62. zopfli -i100 -c $SV-src.tar > $SV-src.tar.gz
  63. zstd -19 -f $SV-src.tar -o $SV-src.tar.zst
  64. rm $SV-src.tar
  65. zip -9 -X -r $SV-w32.zip $SV-w32
  66. zip -9 -X -r $SV-w64.zip $SV-w64