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