]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/makerpm
Bug fix
[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 tarver=${tarname}-${version}
58
59
60 python=${pythonbin}${pyver}
61 if [ ! -e ${python} ]; then
62 echo "${python} not found!"
63 exit 1
64 fi
65
66
67 function makespec {
68 echo "*** Writing ${distdir}/wxPython${port}.spec"
69 cat ${spectemplate} \
70 | sed s:@PYTHON@:${python}:g \
71 | sed s:@PYVER@:${pyver}:g \
72 | sed s:@DEBUG@:${debug}:g \
73 | sed s:@PORT@:${port}:g \
74 | sed s:@LCPORT@:${lcport}:g \
75 | sed s:@TARNAME@:${tarname}:g \
76 | sed s:@VERSION@:${version}:g \
77 > ${distdir}/wxPython${port}.spec
78 }
79
80
81
82 for flag in $*; do
83 case ${flag} in
84 skipcvs) skipcvs=1 ;;
85 skipclean) skipclean=1 ;;
86 skiptar) skiptar=1 ;;
87 skiprpm) skiprpm=1 ;;
88 smp) export SMP=2 ;;
89 debug) debug=1 ;;
90 speconly) makespec; exit 0 ;;
91
92 *) echo "Unknown flag \"${flag}\""
93 useage
94 exit 1
95 esac
96 done
97
98
99 #----------------------------------------------------------------------
100 # Setup build dirs
101
102 echo "*** Setting up"
103
104 if [ ! -d ${builddir} ]; then
105 mkdir -p ${builddir}
106 fi
107
108 if [ ! -d ${distdir} ]; then
109 mkdir -p ${distdir}
110 fi
111
112 for dir in SOURCES SPECS BUILD RPMS SRPMS; do
113 if [ ! -d ${rpmtop}/${dir} ]; then
114 mkdir -p ${rpmtop}/${dir}
115 fi
116 done
117
118
119 #----------------------------------------------------------------------
120 # Get the sources from CVS
121
122 if [ -z "${skipcvs}" ]; then
123 echo "*** Exporting CVS archive..."
124 pushd ${builddir} > /dev/null
125 if [ -e ${tarver} ]; then
126 rm -rf ${tarver}
127 fi
128 cvs -d ${cvsroot} export -r ${cvs_tag} -d ${tarver} wxWindows > /dev/null 2>&1
129 if [ "$?" != "0" ]; then
130 echo "*** CVS failure, exiting."
131 exit 1
132 fi
133
134 echo "*** Removing unneeded stuff from CVS tree"
135 pushd ${tarver} > /dev/null
136 rm `find . -name .cvsignore`
137 rm *.spec
138 rm -rf demos
139 # rm -rf docs
140 rm -rf samples
141 rm -rf utils
142 # rm -rf include/wx/mgl
143 # rm -rf include/wx/motif
144 # rm -rf include/wx/os2
145 # rm -rf src/mgl
146 # rm -rf src/motif
147 # rm -rf src/os2
148 rm -rf wxPython/wxSWIG
149
150 popd > /dev/null
151 popd > /dev/null
152 fi
153
154
155 #----------------------------------------------------------------------
156 # Make the spec file and copy to ${builddir}/${tarver} so it will be
157 # in the tar file when it's built
158
159 # TODO? Output all combinations of spec files to put in the tar file??
160
161 makespec
162 cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
163
164
165 #----------------------------------------------------------------------
166 # Build the tar file
167
168 if [ -z "${skiptar}" ]; then
169 echo "*** Creating tarball..."
170 pushd ${builddir} > /dev/null
171 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
172 echo "*** Compressing..."
173 if [ -e ${distdir}/${tarver}.tar.gz ]; then
174 rm ${distdir}/${tarver}.tar.gz
175 fi
176 gzip --best ${distdir}/${tarver}.tar
177 popd > /dev/null
178 fi
179
180
181 #----------------------------------------------------------------------
182 # build the RPM
183
184 if [ -z "${skiprpm}" ]; then
185 echo "*** Building RPMs..."
186 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
187 rpm -ba \
188 --define "_topdir ${rpmtop}" \
189 --define "_tmppath ${builddir}" \
190 ${distdir}/wxPython${port}.spec
191 if [ "$?" != "0" ]; then
192 echo "*** RPM failure, exiting."
193 exit 1
194 else
195 echo "*** Moving RPMs to ${distdir}"
196 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
197 fi
198 fi
199
200 #----------------------------------------------------------------------
201 # Cleanup
202
203 if [ -z ${skipclean} ]; then
204 echo "*** Cleaning up"
205 rm -rf ${rpmtop}
206 rm -rf ${builddir}
207 fi
208
209
210