]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/distrib/makerpm
Applied new master define for CommandBar vs. PocketPC mixed bar.
[wxWidgets.git] / wxPython / distrib / makerpm
index cbd77a7bb06f4f56162b1e262a34d073339be74e..194995955dd2a27ac6843f3356d24a6408c86e23 100755 (executable)
@@ -2,6 +2,8 @@
 #----------------------------------------------------------------------
 # Build an RPM containing both wxGTK and wxPython
 
 #----------------------------------------------------------------------
 # Build an RPM containing both wxGTK and wxPython
 
+##set -o xtrace
+
 spectemplate=distrib/wxPythonFull.spec.in
 
 if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
 spectemplate=distrib/wxPythonFull.spec.in
 
 if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
@@ -13,47 +15,50 @@ fi
 #----------------------------------------------------------------------
 # Initialization
 
 #----------------------------------------------------------------------
 # Initialization
 
-distdir=`pwd`/dist
-builddir=`pwd`/build_rpm
+version=`python -c "import setup;print setup.VERSION"`
+wxpdir=`pwd`
+wxdir=${wxpdir}/..
+distdir=${wxpdir}/dist
+builddir=${wxpdir}/_build_rpm
 rpmtop=${builddir}/rpmtop
 rpmtop=${builddir}/rpmtop
-cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/home/wxcvs
+cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
 pythonbin=/usr/bin/python
 port=GTK
 lcport=gtk
 pythonbin=/usr/bin/python
 port=GTK
 lcport=gtk
-tarname=wxPythonFull
-debug=0
-
+unicode=0
+tarname=wxPythonSrc
+rpmflag=-ba
 
 #----------------------------------------------------------------------
 # Check parameters
 
 
 #----------------------------------------------------------------------
 # 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."
+function usage {
+    echo "Usage: $0 py_version [command flags...]"
     echo "   py_version     String to append to $pythonbin (which python"
     echo "                  version to use.)"
     echo ""
     echo "command flags:"
     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 "   skipcopy       Don't copy the files for the tarball from the workspace"
     echo "   skiptar        Don't build the tarball"
     echo "   skiptar        Don't build the tarball"
-    echo "   skiprpm        Don't build the RPM (but why?)"
+    echo "   skiprpm        Don't build the RPM"
     echo "   skipclean      Don't do the cleanup at the end"
     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 "   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"
+    echo "   srpm           Only make the SRPM"
+#    echo "   smp            Add SMP=2 to the envivonment to speed wxGTK build"
 }
 
 }
 
-if [ $# -lt 3 ]; then
-    useage
+if [ $# -lt 1 ]; then
+    usage
     exit 1
 fi
 
     exit 1
 fi
 
-cvs_tag=$1
-version=$2
-pyver=$3
-shift;shift;shift
+pyver=$1
+shift
 
 
+ver2=`echo ${version} | cut -c 1,2,3`
+tarver=${tarname}-${version}
 
 python=${pythonbin}${pyver}
 if [ ! -e ${python} ]; then
 
 python=${pythonbin}${pyver}
 if [ ! -e ${python} ]; then
@@ -67,10 +72,12 @@ function makespec {
     cat ${spectemplate} \
        | sed s:@PYTHON@:${python}:g \
        | sed s:@PYVER@:${pyver}:g \
     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 \
        | 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
 }
 
        > ${distdir}/wxPython${port}.spec
 }
 
@@ -78,23 +85,23 @@ function makespec {
 
 for flag in $*; do
     case ${flag} in
 
 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 ;;
+       skipcopy)  skipcopy=1                          ;;
+       skipclean) skipclean=1                         ;;
+       skiptar)   skiptar=1; skipcopy=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}\""
 
        *)  echo "Unknown flag \"${flag}\""
-           useage
+           usage
            exit 1
     esac
 done
 
 
            exit 1
     esac
 done
 
 
-tarver=${tarname}-${version}
-
 #----------------------------------------------------------------------
 # Setup build dirs
 
 #----------------------------------------------------------------------
 # Setup build dirs
 
@@ -116,35 +123,69 @@ done
 
 
 #----------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------
-# Get the sources from CVS
+# Copy the sources from my CVS workspace
+
+function cleanup {
+    RMFILES=`find . -name "$1"`
+    if [ "$RMFILES" != "" ]; then
+       rm -rf $RMFILES
+    fi
+}
+
 
 
-if [ -z "${skipcvs}" ]; then
-    echo "*** Exporting CVS archive..."
+if [ -z "${skipcopy}" ]; then
+    echo "*** Copying CVS tree"
     pushd ${builddir} > /dev/null
     if [ -e ${tarver} ]; then
     pushd ${builddir} > /dev/null
     if [ -e ${tarver} ]; then
-       rm -rf ${tarver}
+       rm -rf ${tarver}
     fi
     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"
+    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 build 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
+    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
+    done
+
+    # 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
+
+    echo "*** Removing uneeded stuff from copy of CVS tree"
     pushd ${tarver} > /dev/null
     pushd ${tarver} > /dev/null
-    rm `find . -name .cvsignore`
+    cleanup .cvsignore
+    cleanup CVS
+    cleanup CVSROOT
+    rm BuildCVS.txt
     rm *.spec
     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
+    rm -rf docs/html
+    rm -rf docs/latex
+    rm -rf contrib/docs
+    rm -rf contrib/samples
+    rm locale/*.mo
+    cleanup ".#*"
+    cleanup "*~"
+    cleanup "*.orig"
+    cleanup "*.rej"
+    cleanup "*.pyc"
+    cleanup core
+    cleanup "core.[0-9]*"
+
+    rm -f wxPython/wx/*  > /dev/null 2>&1
 
     popd > /dev/null
     popd > /dev/null
 
     popd > /dev/null
     popd > /dev/null
@@ -152,21 +193,29 @@ fi
 
 
 #----------------------------------------------------------------------
 
 
 #----------------------------------------------------------------------
-# Make the spec file and copy to ${builddir}/${tarver}
+# Make the spec file and copy to ${builddir}/${tarver} so it will be
+# in the tar file when it's built
 
 
-#if [ -z "${skiptar}" ]; then
-    makespec
-    cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
-#fi
+# 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
 
 
 #----------------------------------------------------------------------
 # 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..."
     echo "*** Creating tarball..."
+    cp distrib/README.1st.txt ${builddir}/${tarver}
     pushd ${builddir} > /dev/null
     tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
     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
     echo "*** Compressing..."
     if [ -e ${distdir}/${tarver}.tar.gz ]; then
        rm ${distdir}/${tarver}.tar.gz
@@ -182,7 +231,7 @@ fi
 if [ -z "${skiprpm}" ]; then
     echo "*** Building RPMs..."
     cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
 if [ -z "${skiprpm}" ]; then
     echo "*** Building RPMs..."
     cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
-    rpm -ba \
+    rpmbuild ${rpmflag} \
        --define "_topdir ${rpmtop}" \
        --define "_tmppath ${builddir}" \
        ${distdir}/wxPython${port}.spec
        --define "_topdir ${rpmtop}" \
        --define "_tmppath ${builddir}" \
        ${distdir}/wxPython${port}.spec
@@ -190,6 +239,7 @@ if [ -z "${skiprpm}" ]; then
        echo "*** RPM failure, exiting."
        exit 1
     else
        echo "*** RPM failure, exiting."
        exit 1
     else
+       echo "*** Moving RPMs to ${distdir}"
        mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
     fi
 fi
        mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
     fi
 fi