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