]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/makerpm
made multiple selection behave more consistently with the usual (Windows) way
[wxWidgets.git] / wxPython / distrib / makerpm
1 #!/bin/bash
2 #----------------------------------------------------------------------
3 # Build an RPM containing both wxGTK and wxPython
4
5 spectemplate=distrib/wxPythonFull.spec.in
6
7 if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
8 echo "Please run this script from the root wxPython directory."
9 exit 1
10 fi
11
12
13 #----------------------------------------------------------------------
14 # Initialization
15
16 wxpdir=`pwd`
17 wxdir=${wxpdir}/..
18 distdir=${wxpdir}/dist
19 builddir=${wxpdir}/_build_rpm
20 rpmtop=${builddir}/rpmtop
21 cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
22 pythonbin=/usr/bin/python
23 port=GTK
24 lcport=gtk
25 unicode=0
26 tarname=wxPythonSrc
27 rpmflag=-ba
28
29 #----------------------------------------------------------------------
30 # Check parameters
31
32 function useage {
33 echo "Usage: $0 wx_version py_version [command flags...]"
34 echo " wx_version String to use for version in filenames, etc."
35 echo " py_version String to append to $pythonbin (which python"
36 echo " version to use.)"
37 echo ""
38 echo "command flags:"
39 echo " skipcopy Don't copy the files for the tarball from the workspace"
40 echo " skiptar Don't build the tarball"
41 echo " skiprpm Don't build the RPM (but why?)"
42 echo " skipclean Don't do the cleanup at the end"
43 echo " gtk2 Build using wxGTK2 and Unicode"
44 echo " x11 Build using wxX11"
45 echo " speconly Do nothing but write the RPM spec file"
46 echo " srpm Only make the SRPM"
47 # echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
48 }
49
50 if [ $# -lt 2 ]; then
51 useage
52 exit 1
53 fi
54
55 version=$1
56 pyver=$2
57 shift;shift
58
59 ver2=`echo ${version} | cut -c 1,2,3`
60 tarver=${tarname}-${version}
61
62 python=${pythonbin}${pyver}
63 if [ ! -e ${python} ]; then
64 echo "${python} not found!"
65 exit 1
66 fi
67
68
69 function makespec {
70 echo "*** Writing ${distdir}/wxPython${port}.spec"
71 cat ${spectemplate} \
72 | sed s:@PYTHON@:${python}:g \
73 | sed s:@PYVER@:${pyver}:g \
74 | sed s:@PORT@:${port}:g \
75 | sed s:@LCPORT@:${lcport}:g \
76 | sed s:@TARNAME@:${tarname}:g \
77 | sed s:@VERSION@:${version}:g \
78 | sed s:@VER2@:${ver2}:g \
79 | sed s:@UNICODE@:${unicode}:g \
80 > ${distdir}/wxPython${port}.spec
81 }
82
83
84
85 for flag in $*; do
86 case ${flag} in
87 skipcopy) skipcopy=1 ;;
88 skipclean) skipclean=1 ;;
89 skiptar) skiptar=1 ;;
90 skiprpm) skiprpm=1 ;;
91 gtk2) unicode=1; port=GTK2; lcport=gtk2 ;;
92 x11) port=X11; lcport=x11 ;;
93 smp) export SMP=2 ;;
94 speconly) makespec; exit 0 ;;
95 srpm) rpmflag=-bs; ;;
96
97 *) echo "Unknown flag \"${flag}\""
98 useage
99 exit 1
100 esac
101 done
102
103
104 #----------------------------------------------------------------------
105 # Setup build dirs
106
107 echo "*** Setting up"
108
109 if [ ! -d ${builddir} ]; then
110 mkdir -p ${builddir}
111 fi
112
113 if [ ! -d ${distdir} ]; then
114 mkdir -p ${distdir}
115 fi
116
117 for dir in SOURCES SPECS BUILD RPMS SRPMS; do
118 if [ ! -d ${rpmtop}/${dir} ]; then
119 mkdir -p ${rpmtop}/${dir}
120 fi
121 done
122
123
124 #----------------------------------------------------------------------
125 # Copy the sources from my CVS workspace
126
127 if [ -z "${skipcopy}" ]; then
128 echo "*** Copying CVS tree"
129 pushd ${builddir} > /dev/null
130 if [ -e ${tarver} ]; then
131 rm -rf ${tarver}
132 fi
133 mkdir -p ${tarver}
134
135 # copy root dir contents
136 cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
137
138 # copy all top dirs except CVS, build, demos, utils, samples, and wxPython
139 for d in art contrib debian distrib docs include lib locale misc src; do
140 cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
141 done
142
143 # now do the same thing for wxPython, skipping it's build dirs and such
144 mkdir ${tarver}/wxPython
145 cp -pf --link ${wxdir}/wxPython/* ${tarver}/wxPython > /dev/null 2>&1
146 for d in contrib demo distrib distutils samples scripts src wxPython; do
147 cp -Rpf --link ${wxdir}/wxPython/$d ${tarver}/wxPython #> /dev/null 2>&1
148 done
149
150
151 echo "*** Removing uneeded stuff from copy of CVS tree"
152 pushd ${tarver} > /dev/null
153 rm `find . -name .cvsignore`
154 rm -rf `find . -name CVS`
155 rm *.spec
156 rm -rf docs/html
157 rm -rf docs/latex
158 rm -rf contrib/docs
159 rm -rf contrib/samples
160 rm locale/*.mo
161 rm `find . -name ".#*"`
162 rm `find . -name "*~"`
163 rm `find . -name "*.pyc"`
164 rm `find . -name "core"`
165 rm `find . -name "core.[0-9]*"`
166
167 rm -f wxPython/wxPython/* > /dev/null 2>&1
168 rm wxPython/demo/.setup.sh
169 rm -rf wxPython/contrib/art2d
170 rm -rf wxPython/contrib/canvas
171 rm -rf wxPython/contrib/canvas2
172 rm -rf wxPython/contrib/gizmos/contrib
173 rm -rf wxPython/contrib/ogl/contrib
174 rm -rf wxPython/contrib/stc/contrib
175 rm -rf wxPython/contrib/xrc/contrib
176
177 popd > /dev/null
178 popd > /dev/null
179 fi
180
181
182 #----------------------------------------------------------------------
183 # Make the spec file and copy to ${builddir}/${tarver} so it will be
184 # in the tar file when it's built
185
186 # TODO? Output all combinations of spec files to put in the tar file??
187
188 makespec
189 cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
190
191
192 #----------------------------------------------------------------------
193 # Build the tar file
194
195 if [ -z "${skiptar}" ]; then
196 echo "*** Creating language catalogs..."
197 pushd ${builddir}/${tarver}/locale > /dev/null
198 make allmo
199 popd > /dev/null
200
201 echo "*** Creating tarball..."
202 cp distrib/README.1st.txt ${builddir}/${tarver}
203 pushd ${builddir} > /dev/null
204 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
205
206 echo "*** Compressing..."
207 if [ -e ${distdir}/${tarver}.tar.gz ]; then
208 rm ${distdir}/${tarver}.tar.gz
209 fi
210 gzip --best ${distdir}/${tarver}.tar
211 popd > /dev/null
212 fi
213
214
215 #----------------------------------------------------------------------
216 # build the RPM
217
218 if [ -z "${skiprpm}" ]; then
219 echo "*** Building RPMs..."
220 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
221 rpmbuild ${rpmflag} \
222 --define "_topdir ${rpmtop}" \
223 --define "_tmppath ${builddir}" \
224 ${distdir}/wxPython${port}.spec
225 if [ "$?" != "0" ]; then
226 echo "*** RPM failure, exiting."
227 exit 1
228 else
229 echo "*** Moving RPMs to ${distdir}"
230 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
231 fi
232 fi
233
234 #----------------------------------------------------------------------
235 # Cleanup
236
237 if [ -z ${skipclean} ]; then
238 echo "*** Cleaning up"
239 rm -rf ${rpmtop}
240 rm -rf ${builddir}
241 fi
242
243
244