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 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
|
#!/bin/bash
#----------------------------------------------------------------------
# Build an RPM containing both wxGTK and wxPython
spectemplate=distrib/wxPythonFull.spec.in
if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
echo "Please run this script from the root wxPython directory."
exit 1
fi
#----------------------------------------------------------------------
# Initialization
wxpdir=`pwd`
wxdir=${wxpdir}/..
distdir=${wxpdir}/dist
builddir=${wxpdir}/_build_rpm
rpmtop=${builddir}/rpmtop
cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
pythonbin=/usr/bin/python
port=GTK
lcport=gtk
unicode=0
tarname=wxPythonSrc
rpmflag=-ba
#----------------------------------------------------------------------
# Check parameters
function useage {
echo "Usage: $0 wx_version py_version [command flags...]"
echo " wx_version String to use for version in filenames, etc."
echo " py_version String to append to $pythonbin (which python"
echo " version to use.)"
echo ""
echo "command flags:"
echo " skipcopy Don't copy the files for the tarball from the workspace"
echo " skiptar Don't build the tarball"
echo " skiprpm Don't build the RPM (but why?)"
echo " skipclean Don't do the cleanup at the end"
echo " gtk2 Build using wxGTK2 and Unicode"
echo " x11 Build using wxX11"
echo " speconly Do nothing but write the RPM spec file"
echo " srpm Only make the SRPM"
# echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
}
if [ $# -lt 2 ]; then
useage
exit 1
fi
version=$1
pyver=$2
shift;shift
ver2=`echo ${version} | cut -c 1,2,3`
tarver=${tarname}-${version}
python=${pythonbin}${pyver}
if [ ! -e ${python} ]; then
echo "${python} not found!"
exit 1
fi
function makespec {
echo "*** Writing ${distdir}/wxPython${port}.spec"
cat ${spectemplate} \
| sed s:@PYTHON@:${python}:g \
| sed s:@PYVER@:${pyver}:g \
| sed s:@PORT@:${port}:g \
| sed s:@LCPORT@:${lcport}:g \
| sed s:@TARNAME@:${tarname}:g \
| sed s:@VERSION@:${version}:g \
| sed s:@VER2@:${ver2}:g \
| sed s:@UNICODE@:${unicode}:g \
> ${distdir}/wxPython${port}.spec
}
for flag in $*; do
case ${flag} in
skipcopy) skipcopy=1 ;;
skipclean) skipclean=1 ;;
skiptar) skiptar=1 ;;
skiprpm) skiprpm=1 ;;
gtk2) unicode=1; port=GTK2; lcport=gtk2 ;;
x11) port=X11; lcport=x11 ;;
smp) export SMP=2 ;;
speconly) makespec; exit 0 ;;
srpm) rpmflag=-bs; ;;
*) echo "Unknown flag \"${flag}\""
useage
exit 1
esac
done
#----------------------------------------------------------------------
# Setup build dirs
echo "*** Setting up"
if [ ! -d ${builddir} ]; then
mkdir -p ${builddir}
fi
if [ ! -d ${distdir} ]; then
mkdir -p ${distdir}
fi
for dir in SOURCES SPECS BUILD RPMS SRPMS; do
if [ ! -d ${rpmtop}/${dir} ]; then
mkdir -p ${rpmtop}/${dir}
fi
done
#----------------------------------------------------------------------
# Copy the sources from my CVS workspace
if [ -z "${skipcopy}" ]; then
echo "*** Copying CVS tree"
pushd ${builddir} > /dev/null
if [ -e ${tarver} ]; then
rm -rf ${tarver}
fi
mkdir -p ${tarver}
# copy root dir contents
cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
# copy all top dirs except CVS, build, demos, utils, samples, and wxPython
for d in art contrib debian distrib docs include lib locale misc patches src; do
if [ -e ${wxdir}/$d ]; then
cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
fi
done
# now do the same thing for wxPython, skipping it's build dirs and such
mkdir ${tarver}/wxPython
cp -pf --link ${wxdir}/wxPython/* ${tarver}/wxPython > /dev/null 2>&1
for d in contrib demo distrib distutils docs licence samples scripts src wx wxPython; do
cp -Rpf --link ${wxdir}/wxPython/$d ${tarver}/wxPython #> /dev/null 2>&1
done
echo "*** Removing uneeded stuff from copy of CVS tree"
pushd ${tarver} > /dev/null
rm `find . -name .cvsignore`
rm -rf `find . -name CVS`
rm *.spec
rm -rf docs/html
rm -rf docs/latex
rm -rf contrib/docs
rm -rf contrib/samples
rm locale/*.mo
rm `find . -name ".#*"`
rm `find . -name "*~"`
rm `find . -name "*.pyc"`
rm `find . -name "core"`
rm `find . -name "core.[0-9]*"`
rm -f wxPython/wxPython/* > /dev/null 2>&1
rm wxPython/demo/.setup.sh
rm -rf wxPython/contrib/art2d
rm -rf wxPython/contrib/canvas
rm -rf wxPython/contrib/canvas2
rm -rf wxPython/contrib/gizmos/contrib
rm -rf wxPython/contrib/ogl/contrib
rm -rf wxPython/contrib/stc/contrib
rm -rf wxPython/contrib/xrc/contrib
popd > /dev/null
popd > /dev/null
fi
#----------------------------------------------------------------------
# Make the spec file and copy to ${builddir}/${tarver} so it will be
# in the tar file when it's built
# TODO? Output all combinations of spec files to put in the tar file??
makespec
cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
#----------------------------------------------------------------------
# Build the tar file
if [ -z "${skiptar}" ]; then
echo "*** Creating language catalogs..."
pushd ${builddir}/${tarver}/locale > /dev/null
make allmo
popd > /dev/null
echo "*** Creating tarball..."
cp distrib/README.1st.txt ${builddir}/${tarver}
pushd ${builddir} > /dev/null
tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
echo "*** Compressing..."
if [ -e ${distdir}/${tarver}.tar.gz ]; then
rm ${distdir}/${tarver}.tar.gz
fi
gzip --best ${distdir}/${tarver}.tar
popd > /dev/null
fi
#----------------------------------------------------------------------
# build the RPM
if [ -z "${skiprpm}" ]; then
echo "*** Building RPMs..."
cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
rpmbuild ${rpmflag} \
--define "_topdir ${rpmtop}" \
--define "_tmppath ${builddir}" \
${distdir}/wxPython${port}.spec
if [ "$?" != "0" ]; then
echo "*** RPM failure, exiting."
exit 1
else
echo "*** Moving RPMs to ${distdir}"
mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
fi
fi
#----------------------------------------------------------------------
# Cleanup
if [ -z ${skipclean} ]; then
echo "*** Cleaning up"
rm -rf ${rpmtop}
rm -rf ${builddir}
fi
|