| 1 | #! /bin/sh |
|---|
| 2 | |
|---|
| 3 | # flags to consider: |
|---|
| 4 | # CFLAGS="-O2 -fomit-frame-pointer" |
|---|
| 5 | # CXXFLAGS="-O2 -fno-rtti -fomit-frame-pointer" |
|---|
| 6 | rel=yes |
|---|
| 7 | if test x"$1" = x-t ; then |
|---|
| 8 | rel= |
|---|
| 9 | shift |
|---|
| 10 | fi |
|---|
| 11 | mk=${@-src rpm deb doc mingw} |
|---|
| 12 | if test x"$rel" = xyes ; then |
|---|
| 13 | # Update debian changelog entry if necessary |
|---|
| 14 | # If it does get updated, then the next check will fail... |
|---|
| 15 | ./update-debcl.pl |
|---|
| 16 | # Check everything is checked into CVS |
|---|
| 17 | if ! cvs diff > /dev/null 2> /dev/null ; then |
|---|
| 18 | echo There are changes not checked into CVS - please rectify |
|---|
| 19 | exit 1 |
|---|
| 20 | fi |
|---|
| 21 | # Update ChangeLog |
|---|
| 22 | CVS2CL=./cvs2cl.pl |
|---|
| 23 | if ! test -x $CVS2CL ; then |
|---|
| 24 | CVS2CL=../cvs2cl/cvs2cl.pl |
|---|
| 25 | fi |
|---|
| 26 | if ! test -x $CVS2CL ; then |
|---|
| 27 | echo cvs2cl.pl not found |
|---|
| 28 | exit 1 |
|---|
| 29 | fi |
|---|
| 30 | TAG="`sed 's/^CHANGELOG_FROM_TAG=//p;d' configure.in`" |
|---|
| 31 | # stderr | grep -v '^cvs server: warning: no revision .*/Attic/' |
|---|
| 32 | if ! cvs log -r$TAG:: 2> /dev/null|./fixchangelog.pl $TAG|$CVS2CL --stdin 2> /dev/null ; then |
|---|
| 33 | echo Failed to update ChangeLog from CVS |
|---|
| 34 | exit 1 |
|---|
| 35 | fi |
|---|
| 36 | fi |
|---|
| 37 | if test -f Makefile ; then |
|---|
| 38 | if ! make distclean ; then |
|---|
| 39 | echo make distclean failed |
|---|
| 40 | exit 1 |
|---|
| 41 | fi |
|---|
| 42 | fi |
|---|
| 43 | if test yes = "$rel" ; then |
|---|
| 44 | rm -f config.guess.new config.sub.new |
|---|
| 45 | # only check for new versions if the current ones are over a day old |
|---|
| 46 | perl -e '-M "config.guess" && -M "config.sub" && exit 1' ||\ |
|---|
| 47 | wget ftp://ftp.gnu.org/gnu/config/config.guess -O config.guess.new &&\ |
|---|
| 48 | wget ftp://ftp.gnu.org/gnu/config/config.sub -O config.sub.new &&\ |
|---|
| 49 | chmod 755 config.guess.new config.sub.new &&\ |
|---|
| 50 | mv config.guess.new config.guess && mv config.sub.new config.sub |
|---|
| 51 | fi |
|---|
| 52 | autoreconf --force -i |
|---|
| 53 | export CC |
|---|
| 54 | export CXX |
|---|
| 55 | CC=gcc |
|---|
| 56 | CXX=g++ |
|---|
| 57 | if ! ./configure ; then |
|---|
| 58 | echo configure failed |
|---|
| 59 | exit 1 |
|---|
| 60 | fi |
|---|
| 61 | if test yes = "$rel" ; then |
|---|
| 62 | export CFLAGS |
|---|
| 63 | export CXXFLAGS |
|---|
| 64 | # tell the preproceesor to be C89 - this makes it reject // comments |
|---|
| 65 | # FIXME -Werror makes configure explode CFLAGS="-Werror -Wp,-std=c89" |
|---|
| 66 | # FIXME CXXFLAGS="-Werror" |
|---|
| 67 | CFLAGS="-Wp,-std=c89" |
|---|
| 68 | CXXFLAGS= |
|---|
| 69 | if ! make dist ; then # distcheck fails extend.tst for some reason! |
|---|
| 70 | echo make distcheck failed |
|---|
| 71 | exit 1 |
|---|
| 72 | fi |
|---|
| 73 | CFLAGS= |
|---|
| 74 | CXXFLAGS= |
|---|
| 75 | else |
|---|
| 76 | if ! make dist ; then |
|---|
| 77 | echo make dist failed |
|---|
| 78 | exit 1 |
|---|
| 79 | fi |
|---|
| 80 | fi |
|---|
| 81 | if test x"$rel" = xyes && expr "$mk" : '.*\<rpm\>' || test x"$mk" = xrpm ; then |
|---|
| 82 | if rpm --version > /dev/null 2> /dev/null ; then |
|---|
| 83 | if ! make rpm ; then |
|---|
| 84 | echo make rpm failed |
|---|
| 85 | exit 1 |
|---|
| 86 | fi |
|---|
| 87 | else |
|---|
| 88 | echo rpm not installed - skipping rpm generation |
|---|
| 89 | fi |
|---|
| 90 | fi |
|---|
| 91 | if test x"$rel" = xyes && expr "$mk" : '.*\<deb\>' || test x"$mk" = xdeb ; then |
|---|
| 92 | if ! make debian ; then |
|---|
| 93 | echo make debian failed |
|---|
| 94 | exit 1 |
|---|
| 95 | fi |
|---|
| 96 | fi |
|---|
| 97 | if test x"$rel" = xyes && expr "$mk" : '.*\<doc\>' || test x"$mk" = xdoc ; then |
|---|
| 98 | if ! make dos_doc_exe ; then |
|---|
| 99 | echo make dos_doc_exe failed |
|---|
| 100 | exit 1 |
|---|
| 101 | fi |
|---|
| 102 | fi |
|---|
| 103 | if ! make distclean ; then |
|---|
| 104 | echo make distclean failed |
|---|
| 105 | exit 1 |
|---|
| 106 | fi |
|---|
| 107 | unset CC |
|---|
| 108 | unset CXX |
|---|
| 109 | if expr "$mk" : '.*\<mingw\>'; then |
|---|
| 110 | test -n "$build_platform" || build_platform=`sh config.guess` |
|---|
| 111 | SAVE_PATH="$PATH" |
|---|
| 112 | if test -d /usr/local/cross-tools/i386-mingw32msvc/bin ; then |
|---|
| 113 | # binaries from http://www.devolution.com/~slouken/SDL/Xmingw32/ |
|---|
| 114 | PATH=/usr/local/cross-tools/bin:/usr/local/cross-tools/i386-mingw32msvc/bin:$PATH |
|---|
| 115 | else |
|---|
| 116 | if test -d /usr/i586-mingw32msvc/bin ; then |
|---|
| 117 | # debian mingw32 package |
|---|
| 118 | PATH=/usr/i586-mingw32msvc/bin:$PATH |
|---|
| 119 | CC=/usr/bin/i586-mingw32msvc-gcc |
|---|
| 120 | export CC |
|---|
| 121 | CXX=/usr/bin/i586-mingw32msvc-g++ |
|---|
| 122 | export CXX |
|---|
| 123 | else |
|---|
| 124 | # variant of debian mingw32 package? |
|---|
| 125 | PATH=/usr/i386-mingw32msvc/bin:$PATH |
|---|
| 126 | CC=/usr/bin/i386-mingw32msvc-gcc |
|---|
| 127 | export CC |
|---|
| 128 | CXX=/usr/bin/i386-mingw32msvc-g++ |
|---|
| 129 | export CXX |
|---|
| 130 | fi |
|---|
| 131 | fi |
|---|
| 132 | wxc=wxmsw-2.5-config |
|---|
| 133 | for a in /usr/i586-mingw32msvc/bin/wxmsw-2.5-config ; do |
|---|
| 134 | test -x "$a" && wxc="$a" |
|---|
| 135 | done |
|---|
| 136 | LDFLAGS= |
|---|
| 137 | CPPFLAGS= |
|---|
| 138 | if test -d /opt/rx-win32 ; then |
|---|
| 139 | LDFLAGS=-L/opt/rx-win32/lib |
|---|
| 140 | CPPFLAGS=-I/opt/rx-win32/include |
|---|
| 141 | fi |
|---|
| 142 | if ! ./configure --host=mingw32 --build="$build_platform" WXCONFIG="$wxc" LDFLAGS="-s $LDFLAGS" CPPFLAGS="$CPPFLAGS" CFLAGS=-Werror CXXFLAGS=-Werror ; then |
|---|
| 143 | echo mingw configure failed |
|---|
| 144 | exit 1 |
|---|
| 145 | fi |
|---|
| 146 | if ! make ; then |
|---|
| 147 | echo mingw make failed |
|---|
| 148 | exit 1 |
|---|
| 149 | fi |
|---|
| 150 | if ! make mingw_iss ; then |
|---|
| 151 | echo mingw make mingw_iss failed |
|---|
| 152 | exit 1 |
|---|
| 153 | fi |
|---|
| 154 | if ! make distclean ; then |
|---|
| 155 | echo make distclean failed |
|---|
| 156 | exit 1 |
|---|
| 157 | fi |
|---|
| 158 | PATH="$SAVE_PATH" |
|---|
| 159 | CC= |
|---|
| 160 | CXX= |
|---|
| 161 | fi |
|---|