[d7acd89] | 1 | #! /bin/sh |
---|
[ae1309f] | 2 | |
---|
[088d34f] | 3 | # This script automates most of the process on making a new release. |
---|
| 4 | |
---|
[098acb1] | 5 | set -e |
---|
| 6 | |
---|
[ae1309f] | 7 | rel=yes |
---|
[e66be9a] | 8 | if test x"$1" = x-t ; then |
---|
[ae1309f] | 9 | rel= |
---|
[f30265a0] | 10 | shift |
---|
[d7acd89] | 11 | fi |
---|
[dd7674d] | 12 | |
---|
[ae1309f] | 13 | if test x"$rel" = xyes ; then |
---|
[9d5aa63] | 14 | # Check there are no uncommitted changes. |
---|
| 15 | if git commit -a --dry-run >/dev/null 2>/dev/null ; then |
---|
| 16 | echo 'There are uncommitted changes - please rectify' |
---|
[d2980d2] | 17 | echo 'If you just want to test, run with option -t' |
---|
| 18 | exit 1 |
---|
| 19 | fi |
---|
[098acb1] | 20 | |
---|
[d2980d2] | 21 | test ! -f Makefile || make distclean |
---|
| 22 | cp -u /usr/share/misc/config.guess . |
---|
| 23 | cp -u /usr/share/misc/config.sub . |
---|
[f5baa8c] | 24 | mv INSTALL INSTALL.keep |
---|
[d2980d2] | 25 | autoreconf --force -i |
---|
[f5baa8c] | 26 | mv INSTALL.keep INSTALL |
---|
[d2980d2] | 27 | ./configure CC=gcc CXX=g++ |
---|
[148c993] | 28 | # Don't error out on new GCC8 and GCC9 warnings for now. |
---|
| 29 | make CFLAGS='-Werror' CXXFLAGS='-Werror -Wno-error=cast-function-type -Wno-error=deprecated-copy -Wno-error=ignored-qualifiers' |
---|
[8ea94ea] | 30 | VALGRIND=valgrind make distcheck VERBOSE=1 |
---|
[f78ad72] | 31 | else |
---|
[d2980d2] | 32 | make dist |
---|
[e719df1] | 33 | fi |
---|
[098acb1] | 34 | |
---|
[d2980d2] | 35 | # Perform mingw build on a clean unpacked source tree from the release tarball |
---|
| 36 | # so that (a) we don't need to "make distclean" on the source tree and (b) we |
---|
| 37 | # ensure that any files required to build the mingw version and installer |
---|
| 38 | # package are actually shipped in the source tarball. |
---|
[a6bb1fa6] | 39 | tarball=`ls -1t survex-1*.tar.gz|head -n1` |
---|
[d2980d2] | 40 | tardir=`basename "$tarball" .tar.gz` |
---|
| 41 | rm -rf "$tardir" |
---|
| 42 | tar xf "$tarball" |
---|
| 43 | cd "$tardir" |
---|
[098acb1] | 44 | |
---|
[0fd6750] | 45 | test -n "$build_platform" || build_platform=`sh config.guess` |
---|
| 46 | SAVE_PATH=$PATH |
---|
[d380cd6] | 47 | for wxc in \ |
---|
[b1c66e1] | 48 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.2 \ |
---|
[6632e47] | 49 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.1 \ |
---|
[bd285e5a] | 50 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.0 \ |
---|
[a989777] | 51 | /usr/i586-mingw32msvc/lib/wx/config/i586-mingw32msvc-msw-unicode-static-3.0 \ |
---|
[d380cd6] | 52 | "" ; do |
---|
| 53 | if test -z "$wxc" ; then |
---|
| 54 | echo "wx-config for mingw not found" >&2 |
---|
| 55 | exit 1 |
---|
| 56 | fi |
---|
| 57 | if test -x "$wxc" ; then |
---|
| 58 | CC=`$wxc --cc` |
---|
| 59 | CXX=`$wxc --cxx` |
---|
| 60 | break |
---|
| 61 | fi |
---|
| 62 | done |
---|
[bd285e5a] | 63 | host=mingw |
---|
[d380cd6] | 64 | case $CC in |
---|
[bd285e5a] | 65 | *i686-w64-mingw32-gcc) |
---|
| 66 | # debian mingw package |
---|
| 67 | host=i686-w64-mingw32 |
---|
| 68 | ;; |
---|
[d380cd6] | 69 | *i586-mingw32msvc-gcc) |
---|
| 70 | # debian mingw32 package |
---|
[bd285e5a] | 71 | host=i586-mingw32msvc |
---|
[d380cd6] | 72 | ;; |
---|
| 73 | *i386-mingw32msvc-gcc) |
---|
| 74 | # debian mingw32 package |
---|
[bd285e5a] | 75 | host=i386-mingw32msvc |
---|
[d380cd6] | 76 | ;; |
---|
| 77 | esac |
---|
[bd285e5a] | 78 | PATH=/usr/$host/bin:$PATH |
---|
[d380cd6] | 79 | |
---|
[d2980d2] | 80 | # Passing -Werror to configure causes AC_CHECK_FUNCS to fail, so pass it to |
---|
| 81 | # make instead. |
---|
[2e24435] | 82 | cross_pkg_config_path=`echo "$wxc"|sed 's,/lib/.*,/lib/pkgconfig,'` |
---|
| 83 | PKG_CONFIG_PATH=$cross_pkg_config_path \ |
---|
| 84 | PKG_CONFIG_LIBDIR=$cross_pkg_config_path \ |
---|
| 85 | ./configure --host="$host" --build="$build_platform" WX_CONFIG="$wxc" \ |
---|
| 86 | CC="$CC" CXX="$CXX" CXXFLAGS="-g -O2 -fno-strict-aliasing -Werror" \ |
---|
[2981264] | 87 | LDFLAGS='-s -static' LIBS='-lsqlite3 -lstdc++' |
---|
[79b271b] | 88 | make CFLAGS='-g -O2 -Werror' |
---|
[0fd6750] | 89 | make mingw_iss |
---|
| 90 | PATH=$SAVE_PATH |
---|
| 91 | |
---|
[d2980d2] | 92 | mv survex-win32-*.exe .. |
---|
| 93 | cd .. |
---|
| 94 | |
---|
| 95 | if test x"$rel" = xyes ; then |
---|
| 96 | rm -rf "$tardir" |
---|
[004b1c2] | 97 | else |
---|
| 98 | exit 0 |
---|
[d2980d2] | 99 | fi |
---|
[7b12c6d] | 100 | |
---|
[9c9fd6b] | 101 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile` |
---|
[8430216] | 102 | FILES="survex-$VERSION.tar.gz survex-win32-$VERSION.exe" |
---|
[f4671eb] | 103 | echo "SHA256 checksums:" |
---|
| 104 | sha256sum $FILES |
---|
[8430216] | 105 | echo |
---|
| 106 | |
---|
[179a57b] | 107 | for f in $FILES ; do |
---|
[201310c] | 108 | gpg --detach-sign --armour "$f" |
---|
[179a57b] | 109 | FILES="$FILES $f.asc" |
---|
| 110 | done |
---|
| 111 | |
---|
[8430216] | 112 | echo "To tag this release and upload it to the webserver, run:" |
---|
[dc3e0c1] | 113 | echo git tag -s -m"'Survex $VERSION'" "v$VERSION" |
---|
[e11c235] | 114 | |
---|
[f4671eb] | 115 | HOST=thyestes.tartarus.org |
---|
[e11c235] | 116 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION" |
---|
[8430216] | 117 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION" |
---|