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