RPM experiments

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2002-07-18 06:16:25 +00:00
parent a7fd7c7851
commit 4726eec677
2 changed files with 337 additions and 33 deletions

View File

@ -1,47 +1,207 @@
#!/bin/bash
#----------------------------------------------------------------------
# Build an RPM containing both wxGTK and wxPython
if [ -z $1 ]; then
echo "Please specify a version number on the command line."
exit 1
fi
spectemplate=distrib/wxPythonFull.spec.in
if [ ! -f wxPython.spec ]; then
echo "Please run this script from the directory containing the wxPython.spec file."
if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
echo "Please run this script from the root wxPython directory."
exit 1
fi
#----------------------------------------------------------------------
# Initialization
#strip /usr/lib/python1.5/site-packages/wxPython/*.so
#strip /usr/lib/libwxPyHelpers.so
#
#cat wxPython.spec.in | sed s/__VERSION__/$1/g > wxPython.spec
#
#mkdir /usr/doc/wxPython-$1
#cp ../README.txt /usr/doc/wxPython-$1
#cp ../../../docs/preamble.txt /usr/doc/wxPython-$1
#cp ../../../docs/licence.txt /usr/doc/wxPython-$1
#cp ../../../docs/licendoc.txt /usr/doc/wxPython-$1
#cp ../../../docs/lgpl.txt /usr/doc/wxPython-$1
#cp ../../../docs/gpl.txt /usr/doc/wxPython-$1
#
#rpm -bb wxPython.spec
#
#mv /usr/src/redhat/RPMS/*/wxPython*.rpm .
#chown rd:users wxPython*.rpm
#
#rm -r /usr/doc/wxPython-$1
distdir=`pwd`/dist
builddir=`pwd`/build_rpm
rpmtop=${builddir}/rpmtop
cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/home/wxcvs
pythonbin=/usr/bin/python
port=GTK
lcport=gtk
tarname=wxPythonFull
debug=0
cp -f wxPython-$1.tar.gz /usr/src/redhat/SOURCES
rpm -ba wxPython.spec
mv /usr/src/redhat/RPMS/*/wxPython*.rpm .
mv /usr/src/redhat/SRPMS/wxPython*.rpm .
chown rd:users wxPython*.rpm
rm -rf /usr/lib/python1.5/site-packages/wxPython/
rm -f /usr/lib/libwxPyHelpers*
rm -rf /usr/doc/wxPython-$1
#----------------------------------------------------------------------
# Check parameters
function useage {
echo "Usage: $0 cvs_tag wx_version py_version [command flags...]"
echo " cvs_tag Tag to use for CVS export"
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 " skipcvs Don't do the CVS export"
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 " speconly Do nothing but write the RPM spec file"
echo " debug Make a __WXDEBUG__ version"
echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
}
if [ $# -lt 3 ]; then
useage
exit 1
fi
cvs_tag=$1
version=$2
pyver=$3
shift;shift;shift
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:@DEBUG@:${debug}:g \
| sed s:@PORT@:${port}:g \
| sed s:@LCPORT@:${lcport}:g \
| sed s:@TARNAME@:${tarname}:g \
> ${distdir}/wxPython${port}.spec
}
for flag in $*; do
case ${flag} in
skipcvs) skipcvs=1 ;;
skipclean) skipclean=1 ;;
skiptar) skiptar=1 ;;
skiprpm) skiprpm=1 ;;
smp) export SMP=2 ;;
debug) debug=1 ;;
speconly) makespec; exit 0 ;;
*) echo "Unknown flag \"${flag}\""
useage
exit 1
esac
done
tarver=${tarname}-${version}
#----------------------------------------------------------------------
# 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
#----------------------------------------------------------------------
# Get the sources from CVS
if [ -z "${skipcvs}" ]; then
echo "*** Exporting CVS archive..."
pushd ${builddir} > /dev/null
if [ -e ${tarver} ]; then
rm -rf ${tarver}
fi
cvs -d ${cvsroot} export -r ${cvs_tag} -d ${tarver} wxWindows > /dev/null 2>&1
if [ "$?" != "0" ]; then
echo "*** CVS failure, exiting."
exit 1
fi
echo "*** Removing unneeded stuff from CVS tree"
pushd ${tarver} > /dev/null
rm `find . -name .cvsignore`
rm *.spec
rm -rf demos
# rm -rf docs
rm -rf samples
rm -rf utils
# rm -rf include/wx/mgl
# rm -rf include/wx/motif
# rm -rf include/wx/os2
# rm -rf src/mgl
# rm -rf src/motif
# rm -rf src/os2
rm -rf wxPython/wxSWIG
popd > /dev/null
popd > /dev/null
fi
#----------------------------------------------------------------------
# Make the spec file and copy to ${builddir}/${tarver}
#if [ -z "${skiptar}" ]; then
makespec
cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
#fi
#----------------------------------------------------------------------
# Build the tar file
if [ -z "${skiptar}" ]; then
echo "*** Creating tarball..."
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
rpm -ba \
--define "_topdir ${rpmtop}" \
--define "_tmppath ${builddir}" \
${distdir}/wxPython${port}.spec
if [ "$?" != "0" ]; then
echo "*** RPM failure, exiting."
exit 1
else
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

View File

@ -0,0 +1,144 @@
%define pref %{_prefix}
%define python @PYTHON@
%define pyver @PYVER@
%define debug @DEBUG@
%define port @PORT@
%define lcport @LCPORT@
%define tarname @TARNAME@
%if %{debug}
%define name wxPython%{port}_py%{pyver}_dbg
%else
%define name wxPython%{port}_py%{pyver}
%endif
%define version 2.3.3pre5
%define release 1
Summary: Cross platform GUI toolkit for Python using wx%{port}
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{tarname}-%{version}.tar.gz
License: wxWindows Library Licence, Version 3
url: http://wxPython.org/
packager: Robin Dunn <robind@alldunn.com>
Group: Development/Python
BuildRoot: %{_tmppath}/%{name}-buildroot
Prefix: %{pref}
# They conflict with each other
%if %{debug}
Conflicts: wxPython%{port}_py%{pyver}
%else
Conflicts: wxPython%{port}_py%{pyver}_dbg
%endif
Provides: wxwin
Provides: wx%{port} = %{version}
Provides: wxPython = %{version}
# ?? Obsoletes: wx%{port}, wxPython
# Some funky mandrake names
Conflicts: wxGTK2.3, wxGTK6
%description
wxPython is a GUI toolkit for Python that is a wrapper around the
wxWindows C++ GUI library. wxPython provides a large variety of
window types and controls, all implemented with a native look and feel
(and native runtime speed) on the platforms it is supported on.
This package is implemented using the GTK port of wxWindows, and
includes the wx%{port} shared libs and etc.
%prep
%setup -n %{tarname}-%{version}
%build
if [ "$SMP" != "" ]; then
MAKE="make -j$SMP"
else
MAKE="make"
fi
mkdir build
cd build
# Configure, trying to reduce dependencies
../configure --with-%{lcport} --enable-soname --prefix=%{pref} \
--with-odbc \
--with-opengl \
%if %{debug}
--enable-debug \
%else
--enable-optimise \
%endif
--with-libjpeg=builtin \
--with-libpng=builtin \
--with-libtiff=builtin \
--with-zlib=builtin \
# Build wxWindows
$MAKE
cd ../locale
make allmo
# ** Unfortunately we have to do a bit of installation here so wxPython
# can be built. Perhaps wx-config should be changed to be able to be
# used from the build dir, maybe with an --inplace flag... Move these
# three lines to %install if/when that happens.
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
cd ../build
make prefix=$RPM_BUILD_ROOT%{pref} install
# Now build wxPython
cd ../wxPython
%{python} setup.py \
IN_CVS_TREE=1 \
WX_CONFIG="$RPM_BUILD_ROOT%{pref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{pref}" \
build
%install
## ** [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%find_lang wxstd
cd wxPython
%{python} setup.py \
IN_CVS_TREE=1 \
WX_CONFIG="$RPM_BUILD_ROOT%{pref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{pref}" \
install \
--root=$RPM_BUILD_ROOT
%clean
##[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
%post
/sbin/ldconfig
%postun
/sbin/ldconfig
%files
%defattr(-,root,root)
%{_libdir}/libwx*
%{_libdir}/python*
%{_datadir}
%changelog
# end of file