| 1 | #! /bin/sh |
|---|
| 2 | |
|---|
| 3 | set -e |
|---|
| 4 | |
|---|
| 5 | rel=yes |
|---|
| 6 | if test x"$1" = x-t ; then |
|---|
| 7 | rel= |
|---|
| 8 | shift |
|---|
| 9 | fi |
|---|
| 10 | |
|---|
| 11 | if test x"$rel" = xyes ; then |
|---|
| 12 | # Check there are no uncommitted changes. |
|---|
| 13 | if git commit -a --dry-run >/dev/null 2>/dev/null ; then |
|---|
| 14 | echo 'There are uncommitted changes - please rectify' |
|---|
| 15 | echo 'If you just want to test, run with option -t' |
|---|
| 16 | exit 1 |
|---|
| 17 | fi |
|---|
| 18 | |
|---|
| 19 | test ! -f Makefile || make distclean |
|---|
| 20 | cp -u /usr/share/misc/config.guess . |
|---|
| 21 | cp -u /usr/share/misc/config.sub . |
|---|
| 22 | autoreconf --force -i |
|---|
| 23 | ./configure CC=gcc CXX=g++ |
|---|
| 24 | make distcheck |
|---|
| 25 | # FIXME: setting c89 doesn't define unix and suppresses getc_unlocked(). |
|---|
| 26 | # Tell the preprocessor to be C89 - this makes it reject // comments |
|---|
| 27 | # FIXME -Werror makes configure explode CFLAGS="-Werror -Wp,-std=c89" |
|---|
| 28 | # FIXME CXXFLAGS="-Werror" |
|---|
| 29 | else |
|---|
| 30 | make dist |
|---|
| 31 | fi |
|---|
| 32 | |
|---|
| 33 | # Perform mingw build on a clean unpacked source tree from the release tarball |
|---|
| 34 | # so that (a) we don't need to "make distclean" on the source tree and (b) we |
|---|
| 35 | # ensure that any files required to build the mingw version and installer |
|---|
| 36 | # package are actually shipped in the source tarball. |
|---|
| 37 | tarball=`ls -1t survex-1*.tar.gz|head -n1` |
|---|
| 38 | tardir=`basename "$tarball" .tar.gz` |
|---|
| 39 | rm -rf "$tardir" |
|---|
| 40 | tar xf "$tarball" |
|---|
| 41 | cd "$tardir" |
|---|
| 42 | |
|---|
| 43 | test -n "$build_platform" || build_platform=`sh config.guess` |
|---|
| 44 | SAVE_PATH=$PATH |
|---|
| 45 | for wxc in \ |
|---|
| 46 | /usr/i586-mingw32msvc/lib/wx/config/i586-mingw32msvc-msw-unicode-static-2.9 \ |
|---|
| 47 | /usr/lib/wx/config/i586-mingw32msvc-msw-unicode-release-static-2.8 \ |
|---|
| 48 | /usr/lib/wx/config/i686-w64-mingw32-msw-unicode-release-static-2.8 \ |
|---|
| 49 | "" ; do |
|---|
| 50 | if test -z "$wxc" ; then |
|---|
| 51 | echo "wx-config for mingw not found" >&2 |
|---|
| 52 | exit 1 |
|---|
| 53 | fi |
|---|
| 54 | if test -x "$wxc" ; then |
|---|
| 55 | CC=`$wxc --cc` |
|---|
| 56 | CXX=`$wxc --cxx` |
|---|
| 57 | break |
|---|
| 58 | fi |
|---|
| 59 | done |
|---|
| 60 | case $CC in |
|---|
| 61 | *i586-mingw32msvc-gcc) |
|---|
| 62 | # debian mingw32 package |
|---|
| 63 | PATH=/usr/i586-mingw32msvc/bin:$PATH |
|---|
| 64 | ;; |
|---|
| 65 | *i386-mingw32msvc-gcc) |
|---|
| 66 | # debian mingw32 package |
|---|
| 67 | PATH=/usr/i386-mingw32msvc/bin:$PATH |
|---|
| 68 | ;; |
|---|
| 69 | esac |
|---|
| 70 | |
|---|
| 71 | # Passing -Werror to configure causes AC_CHECK_FUNCS to fail, so pass it to |
|---|
| 72 | # make instead. |
|---|
| 73 | ./configure --host=mingw32 --build="$build_platform" CC="$CC" CXX="$CXX" CXXFLAGS="-fno-strict-aliasing -Werror" WX_CONFIG="$wxc" LDFLAGS='-s -static' |
|---|
| 74 | make CFLAGS=-Werror |
|---|
| 75 | make mingw_iss |
|---|
| 76 | PATH=$SAVE_PATH |
|---|
| 77 | |
|---|
| 78 | mv survex-win32-*.exe .. |
|---|
| 79 | cd .. |
|---|
| 80 | |
|---|
| 81 | if test x"$rel" = xyes ; then |
|---|
| 82 | rm -rf "$tardir" |
|---|
| 83 | fi |
|---|
| 84 | |
|---|
| 85 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile` |
|---|
| 86 | FILES="survex-$VERSION.tar.gz survex-win32-$VERSION.exe" |
|---|
| 87 | echo "SHA1 checksums:" |
|---|
| 88 | sha1sum $FILES |
|---|
| 89 | echo |
|---|
| 90 | |
|---|
| 91 | echo "To tag this release and upload it to the webserver, run:" |
|---|
| 92 | echo git tag -m"'Tagging $VERSION'" "$VERSION" |
|---|
| 93 | |
|---|
| 94 | HOST=atreus.tartarus.org |
|---|
| 95 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION" |
|---|
| 96 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION" |
|---|