| 1 | #! /bin/sh |
|---|
| 2 | |
|---|
| 3 | # This script automates most of the process on making a new release. |
|---|
| 4 | |
|---|
| 5 | set -e |
|---|
| 6 | |
|---|
| 7 | rel=yes |
|---|
| 8 | if test x"$1" = x-t ; then |
|---|
| 9 | rel= |
|---|
| 10 | shift |
|---|
| 11 | fi |
|---|
| 12 | |
|---|
| 13 | if test x"$rel" = xyes ; then |
|---|
| 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' |
|---|
| 17 | echo 'If you just want to test, run with option -t' |
|---|
| 18 | exit 1 |
|---|
| 19 | fi |
|---|
| 20 | |
|---|
| 21 | test ! -f Makefile || make distclean |
|---|
| 22 | cp -u /usr/share/misc/config.guess . |
|---|
| 23 | cp -u /usr/share/misc/config.sub . |
|---|
| 24 | mv INSTALL INSTALL.keep |
|---|
| 25 | autoreconf --force -i |
|---|
| 26 | mv INSTALL.keep INSTALL |
|---|
| 27 | ./configure CC=gcc CXX=g++ |
|---|
| 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' |
|---|
| 30 | VALGRIND=valgrind make distcheck VERBOSE=1 |
|---|
| 31 | else |
|---|
| 32 | make dist |
|---|
| 33 | fi |
|---|
| 34 | |
|---|
| 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. |
|---|
| 39 | tarball=`ls -1t survex-1*.tar.gz|head -n1` |
|---|
| 40 | tardir=`basename "$tarball" .tar.gz` |
|---|
| 41 | rm -rf "$tardir" |
|---|
| 42 | tar xf "$tarball" |
|---|
| 43 | cd "$tardir" |
|---|
| 44 | |
|---|
| 45 | test -n "$build_platform" || build_platform=`sh config.guess` |
|---|
| 46 | SAVE_PATH=$PATH |
|---|
| 47 | for wxc in \ |
|---|
| 48 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.1 \ |
|---|
| 49 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.0 \ |
|---|
| 50 | /usr/i586-mingw32msvc/lib/wx/config/i586-mingw32msvc-msw-unicode-static-3.0 \ |
|---|
| 51 | "" ; do |
|---|
| 52 | if test -z "$wxc" ; then |
|---|
| 53 | echo "wx-config for mingw not found" >&2 |
|---|
| 54 | exit 1 |
|---|
| 55 | fi |
|---|
| 56 | if test -x "$wxc" ; then |
|---|
| 57 | CC=`$wxc --cc` |
|---|
| 58 | CXX=`$wxc --cxx` |
|---|
| 59 | break |
|---|
| 60 | fi |
|---|
| 61 | done |
|---|
| 62 | host=mingw |
|---|
| 63 | case $CC in |
|---|
| 64 | *i686-w64-mingw32-gcc) |
|---|
| 65 | # debian mingw package |
|---|
| 66 | host=i686-w64-mingw32 |
|---|
| 67 | ;; |
|---|
| 68 | *i586-mingw32msvc-gcc) |
|---|
| 69 | # debian mingw32 package |
|---|
| 70 | host=i586-mingw32msvc |
|---|
| 71 | ;; |
|---|
| 72 | *i386-mingw32msvc-gcc) |
|---|
| 73 | # debian mingw32 package |
|---|
| 74 | host=i386-mingw32msvc |
|---|
| 75 | ;; |
|---|
| 76 | esac |
|---|
| 77 | PATH=/usr/$host/bin:$PATH |
|---|
| 78 | |
|---|
| 79 | # Passing -Werror to configure causes AC_CHECK_FUNCS to fail, so pass it to |
|---|
| 80 | # make instead. |
|---|
| 81 | cross_pkg_config_path=`echo "$wxc"|sed 's,/lib/.*,/lib/pkgconfig,'` |
|---|
| 82 | PKG_CONFIG_PATH=$cross_pkg_config_path \ |
|---|
| 83 | PKG_CONFIG_LIBDIR=$cross_pkg_config_path \ |
|---|
| 84 | ./configure --host="$host" --build="$build_platform" WX_CONFIG="$wxc" \ |
|---|
| 85 | CC="$CC" CXX="$CXX" CXXFLAGS="-g -O2 -fno-strict-aliasing -Werror" \ |
|---|
| 86 | LDFLAGS='-s -static' LIBS='-lsqlite3 -lstdc++' |
|---|
| 87 | make CFLAGS='-g -O2 -Werror' |
|---|
| 88 | make mingw_iss |
|---|
| 89 | PATH=$SAVE_PATH |
|---|
| 90 | |
|---|
| 91 | mv survex-win32-*.exe .. |
|---|
| 92 | cd .. |
|---|
| 93 | |
|---|
| 94 | if test x"$rel" = xyes ; then |
|---|
| 95 | rm -rf "$tardir" |
|---|
| 96 | else |
|---|
| 97 | exit 0 |
|---|
| 98 | fi |
|---|
| 99 | |
|---|
| 100 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile` |
|---|
| 101 | FILES="survex-$VERSION.tar.gz survex-win32-$VERSION.exe" |
|---|
| 102 | echo "SHA256 checksums:" |
|---|
| 103 | sha256sum $FILES |
|---|
| 104 | echo |
|---|
| 105 | |
|---|
| 106 | for f in $FILES ; do |
|---|
| 107 | gpg --detach-sign --armour "$f" |
|---|
| 108 | FILES="$FILES $f.asc" |
|---|
| 109 | done |
|---|
| 110 | |
|---|
| 111 | echo "To tag this release and upload it to the webserver, run:" |
|---|
| 112 | echo git tag -s -m"'Survex $VERSION'" "v$VERSION" |
|---|
| 113 | |
|---|
| 114 | HOST=thyestes.tartarus.org |
|---|
| 115 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION" |
|---|
| 116 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION" |
|---|