]>
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 | |
357262e4 | 17 | builddir=`pwd`/_build_rpm |
4726eec6 RD |
18 | rpmtop=${builddir}/rpmtop |
19 | cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/home/wxcvs | |
20 | pythonbin=/usr/bin/python | |
21 | port=GTK | |
22 | lcport=gtk | |
357262e4 | 23 | tarname=wxPythonSrc |
4726eec6 RD |
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 | ||
357262e4 RD |
57 | tarver=${tarname}-${version} |
58 | ||
4726eec6 RD |
59 | |
60 | python=${pythonbin}${pyver} | |
61 | if [ ! -e ${python} ]; then | |
62 | echo "${python} not found!" | |
f6bcfd97 BP |
63 | exit 1 |
64 | fi | |
65 | ||
66 | ||
4726eec6 RD |
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 \ | |
357262e4 | 76 | | sed s:@VERSION@:${version}:g \ |
4726eec6 RD |
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 | ||
f6bcfd97 | 98 | |
4726eec6 RD |
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 | #---------------------------------------------------------------------- | |
357262e4 RD |
156 | # Make the spec file and copy to ${builddir}/${tarver} so it will be |
157 | # in the tar file when it's built | |
4726eec6 | 158 | |
357262e4 RD |
159 | makespec |
160 | cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec | |
4726eec6 RD |
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 | |
357262e4 | 193 | echo "*** Moving RPMs to ${distdir}" |
4726eec6 RD |
194 | mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir} |
195 | fi | |
196 | fi | |
197 | ||
198 | #---------------------------------------------------------------------- | |
199 | # Cleanup | |
200 | ||
201 | if [ -z ${skipclean} ]; then | |
202 | echo "*** Cleaning up" | |
203 | rm -rf ${rpmtop} | |
204 | rm -rf ${builddir} | |
205 | fi | |
f6bcfd97 BP |
206 | |
207 | ||
208 |