]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/makerpm
added wxSpinCtrl::SetSelection()
[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 distdir=`pwd`/dist
17 builddir=`pwd`/_build_rpm
18 rpmtop=${builddir}/rpmtop
19 cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/home/wxcvs
20 pythonbin=/usr/bin/python
21 port=GTK
22 lcport=gtk
23 tarname=wxPythonSrc
24 debug=0
25
26
27 #----------------------------------------------------------------------
28 # Check parameters
29
30 function useage {
31 echo "Usage: $0 cvs_tag wx_version py_version [command flags...]"
32 echo " cvs_tag Tag to use for CVS export"
33 echo " wx_version String to use for version in filenames, etc."
34 echo " py_version String to append to $pythonbin (which python"
35 echo " version to use.)"
36 echo ""
37 echo "command flags:"
38 echo " skipcvs Don't do the CVS export"
39 echo " skiptar Don't build the tarball"
40 echo " skiprpm Don't build the RPM (but why?)"
41 echo " skipclean Don't do the cleanup at the end"
42 echo " speconly Do nothing but write the RPM spec file"
43 echo " debug Make a __WXDEBUG__ version"
44 echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
45 }
46
47 if [ $# -lt 3 ]; then
48 useage
49 exit 1
50 fi
51
52 cvs_tag=$1
53 version=$2
54 pyver=$3
55 shift;shift;shift
56
57 ver2=`echo ${version} | cut -c 1,2,3`
58 tarver=${tarname}-${version}
59
60
61 python=${pythonbin}${pyver}
62 if [ ! -e ${python} ]; then
63 echo "${python} not found!"
64 exit 1
65 fi
66
67
68 function makespec {
69 echo "*** Writing ${distdir}/wxPython${port}.spec"
70 cat ${spectemplate} \
71 | sed s:@PYTHON@:${python}:g \
72 | sed s:@PYVER@:${pyver}:g \
73 | sed s:@DEBUG@:${debug}: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 > ${distdir}/wxPython${port}.spec
80 }
81
82
83
84 for flag in $*; do
85 case ${flag} in
86 skipcvs) skipcvs=1 ;;
87 skipclean) skipclean=1 ;;
88 skiptar) skiptar=1 ;;
89 skiprpm) skiprpm=1 ;;
90 smp) export SMP=2 ;;
91 debug) debug=1 ;;
92 speconly) makespec; exit 0 ;;
93
94 *) echo "Unknown flag \"${flag}\""
95 useage
96 exit 1
97 esac
98 done
99
100
101 #----------------------------------------------------------------------
102 # Setup build dirs
103
104 echo "*** Setting up"
105
106 if [ ! -d ${builddir} ]; then
107 mkdir -p ${builddir}
108 fi
109
110 if [ ! -d ${distdir} ]; then
111 mkdir -p ${distdir}
112 fi
113
114 for dir in SOURCES SPECS BUILD RPMS SRPMS; do
115 if [ ! -d ${rpmtop}/${dir} ]; then
116 mkdir -p ${rpmtop}/${dir}
117 fi
118 done
119
120
121 #----------------------------------------------------------------------
122 # Get the sources from CVS
123
124 if [ -z "${skipcvs}" ]; then
125 echo "*** Exporting CVS archive..."
126 pushd ${builddir} > /dev/null
127 if [ -e ${tarver} ]; then
128 rm -rf ${tarver}
129 fi
130 cvs -d ${cvsroot} export -r ${cvs_tag} -d ${tarver} wxWindows > /dev/null 2>&1
131 if [ "$?" != "0" ]; then
132 echo "*** CVS failure, exiting."
133 exit 1
134 fi
135
136 echo "*** Removing unneeded stuff from CVS tree"
137 pushd ${tarver} > /dev/null
138 rm `find . -name .cvsignore`
139 rm *.spec
140 rm -rf demos
141 # rm -rf docs
142 rm -rf docs/html
143 rm -rf docs/latex
144 rm -rf samples
145 rm -rf utils
146 # rm -rf include/wx/mgl
147 # rm -rf include/wx/motif
148 # rm -rf include/wx/os2
149 # rm -rf src/mgl
150 # rm -rf src/motif
151 # rm -rf src/os2
152 rm -rf wxPython/wxSWIG
153 rm -rf wxPython/tests
154
155 popd > /dev/null
156 popd > /dev/null
157 fi
158
159
160 #----------------------------------------------------------------------
161 # Make the spec file and copy to ${builddir}/${tarver} so it will be
162 # in the tar file when it's built
163
164 # TODO? Output all combinations of spec files to put in the tar file??
165
166 makespec
167 cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
168
169
170 #----------------------------------------------------------------------
171 # Build the tar file
172
173 if [ -z "${skiptar}" ]; then
174 echo "*** Creating tarball..."
175 pushd ${builddir} > /dev/null
176 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
177 echo "*** Compressing..."
178 if [ -e ${distdir}/${tarver}.tar.gz ]; then
179 rm ${distdir}/${tarver}.tar.gz
180 fi
181 gzip --best ${distdir}/${tarver}.tar
182 popd > /dev/null
183 fi
184
185
186 #----------------------------------------------------------------------
187 # build the RPM
188
189 if [ -z "${skiprpm}" ]; then
190 echo "*** Building RPMs..."
191 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
192 rpm -ba \
193 --define "_topdir ${rpmtop}" \
194 --define "_tmppath ${builddir}" \
195 ${distdir}/wxPython${port}.spec
196 if [ "$?" != "0" ]; then
197 echo "*** RPM failure, exiting."
198 exit 1
199 else
200 echo "*** Moving RPMs to ${distdir}"
201 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
202 fi
203 fi
204
205 #----------------------------------------------------------------------
206 # Cleanup
207
208 if [ -z ${skipclean} ]; then
209 echo "*** Cleaning up"
210 rm -rf ${rpmtop}
211 rm -rf ${builddir}
212 fi
213
214
215