| 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 | cd src
|
|---|
| 15 | perl -e 'while (<>) { if (m!(.*)//! && $1 !~ / \* /) {print "$ARGV:$.:// comment in C source\n"; exit 1}} continue { close ARGV if eof }' \
|
|---|
| 16 | *.c \
|
|---|
| 17 | cavern.h commands.h cmdline.h date.h datain.h debug.h\
|
|---|
| 18 | filelist.h filename.h getopt.h hash.h img.c img.h img_hosted.h\
|
|---|
| 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 |
|
|---|
| 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'
|
|---|
| 27 | echo 'If you just want to test, run with option -t'
|
|---|
| 28 | exit 1
|
|---|
| 29 | fi
|
|---|
| 30 |
|
|---|
| 31 | test ! -f Makefile || make distclean
|
|---|
| 32 | cp -u /usr/share/misc/config.guess .
|
|---|
| 33 | cp -u /usr/share/misc/config.sub .
|
|---|
| 34 | mv INSTALL INSTALL.keep
|
|---|
| 35 | autoreconf --force -i
|
|---|
| 36 | mv INSTALL.keep INSTALL
|
|---|
| 37 | ./configure CC=gcc CXX=g++
|
|---|
| 38 | make CFLAGS='-Werror' CXXFLAGS='-Werror'
|
|---|
| 39 | VALGRIND=valgrind make distcheck
|
|---|
| 40 | else
|
|---|
| 41 | make dist
|
|---|
| 42 | fi
|
|---|
| 43 |
|
|---|
| 44 | # Perform mingw build on a clean unpacked source tree from the release tarball
|
|---|
| 45 | # so that (a) we don't need to "make distclean" on the source tree and (b) we
|
|---|
| 46 | # ensure that any files required to build the mingw version and installer
|
|---|
| 47 | # package are actually shipped in the source tarball.
|
|---|
| 48 | tarball=`ls -1t survex-1*.tar.gz|head -n1`
|
|---|
| 49 | tardir=`basename "$tarball" .tar.gz`
|
|---|
| 50 | rm -rf "$tardir"
|
|---|
| 51 | tar xf "$tarball"
|
|---|
| 52 | cd "$tardir"
|
|---|
| 53 |
|
|---|
| 54 | test -n "$build_platform" || build_platform=`sh config.guess`
|
|---|
| 55 | SAVE_PATH=$PATH
|
|---|
| 56 | for wxc in \
|
|---|
| 57 | /usr/i686-w64-mingw32/lib/wx/config/i686-w64-mingw32-msw-unicode-static-3.0 \
|
|---|
| 58 | /usr/i586-mingw32msvc/lib/wx/config/i586-mingw32msvc-msw-unicode-static-3.0 \
|
|---|
| 59 | "" ; do
|
|---|
| 60 | if test -z "$wxc" ; then
|
|---|
| 61 | echo "wx-config for mingw not found" >&2
|
|---|
| 62 | exit 1
|
|---|
| 63 | fi
|
|---|
| 64 | if test -x "$wxc" ; then
|
|---|
| 65 | CC=`$wxc --cc`
|
|---|
| 66 | CXX=`$wxc --cxx`
|
|---|
| 67 | break
|
|---|
| 68 | fi
|
|---|
| 69 | done
|
|---|
| 70 | host=mingw
|
|---|
| 71 | case $CC in
|
|---|
| 72 | *i686-w64-mingw32-gcc)
|
|---|
| 73 | # debian mingw package
|
|---|
| 74 | host=i686-w64-mingw32
|
|---|
| 75 | ;;
|
|---|
| 76 | *i586-mingw32msvc-gcc)
|
|---|
| 77 | # debian mingw32 package
|
|---|
| 78 | host=i586-mingw32msvc
|
|---|
| 79 | ;;
|
|---|
| 80 | *i386-mingw32msvc-gcc)
|
|---|
| 81 | # debian mingw32 package
|
|---|
| 82 | host=i386-mingw32msvc
|
|---|
| 83 | ;;
|
|---|
| 84 | esac
|
|---|
| 85 | PATH=/usr/$host/bin:$PATH
|
|---|
| 86 |
|
|---|
| 87 | # Passing -Werror to configure causes AC_CHECK_FUNCS to fail, so pass it to
|
|---|
| 88 | # make instead.
|
|---|
| 89 | cross_pkg_config_path=`echo "$wxc"|sed 's,/lib/.*,/lib/pkgconfig,'`
|
|---|
| 90 | PKG_CONFIG_PATH=$cross_pkg_config_path \
|
|---|
| 91 | PKG_CONFIG_LIBDIR=$cross_pkg_config_path \
|
|---|
| 92 | ./configure --host="$host" --build="$build_platform" WX_CONFIG="$wxc" \
|
|---|
| 93 | CC="$CC" CXX="$CXX" CXXFLAGS="-g -O2 -fno-strict-aliasing -Werror" \
|
|---|
| 94 | LDFLAGS='-s -static'
|
|---|
| 95 | make CFLAGS='-g -O2 -Werror'
|
|---|
| 96 | make mingw_iss
|
|---|
| 97 | PATH=$SAVE_PATH
|
|---|
| 98 |
|
|---|
| 99 | mv survex-win32-*.exe ..
|
|---|
| 100 | cd ..
|
|---|
| 101 |
|
|---|
| 102 | if test x"$rel" = xyes ; then
|
|---|
| 103 | rm -rf "$tardir"
|
|---|
| 104 | else
|
|---|
| 105 | exit 0
|
|---|
| 106 | fi
|
|---|
| 107 |
|
|---|
| 108 | VERSION=`sed 's/^VERSION *= *//p;d' Makefile`
|
|---|
| 109 | FILES="survex-$VERSION.tar.gz survex-win32-$VERSION.exe"
|
|---|
| 110 | echo "SHA1 checksums:"
|
|---|
| 111 | sha1sum $FILES
|
|---|
| 112 | echo
|
|---|
| 113 |
|
|---|
| 114 | for f in $FILES ; do
|
|---|
| 115 | gpg --detach-sign --armour "$f"
|
|---|
| 116 | FILES="$FILES $f.asc"
|
|---|
| 117 | done
|
|---|
| 118 |
|
|---|
| 119 | echo "To tag this release and upload it to the webserver, run:"
|
|---|
| 120 | echo git tag -s -m"'Survex $VERSION'" "$VERSION"
|
|---|
| 121 |
|
|---|
| 122 | HOST=atreus.tartarus.org
|
|---|
| 123 | echo ssh "$HOST" mkdir /srv/www/survex.com/software/"$VERSION"
|
|---|
| 124 | echo scp $FILES "$HOST":/srv/www/survex.com/software/"$VERSION"
|
|---|