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