2000-07-15 15:51:35 -04:00
|
|
|
#!/bin/bash
|
2002-07-18 02:16:25 -04:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Build an RPM containing both wxGTK and wxPython
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
##set -o xtrace
|
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
spectemplate=distrib/wxPythonFull.spec.in
|
|
|
|
|
|
|
|
if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
|
|
|
|
echo "Please run this script from the root wxPython directory."
|
2000-07-15 15:51:35 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Initialization
|
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
version=`python -c "import setup;print setup.VERSION"`
|
2003-03-25 01:35:27 -05:00
|
|
|
wxpdir=`pwd`
|
|
|
|
wxdir=${wxpdir}/..
|
|
|
|
distdir=${wxpdir}/dist
|
|
|
|
builddir=${wxpdir}/_build_rpm
|
2002-07-18 02:16:25 -04:00
|
|
|
rpmtop=${builddir}/rpmtop
|
2003-03-25 01:35:27 -05:00
|
|
|
cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
|
2002-07-18 02:16:25 -04:00
|
|
|
pythonbin=/usr/bin/python
|
|
|
|
port=GTK
|
|
|
|
lcport=gtk
|
2003-03-25 01:35:27 -05:00
|
|
|
unicode=0
|
2004-10-14 21:02:22 -04:00
|
|
|
tarname=wxPython-src
|
|
|
|
srpmonly=0
|
2002-07-18 02:16:25 -04:00
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Check parameters
|
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
function usage {
|
|
|
|
echo "Usage: $0 py_version [command flags...]"
|
2004-10-14 21:02:22 -04:00
|
|
|
echo " py_version which python version to use."
|
2002-07-18 02:16:25 -04:00
|
|
|
echo ""
|
|
|
|
echo "command flags:"
|
2003-03-25 01:35:27 -05:00
|
|
|
echo " skipcopy Don't copy the files for the tarball from the workspace"
|
2002-07-18 02:16:25 -04:00
|
|
|
echo " skiptar Don't build the tarball"
|
2004-06-09 01:38:45 -04:00
|
|
|
echo " skiprpm Don't build the RPM"
|
2002-07-18 02:16:25 -04:00
|
|
|
echo " skipclean Don't do the cleanup at the end"
|
|
|
|
echo " speconly Do nothing but write the RPM spec file"
|
2003-03-25 01:35:27 -05:00
|
|
|
echo " srpm Only make the SRPM"
|
2002-07-18 02:16:25 -04:00
|
|
|
}
|
|
|
|
|
2004-01-17 19:13:51 -05:00
|
|
|
if [ $# -lt 1 ]; then
|
2004-01-12 22:42:43 -05:00
|
|
|
usage
|
2002-07-18 02:16:25 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
pyver=$1
|
|
|
|
shift
|
2002-07-18 02:16:25 -04:00
|
|
|
|
2002-08-12 13:45:17 -04:00
|
|
|
ver2=`echo ${version} | cut -c 1,2,3`
|
2002-07-19 18:30:42 -04:00
|
|
|
tarver=${tarname}-${version}
|
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
python=${pythonbin}${pyver}
|
|
|
|
if [ ! -e ${python} ]; then
|
|
|
|
echo "${python} not found!"
|
2000-07-15 15:51:35 -04:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
function makespec {
|
2004-10-14 21:02:22 -04:00
|
|
|
echo "*** Writing ${distdir}/wxPython.spec"
|
2002-07-18 02:16:25 -04:00
|
|
|
cat ${spectemplate} \
|
|
|
|
| sed s:@PYTHON@:${python}:g \
|
|
|
|
| sed s:@PYVER@:${pyver}:g \
|
|
|
|
| sed s:@TARNAME@:${tarname}:g \
|
2002-07-19 18:30:42 -04:00
|
|
|
| sed s:@VERSION@:${version}:g \
|
2002-08-12 13:45:17 -04:00
|
|
|
| sed s:@VER2@:${ver2}:g \
|
2004-10-14 21:02:22 -04:00
|
|
|
> ${distdir}/wxPython.spec
|
2002-07-18 02:16:25 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for flag in $*; do
|
|
|
|
case ${flag} in
|
2003-03-25 01:35:27 -05:00
|
|
|
skipcopy) skipcopy=1 ;;
|
|
|
|
skipclean) skipclean=1 ;;
|
2004-06-09 01:38:45 -04:00
|
|
|
skiptar) skiptar=1; skipcopy=1 ;;
|
2003-03-25 01:35:27 -05:00
|
|
|
skiprpm) skiprpm=1 ;;
|
|
|
|
speconly) makespec; exit 0 ;;
|
2004-10-14 21:02:22 -04:00
|
|
|
srpm) srpmonly=1; ;;
|
2002-07-18 02:16:25 -04:00
|
|
|
|
|
|
|
*) echo "Unknown flag \"${flag}\""
|
2004-01-12 22:42:43 -05:00
|
|
|
usage
|
2002-07-18 02:16:25 -04:00
|
|
|
exit 1
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
2003-03-25 01:35:27 -05:00
|
|
|
# Copy the sources from my CVS workspace
|
2002-07-18 02:16:25 -04:00
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
function cleanup {
|
|
|
|
RMFILES=`find . -name "$1"`
|
|
|
|
if [ "$RMFILES" != "" ]; then
|
|
|
|
rm -rf $RMFILES
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
if [ -z "${skipcopy}" ]; then
|
|
|
|
echo "*** Copying CVS tree"
|
2002-07-18 02:16:25 -04:00
|
|
|
pushd ${builddir} > /dev/null
|
|
|
|
if [ -e ${tarver} ]; then
|
2003-03-25 01:35:27 -05:00
|
|
|
rm -rf ${tarver}
|
2002-07-18 02:16:25 -04:00
|
|
|
fi
|
2003-03-25 01:35:27 -05:00
|
|
|
mkdir -p ${tarver}
|
|
|
|
|
|
|
|
# copy root dir contents
|
|
|
|
cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
|
2002-07-18 02:16:25 -04:00
|
|
|
|
2004-10-14 21:02:22 -04:00
|
|
|
# copy all top dirs except CVS, build, demos, samples, utils, and wxPython
|
2004-01-12 22:42:43 -05:00
|
|
|
for d in art build contrib debian distrib docs include lib locale misc patches src; do
|
2003-07-02 19:13:10 -04:00
|
|
|
if [ -e ${wxdir}/$d ]; then
|
|
|
|
cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
|
|
|
|
fi
|
2003-03-25 01:35:27 -05:00
|
|
|
done
|
2005-06-02 19:10:13 -04:00
|
|
|
|
2004-06-14 15:53:50 -04:00
|
|
|
# # and tex2rtf too
|
|
|
|
# mkdir ${tarver}/utils
|
|
|
|
# cp -Rpf --link ${wxdir}/utils/tex2rtf ${tarver}/utils
|
|
|
|
# # tex2rtf needs these files
|
|
|
|
# mkdir ${tarver}/samples
|
|
|
|
# cp -Rpf --link ${wxdir}/samples/sample.* ${tarver}/samples
|
2003-03-25 01:35:27 -05:00
|
|
|
|
|
|
|
# now do the same thing for wxPython, skipping it's build dirs and such
|
2004-03-12 14:59:50 -05:00
|
|
|
for dir in `grep -v '#' ${wxdir}/wxPython/distrib/DIRLIST`; do
|
|
|
|
mkdir ${tarver}/${dir}
|
|
|
|
##echo "cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir}"
|
|
|
|
cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir} > /dev/null 2>&1
|
2003-03-25 01:35:27 -05:00
|
|
|
done
|
|
|
|
|
2004-03-18 17:27:00 -05:00
|
|
|
# using DIRLIST as above will normally skip any files starting
|
|
|
|
# with a dot, but there are a few .files that we do want to
|
|
|
|
# copy...
|
|
|
|
for dir in wxPython/distrib/msw; do
|
|
|
|
cp -pf --link ${wxdir}/${dir}/.[a-zA-Z]* ${tarver}/${dir} > /dev/null 2>&1
|
|
|
|
done
|
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
echo "*** Removing uneeded stuff from copy of CVS tree"
|
2002-07-18 02:16:25 -04:00
|
|
|
pushd ${tarver} > /dev/null
|
2004-01-12 22:42:43 -05:00
|
|
|
cleanup .cvsignore
|
|
|
|
cleanup CVS
|
|
|
|
cleanup CVSROOT
|
|
|
|
rm BuildCVS.txt
|
2004-10-14 21:02:22 -04:00
|
|
|
rm -f ChangeLog
|
2002-07-18 02:16:25 -04:00
|
|
|
rm *.spec
|
2004-10-14 21:02:22 -04:00
|
|
|
rm -rf distrib/msw/tmake
|
2002-08-12 13:45:17 -04:00
|
|
|
rm -rf docs/html
|
|
|
|
rm -rf docs/latex
|
2003-03-25 01:35:27 -05:00
|
|
|
rm -rf contrib/docs
|
|
|
|
rm -rf contrib/samples
|
|
|
|
rm locale/*.mo
|
2004-01-12 22:42:43 -05:00
|
|
|
cleanup ".#*"
|
2004-10-14 21:02:22 -04:00
|
|
|
cleanup "#*#"
|
2004-01-12 22:42:43 -05:00
|
|
|
cleanup "*~"
|
2004-01-16 14:32:32 -05:00
|
|
|
cleanup "*.orig"
|
|
|
|
cleanup "*.rej"
|
2004-01-12 22:42:43 -05:00
|
|
|
cleanup "*.pyc"
|
|
|
|
cleanup core
|
|
|
|
cleanup "core.[0-9]*"
|
2003-03-25 01:35:27 -05:00
|
|
|
|
2004-10-14 21:02:22 -04:00
|
|
|
# ports that are not supported yet
|
|
|
|
cleanup cocoa
|
|
|
|
cleanup mgl
|
|
|
|
cleanup motif
|
|
|
|
cleanup os2
|
|
|
|
cleanup x11
|
|
|
|
|
2004-01-12 22:42:43 -05:00
|
|
|
rm -f wxPython/wx/* > /dev/null 2>&1
|
2002-07-18 02:16:25 -04:00
|
|
|
|
|
|
|
popd > /dev/null
|
|
|
|
popd > /dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
2002-07-19 18:30:42 -04:00
|
|
|
# Make the spec file and copy to ${builddir}/${tarver} so it will be
|
|
|
|
# in the tar file when it's built
|
2002-07-18 02:16:25 -04:00
|
|
|
|
2002-07-30 22:51:51 -04:00
|
|
|
# TODO? Output all combinations of spec files to put in the tar file??
|
|
|
|
|
2002-07-19 18:30:42 -04:00
|
|
|
makespec
|
2004-10-14 21:02:22 -04:00
|
|
|
cp ${distdir}/wxPython.spec ${builddir}/${tarver}/wxPython.spec
|
2002-07-18 02:16:25 -04:00
|
|
|
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Build the tar file
|
|
|
|
|
|
|
|
if [ -z "${skiptar}" ]; then
|
2003-03-25 01:35:27 -05:00
|
|
|
echo "*** Creating language catalogs..."
|
|
|
|
pushd ${builddir}/${tarver}/locale > /dev/null
|
|
|
|
make allmo
|
|
|
|
popd > /dev/null
|
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
echo "*** Creating tarball..."
|
2003-03-25 01:35:27 -05:00
|
|
|
cp distrib/README.1st.txt ${builddir}/${tarver}
|
2002-07-18 02:16:25 -04:00
|
|
|
pushd ${builddir} > /dev/null
|
|
|
|
tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
|
2003-03-25 01:35:27 -05:00
|
|
|
|
2002-07-18 02:16:25 -04:00
|
|
|
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
|
2004-10-14 21:02:22 -04:00
|
|
|
|
|
|
|
if [ "${srpmonly}" = "1" ]; then
|
|
|
|
rpmbuild -bs \
|
|
|
|
--define "_topdir ${rpmtop}" \
|
|
|
|
--define "_tmppath ${builddir}" \
|
2005-06-02 19:10:13 -04:00
|
|
|
--define "release 1" \
|
2004-10-14 21:02:22 -04:00
|
|
|
${distdir}/wxPython.spec
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "*** RPM failure, exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
else
|
|
|
|
rpmbuild -ba \
|
|
|
|
--define "_topdir ${rpmtop}" \
|
|
|
|
--define "_tmppath ${builddir}" \
|
|
|
|
--define "port gtk" --define "unicode 0" \
|
|
|
|
--define "pyver ${pyver}" \
|
|
|
|
${distdir}/wxPython.spec
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "*** RPM failure, exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
rpmbuild -ba \
|
|
|
|
--define "_topdir ${rpmtop}" \
|
|
|
|
--define "_tmppath ${builddir}" \
|
|
|
|
--define "port gtk2" --define "unicode 1" \
|
|
|
|
--define "pyver ${pyver}" \
|
|
|
|
${distdir}/wxPython.spec
|
|
|
|
if [ "$?" != "0" ]; then
|
|
|
|
echo "*** RPM failure, exiting."
|
|
|
|
exit 1
|
|
|
|
fi
|
2002-07-18 02:16:25 -04:00
|
|
|
fi
|
2004-10-14 21:02:22 -04:00
|
|
|
|
|
|
|
echo "*** Moving RPMs to ${distdir}"
|
|
|
|
mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
|
2002-07-18 02:16:25 -04:00
|
|
|
fi
|
|
|
|
|
|
|
|
#----------------------------------------------------------------------
|
|
|
|
# Cleanup
|
|
|
|
|
|
|
|
if [ -z ${skipclean} ]; then
|
|
|
|
echo "*** Cleaning up"
|
|
|
|
rm -rf ${rpmtop}
|
|
|
|
rm -rf ${builddir}
|
|
|
|
fi
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
|
|
|
|
|