1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
|
#!/bin/bash
# Are we using bash on win32? If so source that file and then exit.
if [ "$OSTYPE" = "cygwin" ]; then
source b.win32
exit
fi
# make it easy to switch versions of SWIG
if [ "$SWIG" = "" ]; then
SWIG=/opt/swig/bin/swig-1.3.29
fi
function getpyver {
if [ "$1" = "15" ]; then
PYVER=1.5
elif [ "$1" = "20" ]; then
PYVER=2.0
elif [ "$1" = "21" ]; then
PYVER=2.1
elif [ "$1" = "22" ]; then
PYVER=2.2
elif [ "$1" = "23" ]; then
PYVER=2.3
elif [ "$1" = "24" ]; then
PYVER=2.4
elif [ "$1" = "25" ]; then
PYVER=2.5
elif [ "$1" = "26" ]; then
PYVER=2.6
elif [ "$1" = "27" ]; then
PYVER=2.7
elif [ "$1" = "30" ]; then
PYVER=3.0
else
echo You must specify Python version as first parameter.
exit
fi
}
getpyver $1
shift
python$PYVER -c "import sys;print '\n', sys.version, '\n'"
SETUP="python$PYVER -u setup.py"
FLAGS="USE_SWIG=1 SWIG=$SWIG"
OTHERFLAGS=""
PORTFLAGS=""
UNIFLAG="UNICODE=1"
if [ "$1" = "gtk1" -o "$1" = "gtk" ]; then
PORTFLAGS="WXPORT=gtk"
UNIFLAG="UNICODE=0"
shift
elif [ "$1" = "gtk2" ]; then
PORTFLAGS="WXPORT=gtk2"
UNIFLAG="UNICODE=1"
shift
fi
for p in $*; do
if [ "$p" = "UNICODE=0" -o "$p" = "UNICODE=1" ]; then
UNIFLAG=""
break
fi
done
FLAGS="$FLAGS $PORTFLAGS $UNIFLAG"
# "c" --> clean
if [ "$1" = "c" ]; then
shift
CMD="$SETUP $FLAGS $OTHERFLAGS clean $*"
OTHERCMD="rm -f wx/*.so"
# "d" --> clean extension modules only
elif [ "$1" = "d" ]; then
shift
CMD="rm -f wx/*.so"
# "t" --> touch *.i files
elif [ "$1" = "t" ]; then
shift
CMD='find . -name "*.i" | xargs touch'
# "i" --> install
elif [ "$1" = "i" ]; then
shift
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext install $*"
# "s" --> source dist
elif [ "$1" = "s" ]; then
shift
CMD="$SETUP $OTHERFLAGS sdist $*"
# "r" --> rpm dist
elif [ "$1" = "r" ]; then
WXPYVER=`python$PYVER -c "import setup;print setup.VERSION"`
for VER in 21 22; do
getpyver $VER
echo "*****************************************************************"
echo "******* Building wxPython for Python $PYVER"
echo "*****************************************************************"
SETUP="python$PYVER -u setup.py"
# save the original
cp setup.py setup.py.save
# fix up setup.py the way we want...
sed "s/BUILD_GLCANVAS = /BUILD_GLCANVAS = 0 #/" < setup.py.save > setup.py.temp
sed "s/GL_ONLY = /GL_ONLY = 1 #/" < setup.py.temp > setup.py
# build wxPython-gl RPM
$SETUP $OTHERFLAGS bdist_rpm --binary-only --doc-files README.txt --python=python$PYVER
### --requires=python$PYVER
rm dist/wxPython-gl*.tar.gz
# Build wxPython RPM
cp setup.py setup.py.temp
sed "s/GL_ONLY = /GL_ONLY = 0 #/" < setup.py.temp > setup.py
$SETUP $OTHERFLAGS bdist_rpm --binary-only --python=python$PYVER
### --requires=python$PYVER
# put the oringal setup.py back
cp setup.py.save setup.py
rm setup.py.*
# rename the binary RPM's
mv dist/wxPython-$WXPYVER-1.i386.rpm dist/wxPython-$WXPYVER-1-Py$VER.i386.rpm
mv dist/wxPython-gl-$WXPYVER-1.i386.rpm dist/wxPython-gl-$WXPYVER-1-Py$VER.i386.rpm
done
# rebuild the source dists without the munched up setup.py
$SETUP $OTHERFLAGS bdist_rpm --source-only
exit 0
# "f" --> FINAL (no debug)
elif [ "$1" = "f" ]; then
shift
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace $*"
# (no command arg) --> normal build for development
else
CMD="$SETUP $FLAGS $OTHERFLAGS build_ext --inplace --debug $*"
fi
echo $CMD
eval $CMD
RC=$?
if [ "$RC" = "0" -a "$OTHERCMD" != "" ]; then
echo $OTHERCMD
$OTHERCMD
RC=$?
fi
exit $RC
|