]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/makerpm
SourceForge patch #654210 to fix naming/numbering shared libs under OS X
[wxWidgets.git] / wxPython / distrib / makerpm
CommitLineData
f6bcfd97 1#!/bin/bash
4726eec6
RD
2#----------------------------------------------------------------------
3# Build an RPM containing both wxGTK and wxPython
f6bcfd97 4
4726eec6
RD
5spectemplate=distrib/wxPythonFull.spec.in
6
7if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
8 echo "Please run this script from the root wxPython directory."
f6bcfd97
BP
9 exit 1
10fi
11
4726eec6
RD
12
13#----------------------------------------------------------------------
14# Initialization
15
16distdir=`pwd`/dist
357262e4 17builddir=`pwd`/_build_rpm
4726eec6
RD
18rpmtop=${builddir}/rpmtop
19cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/home/wxcvs
20pythonbin=/usr/bin/python
21port=GTK
22lcport=gtk
357262e4 23tarname=wxPythonSrc
4726eec6
RD
24debug=0
25
26
27#----------------------------------------------------------------------
28# Check parameters
29
30function 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
47if [ $# -lt 3 ]; then
48 useage
49 exit 1
50fi
51
52cvs_tag=$1
53version=$2
54pyver=$3
55shift;shift;shift
56
b817523b 57ver2=`echo ${version} | cut -c 1,2,3`
357262e4
RD
58tarver=${tarname}-${version}
59
4726eec6
RD
60
61python=${pythonbin}${pyver}
62if [ ! -e ${python} ]; then
63 echo "${python} not found!"
f6bcfd97
BP
64 exit 1
65fi
66
67
4726eec6
RD
68function 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 \
357262e4 77 | sed s:@VERSION@:${version}:g \
b817523b 78 | sed s:@VER2@:${ver2}:g \
4726eec6
RD
79 > ${distdir}/wxPython${port}.spec
80}
81
82
83
84for 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
98done
99
f6bcfd97 100
4726eec6
RD
101#----------------------------------------------------------------------
102# Setup build dirs
103
104echo "*** Setting up"
105
106if [ ! -d ${builddir} ]; then
107 mkdir -p ${builddir}
108fi
109
110if [ ! -d ${distdir} ]; then
111 mkdir -p ${distdir}
112fi
113
114for dir in SOURCES SPECS BUILD RPMS SRPMS; do
115 if [ ! -d ${rpmtop}/${dir} ]; then
116 mkdir -p ${rpmtop}/${dir}
117 fi
118done
119
120
121#----------------------------------------------------------------------
122# Get the sources from CVS
123
124if [ -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
b817523b
RD
141# rm -rf docs
142 rm -rf docs/html
143 rm -rf docs/latex
4726eec6
RD
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
ba201fa4 153 rm -rf wxPython/tests
4726eec6
RD
154
155 popd > /dev/null
156 popd > /dev/null
157fi
158
159
160#----------------------------------------------------------------------
357262e4
RD
161# Make the spec file and copy to ${builddir}/${tarver} so it will be
162# in the tar file when it's built
4726eec6 163
73c7ae5a
RD
164# TODO? Output all combinations of spec files to put in the tar file??
165
357262e4
RD
166makespec
167cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
4726eec6
RD
168
169
170#----------------------------------------------------------------------
171# Build the tar file
172
173if [ -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
183fi
184
185
186#----------------------------------------------------------------------
187# build the RPM
188
189if [ -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
357262e4 200 echo "*** Moving RPMs to ${distdir}"
4726eec6
RD
201 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
202 fi
203fi
204
205#----------------------------------------------------------------------
206# Cleanup
207
208if [ -z ${skipclean} ]; then
209 echo "*** Cleaning up"
210 rm -rf ${rpmtop}
211 rm -rf ${builddir}
212fi
f6bcfd97
BP
213
214
215