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