]>
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 | |
4726eec6 RD |
31 | |
32 | #---------------------------------------------------------------------- | |
33 | # Check parameters | |
34 | ||
59455c67 RD |
35 | function 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 | 48 | if [ $# -lt 1 ]; then |
59455c67 | 49 | usage |
4726eec6 RD |
50 | exit 1 |
51 | fi | |
52 | ||
59455c67 RD |
53 | pyver=$1 |
54 | shift | |
4726eec6 | 55 | |
b817523b | 56 | ver2=`echo ${version} | cut -c 1,2,3` |
357262e4 RD |
57 | tarver=${tarname}-${version} |
58 | ||
4726eec6 RD |
59 | python=${pythonbin}${pyver} |
60 | if [ ! -e ${python} ]; then | |
61 | echo "${python} not found!" | |
f6bcfd97 BP |
62 | exit 1 |
63 | fi | |
64 | ||
65 | ||
4726eec6 | 66 | function 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 | ||
79 | for 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 | |
92 | done | |
93 | ||
f6bcfd97 | 94 | |
4726eec6 RD |
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 | #---------------------------------------------------------------------- | |
1e4a197e | 116 | # Copy the sources from my CVS workspace |
4726eec6 | 117 | |
59455c67 RD |
118 | function cleanup { |
119 | RMFILES=`find . -name "$1"` | |
120 | if [ "$RMFILES" != "" ]; then | |
121 | rm -rf $RMFILES | |
122 | fi | |
123 | } | |
124 | ||
125 | ||
1e4a197e RD |
126 | if [ -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 | |
70934952 | 137 | # copy all top dirs except CVS, build, demos, samples, utils, and wxPython |
59455c67 | 138 | for d in art build contrib debian distrib docs include lib locale misc patches src; 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 |
36e91097 RD |
143 | # # and tex2rtf too |
144 | # mkdir ${tarver}/utils | |
145 | # cp -Rpf --link ${wxdir}/utils/tex2rtf ${tarver}/utils | |
146 | # # tex2rtf needs these files | |
147 | # mkdir ${tarver}/samples | |
148 | # cp -Rpf --link ${wxdir}/samples/sample.* ${tarver}/samples | |
1e4a197e RD |
149 | |
150 | # now do the same thing for wxPython, skipping it's build dirs and such | |
6e83b721 RD |
151 | for dir in `grep -v '#' ${wxdir}/wxPython/distrib/DIRLIST`; do |
152 | mkdir ${tarver}/${dir} | |
153 | ##echo "cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir}" | |
154 | cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir} > /dev/null 2>&1 | |
1e4a197e RD |
155 | done |
156 | ||
f1860ca7 RD |
157 | # using DIRLIST as above will normally skip any files starting |
158 | # with a dot, but there are a few .files that we do want to | |
159 | # copy... | |
160 | for dir in wxPython/distrib/msw; do | |
161 | cp -pf --link ${wxdir}/${dir}/.[a-zA-Z]* ${tarver}/${dir} > /dev/null 2>&1 | |
162 | done | |
163 | ||
1e4a197e | 164 | echo "*** Removing uneeded stuff from copy of CVS tree" |
4726eec6 | 165 | pushd ${tarver} > /dev/null |
59455c67 RD |
166 | cleanup .cvsignore |
167 | cleanup CVS | |
168 | cleanup CVSROOT | |
169 | rm BuildCVS.txt | |
70934952 | 170 | rm -f ChangeLog |
4726eec6 | 171 | rm *.spec |
70934952 | 172 | rm -rf distrib/msw/tmake |
b817523b RD |
173 | rm -rf docs/html |
174 | rm -rf docs/latex | |
1e4a197e RD |
175 | rm -rf contrib/docs |
176 | rm -rf contrib/samples | |
177 | rm locale/*.mo | |
59455c67 | 178 | cleanup ".#*" |
70934952 | 179 | cleanup "#*#" |
59455c67 | 180 | cleanup "*~" |
1ab1deab RD |
181 | cleanup "*.orig" |
182 | cleanup "*.rej" | |
59455c67 RD |
183 | cleanup "*.pyc" |
184 | cleanup core | |
185 | cleanup "core.[0-9]*" | |
1e4a197e | 186 | |
70934952 RD |
187 | # ports that are not supported yet |
188 | cleanup cocoa | |
189 | cleanup mgl | |
190 | cleanup motif | |
191 | cleanup os2 | |
192 | cleanup x11 | |
193 | ||
59455c67 | 194 | rm -f wxPython/wx/* > /dev/null 2>&1 |
4726eec6 RD |
195 | |
196 | popd > /dev/null | |
197 | popd > /dev/null | |
198 | fi | |
199 | ||
200 | ||
201 | #---------------------------------------------------------------------- | |
357262e4 RD |
202 | # Make the spec file and copy to ${builddir}/${tarver} so it will be |
203 | # in the tar file when it's built | |
4726eec6 | 204 | |
73c7ae5a RD |
205 | # TODO? Output all combinations of spec files to put in the tar file?? |
206 | ||
357262e4 | 207 | makespec |
70934952 | 208 | cp ${distdir}/wxPython.spec ${builddir}/${tarver}/wxPython.spec |
4726eec6 RD |
209 | |
210 | ||
211 | #---------------------------------------------------------------------- | |
212 | # Build the tar file | |
213 | ||
214 | if [ -z "${skiptar}" ]; then | |
1e4a197e RD |
215 | echo "*** Creating language catalogs..." |
216 | pushd ${builddir}/${tarver}/locale > /dev/null | |
217 | make allmo | |
218 | popd > /dev/null | |
219 | ||
4726eec6 | 220 | echo "*** Creating tarball..." |
1e4a197e | 221 | cp distrib/README.1st.txt ${builddir}/${tarver} |
4726eec6 RD |
222 | pushd ${builddir} > /dev/null |
223 | tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null | |
1e4a197e | 224 | |
4726eec6 RD |
225 | echo "*** Compressing..." |
226 | if [ -e ${distdir}/${tarver}.tar.gz ]; then | |
227 | rm ${distdir}/${tarver}.tar.gz | |
228 | fi | |
229 | gzip --best ${distdir}/${tarver}.tar | |
230 | popd > /dev/null | |
231 | fi | |
232 | ||
233 | ||
234 | #---------------------------------------------------------------------- | |
235 | # build the RPM | |
236 | ||
237 | if [ -z "${skiprpm}" ]; then | |
238 | echo "*** Building RPMs..." | |
239 | cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES | |
70934952 RD |
240 | |
241 | if [ "${srpmonly}" = "1" ]; then | |
242 | rpmbuild -bs \ | |
243 | --define "_topdir ${rpmtop}" \ | |
244 | --define "_tmppath ${builddir}" \ | |
245 | --define "pyver ${pyver}" \ | |
246 | ${distdir}/wxPython.spec | |
247 | if [ "$?" != "0" ]; then | |
248 | echo "*** RPM failure, exiting." | |
249 | exit 1 | |
250 | fi | |
251 | ||
252 | else | |
253 | rpmbuild -ba \ | |
254 | --define "_topdir ${rpmtop}" \ | |
255 | --define "_tmppath ${builddir}" \ | |
256 | --define "port gtk" --define "unicode 0" \ | |
257 | --define "pyver ${pyver}" \ | |
258 | ${distdir}/wxPython.spec | |
259 | if [ "$?" != "0" ]; then | |
260 | echo "*** RPM failure, exiting." | |
261 | exit 1 | |
262 | fi | |
263 | ||
264 | rpmbuild -ba \ | |
265 | --define "_topdir ${rpmtop}" \ | |
266 | --define "_tmppath ${builddir}" \ | |
267 | --define "port gtk2" --define "unicode 1" \ | |
268 | --define "pyver ${pyver}" \ | |
269 | ${distdir}/wxPython.spec | |
270 | if [ "$?" != "0" ]; then | |
271 | echo "*** RPM failure, exiting." | |
272 | exit 1 | |
273 | fi | |
4726eec6 | 274 | fi |
70934952 RD |
275 | |
276 | echo "*** Moving RPMs to ${distdir}" | |
277 | mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir} | |
4726eec6 RD |
278 | fi |
279 | ||
280 | #---------------------------------------------------------------------- | |
281 | # Cleanup | |
282 | ||
283 | if [ -z ${skipclean} ]; then | |
284 | echo "*** Cleaning up" | |
285 | rm -rf ${rpmtop} | |
286 | rm -rf ${builddir} | |
287 | fi | |
f6bcfd97 BP |
288 | |
289 | ||
290 |