]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/makerpm
Build and distrib tweaks
[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
154 popd > /dev/null
155 popd > /dev/null
156 fi
157
158
159 #----------------------------------------------------------------------
160 # Make the spec file and copy to ${builddir}/${tarver} so it will be
161 # in the tar file when it's built
162
163 # TODO? Output all combinations of spec files to put in the tar file??
164
165 makespec
166 cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
167
168
169 #----------------------------------------------------------------------
170 # Build the tar file
171
172 if [ -z "${skiptar}" ]; then
173 echo "*** Creating tarball..."
174 pushd ${builddir} > /dev/null
175 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
176 echo "*** Compressing..."
177 if [ -e ${distdir}/${tarver}.tar.gz ]; then
178 rm ${distdir}/${tarver}.tar.gz
179 fi
180 gzip --best ${distdir}/${tarver}.tar
181 popd > /dev/null
182 fi
183
184
185 #----------------------------------------------------------------------
186 # build the RPM
187
188 if [ -z "${skiprpm}" ]; then
189 echo "*** Building RPMs..."
190 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
191 rpm -ba \
192 --define "_topdir ${rpmtop}" \
193 --define "_tmppath ${builddir}" \
194 ${distdir}/wxPython${port}.spec
195 if [ "$?" != "0" ]; then
196 echo "*** RPM failure, exiting."
197 exit 1
198 else
199 echo "*** Moving RPMs to ${distdir}"
200 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
201 fi
202 fi
203
204 #----------------------------------------------------------------------
205 # Cleanup
206
207 if [ -z ${skipclean} ]; then
208 echo "*** Cleaning up"
209 rm -rf ${rpmtop}
210 rm -rf ${builddir}
211 fi
212
213
214