[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 |
---|
[e6312c0] | 14 | cd src |
---|
[c0556bf] | 15 | perl -e 'while (<>) { if (m!(.*)//! && $1 !~ / \* /) {print "$ARGV:$.:// comment in C source\n"; exit 1}} continue { close ARGV if eof }' \ |
---|
[e6312c0] | 16 | *.c \ |
---|
| 17 | cavern.h commands.h cmdline.h date.h datain.h debug.h\ |
---|
[8bef4c6] | 18 | filelist.h filename.h getopt.h hash.h img.c img.h img_hosted.h\ |
---|
[e6312c0] | 19 | listpos.h matrix.h message.h namecmp.h netartic.h netbits.h\ |
---|
| 20 | netskel.h network.h osalloc.h osdepend.h ostypes.h out.h readval.h str.h\ |
---|
| 21 | useful.h validate.h whichos.h |
---|
| 22 | cd .. |
---|
| 23 | |
---|
[9d5aa63] | 24 | # Check there are no uncommitted changes. |
---|
| 25 | if git commit -a --dry-run >/dev/null 2>/dev/null ; then |
---|
| 26 | echo 'There are uncommitted changes - please rectify' |
---|
[d2980d2] | 27 | echo 'If you just want to test, run with option -t' |
---|
| 28 | exit 1 |
---|
| 29 | fi |
---|
[098acb1] | 30 | |
---|
[d2980d2] | 31 | test ! -f Makefile || make distclean |
---|
| 32 | cp -u /usr/share/misc/config.guess . |
---|
| 33 | cp -u /usr/share/misc/config.sub . |
---|
[f5baa8c] | 34 | mv INSTALL INSTALL.keep |
---|
[d2980d2] | 35 | autoreconf --force -i |
---|
[f5baa8c] | 36 | mv INSTALL.keep INSTALL |
---|
[d2980d2] | 37 | ./configure CC=gcc CXX=g++ |
---|
[da99c90] | 38 | # Don't error out on new GCC8 warning for now. |
---|
| 39 | make CFLAGS='-Werror' CXXFLAGS='-Werror -Wno-error=cast-function-type' |
---|
[8ea94ea] | 40 | VALGRIND=valgrind make distcheck VERBOSE=1 |
---|
[f78ad72] | 41 | else |
---|
[d2980d2] | 42 | make dist |
---|
[e719df1] | 43 | fi |
---|
[098acb1] | 44 | |
---|
[d2980d2] | 45 | # Perform mingw build on a clean unpacked source tree from the release tarball |
---|
| 46 | # so that (a) we don't need to "make distclean" on the source tree and (b) we |
---|
| 47 | # ensure that any files required to build the mingw version and installer |
---|
| 48 | # package are actually shipped in the source tarball. |
---|
[a6bb1fa6] | 49 | tarball=`ls -1t survex-1*.tar.gz|head -n1` |
---|
[d2980d2] | 50 | tardir=`basename "$tarball" .tar.gz` |
---|
| 51 | rm -rf "$tardir" |
---|
| 52 | tar xf "$tarball" |
---|
| 53 | cd "$tardir" |
---|
[098acb1] | 54 | |
---|
[0fd6750] | 55 | test -n "$build_platform" || build_platform=`sh config.guess` |
---|
| 56 | SAVE_PATH=$PATH |
---|
[d380cd6] | 57 | for wxc in \ |
---|
[bd285e5a] | 58 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.0 \ |
---|
[a989777] | 59 | /usr/i586-mingw32msvc/lib/wx/config/i586-mingw32msvc-msw-unicode-static-3.0 \ |
---|
[d380cd6] | 60 | "" ; do |
---|
| 61 | if test -z "$wxc" ; then |
---|
| 62 | echo "wx-config for mingw not found" >&2 |
---|
| 63 | exit 1 |
---|
| 64 | fi |
---|
| 65 | if test -x "$wxc" ; then |
---|
| 66 | CC=`$wxc --cc` |
---|
| 67 | CXX=`$wxc --cxx` |
---|
| 68 | break |
---|
| 69 | fi |
---|
| 70 | done |
---|
[bd285e5a] | 71 | host=mingw |
---|
[d380cd6] | 72 | case $CC in |
---|
[bd285e5a] | 73 | *i686-w64-mingw32-gcc) |
---|
| 74 | # debian mingw package |
---|
| 75 | host=i686-w64-mingw32 |
---|
| 76 | ;; |
---|
[d380cd6] | 77 | *i586-mingw32msvc-gcc) |
---|
| 78 | # debian mingw32 package |
---|
[bd285e5a] | 79 | host=i586-mingw32msvc |
---|
[d380cd6] | 80 | ;; |
---|
| 81 | *i386-mingw32msvc-gcc) |
---|
| 82 | # debian mingw32 package |
---|
[bd285e5a] | 83 | host=i386-mingw32msvc |
---|
[d380cd6] | 84 | ;; |
---|
| 85 | esac |
---|
[bd285e5a] | 86 | PATH=/usr/$host/bin:$PATH |
---|
[d380cd6] | 87 | |
---|
[d2980d2] | 88 | # Passing -Werror to configure causes AC_CHECK_FUNCS to fail, so pass it to |
---|
| 89 | # make instead. |
---|
[2e24435] | 90 | cross_pkg_config_path=`echo "$wxc"|sed 's,/lib/.*,/lib/pkgconfig,'` |
---|
| 91 | PKG_CONFIG_PATH=$cross_pkg_config_path \ |
---|
| 92 | PKG_CONFIG_LIBDIR=$cross_pkg_config_path \ |
---|
| 93 | ./configure --host="$host" --build="$build_platform" WX_CONFIG="$wxc" \ |
---|
| 94 | CC="$CC" CXX="$CXX" CXXFLAGS="-g -O2 -fno-strict-aliasing -Werror" \ |
---|
| 95 | LDFLAGS='-s -static' |
---|
[79b271b] | 96 | make CFLAGS='-g -O2 -Werror' |
---|
[0fd6750] | 97 | make mingw_iss |
---|
| 98 | PATH=$SAVE_PATH |
---|
| 99 | |
---|
[d2980d2] | 100 | mv survex-win32-*.exe .. |
---|
| 101 | cd .. |
---|
| 102 | |
---|
| 103 | if test x"$rel" = xyes ; then |
---|
| 104 | rm -rf "$tardir" |
---|
[004b1c2] | 105 | else |
---|
| 106 | exit 0 |
---|
[d2980d2] | 107 | fi |
---|
[7b12c6d] | 108 | |
---|
[9c9fd6b] | 109 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile` |
---|
[8430216] | 110 | FILES="survex-$VERSION.tar.gz survex-win32-$VERSION.exe" |
---|
[f4671eb] | 111 | echo "SHA256 checksums:" |
---|
| 112 | sha256sum $FILES |
---|
[8430216] | 113 | echo |
---|
| 114 | |
---|
[179a57b] | 115 | for f in $FILES ; do |
---|
[201310c] | 116 | gpg --detach-sign --armour "$f" |
---|
[179a57b] | 117 | FILES="$FILES $f.asc" |
---|
| 118 | done |
---|
| 119 | |
---|
[8430216] | 120 | echo "To tag this release and upload it to the webserver, run:" |
---|
[6fabfc0] | 121 | echo git tag -s -m"'Survex $VERSION'" "$VERSION" |
---|
[e11c235] | 122 | |
---|
[f4671eb] | 123 | HOST=thyestes.tartarus.org |
---|
[e11c235] | 124 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION" |
---|
[8430216] | 125 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION" |
---|