]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/makerpm
New wxDesigner-less version of the MimeTypesManager demo
[wxWidgets.git] / wxPython / distrib / makerpm
CommitLineData
f6bcfd97 1#!/bin/bash
4726eec6
RD
2#----------------------------------------------------------------------
3# Build an RPM containing both wxGTK and wxPython
f6bcfd97 4
4726eec6
RD
5spectemplate=distrib/wxPythonFull.spec.in
6
7if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
8 echo "Please run this script from the root wxPython directory."
f6bcfd97
BP
9 exit 1
10fi
11
4726eec6
RD
12
13#----------------------------------------------------------------------
14# Initialization
15
1e4a197e
RD
16wxpdir=`pwd`
17wxdir=${wxpdir}/..
18distdir=${wxpdir}/dist
19builddir=${wxpdir}/_build_rpm
4726eec6 20rpmtop=${builddir}/rpmtop
1e4a197e 21cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
4726eec6
RD
22pythonbin=/usr/bin/python
23port=GTK
24lcport=gtk
1e4a197e 25unicode=0
357262e4 26tarname=wxPythonSrc
1e4a197e 27rpmflag=-ba
4726eec6
RD
28
29#----------------------------------------------------------------------
30# Check parameters
31
32function useage {
1e4a197e 33 echo "Usage: $0 wx_version py_version [command flags...]"
4726eec6
RD
34 echo " wx_version String to use for version in filenames, etc."
35 echo " py_version String to append to $pythonbin (which python"
36 echo " version to use.)"
37 echo ""
38 echo "command flags:"
1e4a197e 39 echo " skipcopy Don't copy the files for the tarball from the workspace"
4726eec6
RD
40 echo " skiptar Don't build the tarball"
41 echo " skiprpm Don't build the RPM (but why?)"
42 echo " skipclean Don't do the cleanup at the end"
1e4a197e
RD
43 echo " gtk2 Build using wxGTK2 and Unicode"
44 echo " x11 Build using wxX11"
4726eec6 45 echo " speconly Do nothing but write the RPM spec file"
1e4a197e
RD
46 echo " srpm Only make the SRPM"
47# echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
4726eec6
RD
48}
49
1e4a197e 50if [ $# -lt 2 ]; then
4726eec6
RD
51 useage
52 exit 1
53fi
54
1e4a197e
RD
55version=$1
56pyver=$2
57shift;shift
4726eec6 58
b817523b 59ver2=`echo ${version} | cut -c 1,2,3`
357262e4
RD
60tarver=${tarname}-${version}
61
4726eec6
RD
62python=${pythonbin}${pyver}
63if [ ! -e ${python} ]; then
64 echo "${python} not found!"
f6bcfd97
BP
65 exit 1
66fi
67
68
4726eec6
RD
69function makespec {
70 echo "*** Writing ${distdir}/wxPython${port}.spec"
71 cat ${spectemplate} \
72 | sed s:@PYTHON@:${python}:g \
73 | sed s:@PYVER@:${pyver}:g \
4726eec6
RD
74 | sed s:@PORT@:${port}:g \
75 | sed s:@LCPORT@:${lcport}:g \
76 | sed s:@TARNAME@:${tarname}:g \
357262e4 77 | sed s:@VERSION@:${version}:g \
b817523b 78 | sed s:@VER2@:${ver2}:g \
1e4a197e 79 | sed s:@UNICODE@:${unicode}:g \
4726eec6
RD
80 > ${distdir}/wxPython${port}.spec
81}
82
83
84
85for flag in $*; do
86 case ${flag} in
1e4a197e
RD
87 skipcopy) skipcopy=1 ;;
88 skipclean) skipclean=1 ;;
89 skiptar) skiptar=1 ;;
90 skiprpm) skiprpm=1 ;;
91 gtk2) unicode=1; port=GTK2; lcport=gtk2 ;;
92 x11) port=X11; lcport=x11 ;;
93 smp) export SMP=2 ;;
94 speconly) makespec; exit 0 ;;
95 srpm) rpmflag=-bs; ;;
4726eec6
RD
96
97 *) echo "Unknown flag \"${flag}\""
98 useage
99 exit 1
100 esac
101done
102
f6bcfd97 103
4726eec6
RD
104#----------------------------------------------------------------------
105# Setup build dirs
106
107echo "*** Setting up"
108
109if [ ! -d ${builddir} ]; then
110 mkdir -p ${builddir}
111fi
112
113if [ ! -d ${distdir} ]; then
114 mkdir -p ${distdir}
115fi
116
117for dir in SOURCES SPECS BUILD RPMS SRPMS; do
118 if [ ! -d ${rpmtop}/${dir} ]; then
119 mkdir -p ${rpmtop}/${dir}
120 fi
121done
122
123
124#----------------------------------------------------------------------
1e4a197e 125# Copy the sources from my CVS workspace
4726eec6 126
1e4a197e
RD
127if [ -z "${skipcopy}" ]; then
128 echo "*** Copying CVS tree"
4726eec6
RD
129 pushd ${builddir} > /dev/null
130 if [ -e ${tarver} ]; then
1e4a197e 131 rm -rf ${tarver}
4726eec6 132 fi
1e4a197e
RD
133 mkdir -p ${tarver}
134
135 # copy root dir contents
136 cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
4726eec6 137
1e4a197e 138 # copy all top dirs except CVS, build, demos, utils, samples, and wxPython
1fded56b
RD
139 for d in art contrib debian distrib docs include lib locale misc patches src; do
140 if [ -e ${wxdir}/$d ]; then
141 cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
142 fi
1e4a197e
RD
143 done
144
145 # now do the same thing for wxPython, skipping it's build dirs and such
146 mkdir ${tarver}/wxPython
147 cp -pf --link ${wxdir}/wxPython/* ${tarver}/wxPython > /dev/null 2>&1
1fded56b 148 for d in contrib demo distrib distutils docs licence samples scripts src wx wxPython; do
1e4a197e
RD
149 cp -Rpf --link ${wxdir}/wxPython/$d ${tarver}/wxPython #> /dev/null 2>&1
150 done
151
152
153 echo "*** Removing uneeded stuff from copy of CVS tree"
4726eec6
RD
154 pushd ${tarver} > /dev/null
155 rm `find . -name .cvsignore`
1e4a197e 156 rm -rf `find . -name CVS`
4726eec6 157 rm *.spec
b817523b
RD
158 rm -rf docs/html
159 rm -rf docs/latex
1e4a197e
RD
160 rm -rf contrib/docs
161 rm -rf contrib/samples
162 rm locale/*.mo
163 rm `find . -name ".#*"`
164 rm `find . -name "*~"`
165 rm `find . -name "*.pyc"`
166 rm `find . -name "core"`
167 rm `find . -name "core.[0-9]*"`
168
169 rm -f wxPython/wxPython/* > /dev/null 2>&1
170 rm wxPython/demo/.setup.sh
171 rm -rf wxPython/contrib/art2d
172 rm -rf wxPython/contrib/canvas
173 rm -rf wxPython/contrib/canvas2
174 rm -rf wxPython/contrib/gizmos/contrib
175 rm -rf wxPython/contrib/ogl/contrib
176 rm -rf wxPython/contrib/stc/contrib
177 rm -rf wxPython/contrib/xrc/contrib
4726eec6
RD
178
179 popd > /dev/null
180 popd > /dev/null
181fi
182
183
184#----------------------------------------------------------------------
357262e4
RD
185# Make the spec file and copy to ${builddir}/${tarver} so it will be
186# in the tar file when it's built
4726eec6 187
73c7ae5a
RD
188# TODO? Output all combinations of spec files to put in the tar file??
189
357262e4
RD
190makespec
191cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
4726eec6
RD
192
193
194#----------------------------------------------------------------------
195# Build the tar file
196
197if [ -z "${skiptar}" ]; then
1e4a197e
RD
198 echo "*** Creating language catalogs..."
199 pushd ${builddir}/${tarver}/locale > /dev/null
200 make allmo
201 popd > /dev/null
202
4726eec6 203 echo "*** Creating tarball..."
1e4a197e 204 cp distrib/README.1st.txt ${builddir}/${tarver}
4726eec6
RD
205 pushd ${builddir} > /dev/null
206 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
1e4a197e 207
4726eec6
RD
208 echo "*** Compressing..."
209 if [ -e ${distdir}/${tarver}.tar.gz ]; then
210 rm ${distdir}/${tarver}.tar.gz
211 fi
212 gzip --best ${distdir}/${tarver}.tar
213 popd > /dev/null
214fi
215
216
217#----------------------------------------------------------------------
218# build the RPM
219
220if [ -z "${skiprpm}" ]; then
221 echo "*** Building RPMs..."
222 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
1e4a197e 223 rpmbuild ${rpmflag} \
4726eec6
RD
224 --define "_topdir ${rpmtop}" \
225 --define "_tmppath ${builddir}" \
226 ${distdir}/wxPython${port}.spec
227 if [ "$?" != "0" ]; then
228 echo "*** RPM failure, exiting."
229 exit 1
230 else
357262e4 231 echo "*** Moving RPMs to ${distdir}"
4726eec6
RD
232 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
233 fi
234fi
235
236#----------------------------------------------------------------------
237# Cleanup
238
239if [ -z ${skipclean} ]; then
240 echo "*** Cleaning up"
241 rm -rf ${rpmtop}
242 rm -rf ${builddir}
243fi
f6bcfd97
BP
244
245
246