]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/makerpm
added unary wxPoint::operator-
[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=wxPython-src
30 srpmonly=0
31
32 #----------------------------------------------------------------------
33 # Check parameters
34
35 function usage {
36 echo "Usage: $0 py_version [command flags...]"
37 echo " py_version which python version to use."
38 echo ""
39 echo "command flags:"
40 echo " skipcopy Don't copy the files for the tarball from the workspace"
41 echo " skiptar Don't build the tarball"
42 echo " skiprpm Don't build the RPM"
43 echo " skipclean Don't do the cleanup at the end"
44 echo " speconly Do nothing but write the RPM spec file"
45 echo " srpm Only make the SRPM"
46 }
47
48 if [ $# -lt 1 ]; then
49 usage
50 exit 1
51 fi
52
53 pyver=$1
54 shift
55
56 ver2=`echo ${version} | cut -c 1,2,3`
57 tarver=${tarname}-${version}
58
59 python=${pythonbin}${pyver}
60 if [ ! -e ${python} ]; then
61 echo "${python} not found!"
62 exit 1
63 fi
64
65
66 function makespec {
67 echo "*** Writing ${distdir}/wxPython.spec"
68 cat ${spectemplate} \
69 | sed s:@PYTHON@:${python}:g \
70 | sed s:@PYVER@:${pyver}:g \
71 | sed s:@TARNAME@:${tarname}:g \
72 | sed s:@VERSION@:${version}:g \
73 | sed s:@VER2@:${ver2}:g \
74 > ${distdir}/wxPython.spec
75 }
76
77
78
79 for flag in $*; do
80 case ${flag} in
81 skipcopy) skipcopy=1 ;;
82 skipclean) skipclean=1 ;;
83 skiptar) skiptar=1; skipcopy=1 ;;
84 skiprpm) skiprpm=1 ;;
85 speconly) makespec; exit 0 ;;
86 srpm) srpmonly=1; ;;
87
88 *) echo "Unknown flag \"${flag}\""
89 usage
90 exit 1
91 esac
92 done
93
94
95 #----------------------------------------------------------------------
96 # Setup build dirs
97
98 echo "*** Setting up"
99
100 if [ ! -d ${builddir} ]; then
101 mkdir -p ${builddir}
102 fi
103
104 if [ ! -d ${distdir} ]; then
105 mkdir -p ${distdir}
106 fi
107
108 for dir in SOURCES SPECS BUILD RPMS SRPMS; do
109 if [ ! -d ${rpmtop}/${dir} ]; then
110 mkdir -p ${rpmtop}/${dir}
111 fi
112 done
113
114
115 #----------------------------------------------------------------------
116 # Copy the sources from my CVS workspace
117
118 function cleanup {
119 RMFILES=`find . -name "$1"`
120 if [ "$RMFILES" != "" ]; then
121 rm -rf $RMFILES
122 fi
123 }
124
125
126 if [ -z "${skipcopy}" ]; then
127 echo "*** Copying CVS tree"
128 pushd ${builddir} > /dev/null
129 if [ -e ${tarver} ]; then
130 rm -rf ${tarver}
131 fi
132 mkdir -p ${tarver}
133
134 # copy root dir contents
135 cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
136
137 # copy all top dirs except CVS, demos, samples, and wxPython
138 for d in art build contrib debian docs include lib locale patches samples src utils; do
139 if [ -e ${wxdir}/$d ]; then
140 cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
141 fi
142 done
143 mkdir ${tarver}/distrib
144 cp -Rpf --link ${wxdir}/distrib/scripts ${tarver}/distrib
145
146
147 # now do the same thing for wxPython, but use the DIRLIST to select dirs to copy
148 for dir in `grep -v '#' ${wxdir}/wxPython/distrib/DIRLIST`; do
149 mkdir ${tarver}/${dir}
150 ##echo "cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir}"
151 cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir} > /dev/null 2>&1
152 done
153
154 # using DIRLIST as above will normally skip any files starting
155 # with a dot, but there are a few .files that we do want to
156 # copy...
157 for dir in wxPython/distrib/msw; do
158 cp -pf --link ${wxdir}/${dir}/.[a-zA-Z]* ${tarver}/${dir} > /dev/null 2>&1
159 done
160
161 echo "*** Removing uneeded stuff from copy of CVS tree"
162 pushd ${tarver} > /dev/null
163 cleanup .cvsignore
164 cleanup CVS
165 cleanup CVSROOT
166 rm BuildCVS.txt
167 rm -f ChangeLog
168 rm *.spec
169 rm -rf distrib/msw/tmake
170 rm -rf docs/html
171 #rm -rf docs/latex
172 #rm -rf contrib/docs
173 #rm -rf contrib/samples
174 rm locale/*.mo
175 cleanup ".#*"
176 cleanup "#*#"
177 cleanup "*~"
178 cleanup "*.orig"
179 cleanup "*.rej"
180 cleanup "*.pyc"
181 cleanup core
182 cleanup "core.[0-9]*"
183 rm -f wxPython/samples/embedded/embedded
184 rm -f wxPython/samples/embedded/embedded.o
185
186 # ports that are not supported yet
187 #cleanup cocoa # wxMac needs some cocoa headers
188 cleanup mgl
189 cleanup motif
190 cleanup os2
191 cleanup x11
192 cleanup univ
193 cleanup wine
194
195 rm -f wxPython/wx/* > /dev/null 2>&1
196
197 popd > /dev/null
198 popd > /dev/null
199 fi
200
201
202 #----------------------------------------------------------------------
203 # Make the spec file and copy to ${builddir}/${tarver} so it will be
204 # in the tar file when it's built
205
206 # TODO? Output all combinations of spec files to put in the tar file??
207
208 makespec
209 cp ${distdir}/wxPython.spec ${builddir}/${tarver}/wxPython.spec
210
211
212 #----------------------------------------------------------------------
213 # Build the tar file
214
215 if [ -z "${skiptar}" ]; then
216 echo "*** Creating language catalogs..."
217 pushd ${builddir}/${tarver}/locale > /dev/null
218 make allmo
219 popd > /dev/null
220
221 echo "*** Creating tarball..."
222 cp distrib/README.1st.txt ${builddir}/${tarver}
223 pushd ${builddir} > /dev/null
224 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
225
226 echo "*** Compressing..."
227 if [ -e ${distdir}/${tarver}.tar.bz2 ]; then
228 rm ${distdir}/${tarver}.tar.bz2
229 fi
230 bzip2 --best ${distdir}/${tarver}.tar
231 popd > /dev/null
232 fi
233
234
235 #----------------------------------------------------------------------
236 # build the RPM
237
238 if [ -z "${skiprpm}" ]; then
239 echo "*** Building RPMs..."
240 cp ${distdir}/${tarver}.tar.bz2 ${rpmtop}/SOURCES
241
242 if [ "${srpmonly}" = "1" ]; then
243 rpmbuild -bs \
244 --define "_topdir ${rpmtop}" \
245 --define "_tmppath ${builddir}" \
246 --define "release 1" \
247 ${distdir}/wxPython.spec
248 if [ "$?" != "0" ]; then
249 echo "*** RPM failure, exiting."
250 exit 1
251 fi
252
253 else
254 rpmbuild -ba \
255 --define "_topdir ${rpmtop}" \
256 --define "_tmppath ${builddir}" \
257 --define "port gtk" --define "unicode 0" \
258 --define "pyver ${pyver}" \
259 ${distdir}/wxPython.spec
260 if [ "$?" != "0" ]; then
261 echo "*** RPM failure, exiting."
262 exit 1
263 fi
264
265 rpmbuild -ba \
266 --define "_topdir ${rpmtop}" \
267 --define "_tmppath ${builddir}" \
268 --define "port gtk2" --define "unicode 1" \
269 --define "pyver ${pyver}" \
270 ${distdir}/wxPython.spec
271 if [ "$?" != "0" ]; then
272 echo "*** RPM failure, exiting."
273 exit 1
274 fi
275 fi
276
277 echo "*** Moving RPMs to ${distdir}"
278 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
279 fi
280
281 #----------------------------------------------------------------------
282 # Cleanup
283
284 if [ -z ${skipclean} ]; then
285 echo "*** Cleaning up"
286 rm -rf ${rpmtop}
287 rm -rf ${builddir}
288 fi
289
290
291