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