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