]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/makerpm
check for wxHAS_HUGE_FILES
[wxWidgets.git] / wxPython / distrib / makerpm
CommitLineData
f6bcfd97 1#!/bin/bash
4726eec6
RD
2#----------------------------------------------------------------------
3# Build an RPM containing both wxGTK and wxPython
f6bcfd97 4
59455c67
RD
5##set -o xtrace
6
4726eec6
RD
7spectemplate=distrib/wxPythonFull.spec.in
8
9if [ ! -d wxPython -o ! -e ${spectemplate} ]; then
10 echo "Please run this script from the root wxPython directory."
f6bcfd97
BP
11 exit 1
12fi
13
4726eec6
RD
14
15#----------------------------------------------------------------------
16# Initialization
17
59455c67 18version=`python -c "import setup;print setup.VERSION"`
1e4a197e
RD
19wxpdir=`pwd`
20wxdir=${wxpdir}/..
21distdir=${wxpdir}/dist
22builddir=${wxpdir}/_build_rpm
4726eec6 23rpmtop=${builddir}/rpmtop
1e4a197e 24cvsroot=:pserver:anoncvs@cvs.wxwindows.org:/pack/cvsroots/wxwindows
4726eec6
RD
25pythonbin=/usr/bin/python
26port=GTK
27lcport=gtk
1e4a197e 28unicode=0
357262e4 29tarname=wxPythonSrc
1e4a197e 30rpmflag=-ba
4726eec6
RD
31
32#----------------------------------------------------------------------
33# Check parameters
34
59455c67
RD
35function usage {
36 echo "Usage: $0 py_version [command flags...]"
4726eec6
RD
37 echo " py_version String to append to $pythonbin (which python"
38 echo " version to use.)"
39 echo ""
40 echo "command flags:"
1e4a197e 41 echo " skipcopy Don't copy the files for the tarball from the workspace"
4726eec6 42 echo " skiptar Don't build the tarball"
fda33067 43 echo " skiprpm Don't build the RPM"
4726eec6 44 echo " skipclean Don't do the cleanup at the end"
1e4a197e
RD
45 echo " gtk2 Build using wxGTK2 and Unicode"
46 echo " x11 Build using wxX11"
4726eec6 47 echo " speconly Do nothing but write the RPM spec file"
1e4a197e
RD
48 echo " srpm Only make the SRPM"
49# echo " smp Add SMP=2 to the envivonment to speed wxGTK build"
4726eec6
RD
50}
51
978cadd0 52if [ $# -lt 1 ]; then
59455c67 53 usage
4726eec6
RD
54 exit 1
55fi
56
59455c67
RD
57pyver=$1
58shift
4726eec6 59
b817523b 60ver2=`echo ${version} | cut -c 1,2,3`
357262e4
RD
61tarver=${tarname}-${version}
62
4726eec6
RD
63python=${pythonbin}${pyver}
64if [ ! -e ${python} ]; then
65 echo "${python} not found!"
f6bcfd97
BP
66 exit 1
67fi
68
69
4726eec6
RD
70function makespec {
71 echo "*** Writing ${distdir}/wxPython${port}.spec"
72 cat ${spectemplate} \
73 | sed s:@PYTHON@:${python}:g \
74 | sed s:@PYVER@:${pyver}:g \
4726eec6
RD
75 | sed s:@PORT@:${port}:g \
76 | sed s:@LCPORT@:${lcport}:g \
77 | sed s:@TARNAME@:${tarname}:g \
357262e4 78 | sed s:@VERSION@:${version}:g \
b817523b 79 | sed s:@VER2@:${ver2}:g \
1e4a197e 80 | sed s:@UNICODE@:${unicode}:g \
4726eec6
RD
81 > ${distdir}/wxPython${port}.spec
82}
83
84
85
86for flag in $*; do
87 case ${flag} in
1e4a197e
RD
88 skipcopy) skipcopy=1 ;;
89 skipclean) skipclean=1 ;;
fda33067 90 skiptar) skiptar=1; skipcopy=1 ;;
1e4a197e
RD
91 skiprpm) skiprpm=1 ;;
92 gtk2) unicode=1; port=GTK2; lcport=gtk2 ;;
93 x11) port=X11; lcport=x11 ;;
94 smp) export SMP=2 ;;
95 speconly) makespec; exit 0 ;;
96 srpm) rpmflag=-bs; ;;
4726eec6
RD
97
98 *) echo "Unknown flag \"${flag}\""
59455c67 99 usage
4726eec6
RD
100 exit 1
101 esac
102done
103
f6bcfd97 104
4726eec6
RD
105#----------------------------------------------------------------------
106# Setup build dirs
107
108echo "*** Setting up"
109
110if [ ! -d ${builddir} ]; then
111 mkdir -p ${builddir}
112fi
113
114if [ ! -d ${distdir} ]; then
115 mkdir -p ${distdir}
116fi
117
118for dir in SOURCES SPECS BUILD RPMS SRPMS; do
119 if [ ! -d ${rpmtop}/${dir} ]; then
120 mkdir -p ${rpmtop}/${dir}
121 fi
122done
123
124
125#----------------------------------------------------------------------
1e4a197e 126# Copy the sources from my CVS workspace
4726eec6 127
59455c67
RD
128function cleanup {
129 RMFILES=`find . -name "$1"`
130 if [ "$RMFILES" != "" ]; then
131 rm -rf $RMFILES
132 fi
133}
134
135
1e4a197e
RD
136if [ -z "${skipcopy}" ]; then
137 echo "*** Copying CVS tree"
4726eec6
RD
138 pushd ${builddir} > /dev/null
139 if [ -e ${tarver} ]; then
1e4a197e 140 rm -rf ${tarver}
4726eec6 141 fi
1e4a197e
RD
142 mkdir -p ${tarver}
143
144 # copy root dir contents
145 cp -pf --link ${wxdir}/* ${tarver} > /dev/null 2>&1
4726eec6 146
1e4a197e 147 # copy all top dirs except CVS, build, demos, utils, samples, and wxPython
59455c67 148 for d in art build contrib debian distrib docs include lib locale misc patches src; do
1fded56b
RD
149 if [ -e ${wxdir}/$d ]; then
150 cp -Rpf --link ${wxdir}/$d ${tarver} #> /dev/null 2>&1
151 fi
1e4a197e 152 done
36e91097
RD
153# # and tex2rtf too
154# mkdir ${tarver}/utils
155# cp -Rpf --link ${wxdir}/utils/tex2rtf ${tarver}/utils
156# # tex2rtf needs these files
157# mkdir ${tarver}/samples
158# cp -Rpf --link ${wxdir}/samples/sample.* ${tarver}/samples
1e4a197e
RD
159
160 # now do the same thing for wxPython, skipping it's build dirs and such
6e83b721
RD
161 for dir in `grep -v '#' ${wxdir}/wxPython/distrib/DIRLIST`; do
162 mkdir ${tarver}/${dir}
163 ##echo "cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir}"
164 cp -pf --link ${wxdir}/${dir}/* ${tarver}/${dir} > /dev/null 2>&1
1e4a197e
RD
165 done
166
f1860ca7
RD
167 # using DIRLIST as above will normally skip any files starting
168 # with a dot, but there are a few .files that we do want to
169 # copy...
170 for dir in wxPython/distrib/msw; do
171 cp -pf --link ${wxdir}/${dir}/.[a-zA-Z]* ${tarver}/${dir} > /dev/null 2>&1
172 done
173
1e4a197e 174 echo "*** Removing uneeded stuff from copy of CVS tree"
4726eec6 175 pushd ${tarver} > /dev/null
59455c67
RD
176 cleanup .cvsignore
177 cleanup CVS
178 cleanup CVSROOT
179 rm BuildCVS.txt
4726eec6 180 rm *.spec
b817523b
RD
181 rm -rf docs/html
182 rm -rf docs/latex
1e4a197e
RD
183 rm -rf contrib/docs
184 rm -rf contrib/samples
185 rm locale/*.mo
59455c67
RD
186 cleanup ".#*"
187 cleanup "*~"
1ab1deab
RD
188 cleanup "*.orig"
189 cleanup "*.rej"
59455c67
RD
190 cleanup "*.pyc"
191 cleanup core
192 cleanup "core.[0-9]*"
1e4a197e 193
59455c67 194 rm -f wxPython/wx/* > /dev/null 2>&1
4726eec6
RD
195
196 popd > /dev/null
197 popd > /dev/null
198fi
199
200
201#----------------------------------------------------------------------
357262e4
RD
202# Make the spec file and copy to ${builddir}/${tarver} so it will be
203# in the tar file when it's built
4726eec6 204
73c7ae5a
RD
205# TODO? Output all combinations of spec files to put in the tar file??
206
357262e4
RD
207makespec
208cp ${distdir}/wxPython${port}.spec ${builddir}/${tarver}/wxPython${port}.spec
4726eec6
RD
209
210
211#----------------------------------------------------------------------
212# Build the tar file
213
214if [ -z "${skiptar}" ]; then
1e4a197e
RD
215 echo "*** Creating language catalogs..."
216 pushd ${builddir}/${tarver}/locale > /dev/null
217 make allmo
218 popd > /dev/null
219
4726eec6 220 echo "*** Creating tarball..."
1e4a197e 221 cp distrib/README.1st.txt ${builddir}/${tarver}
4726eec6
RD
222 pushd ${builddir} > /dev/null
223 tar cvf ${distdir}/${tarver}.tar ${tarver} > /dev/null
1e4a197e 224
4726eec6
RD
225 echo "*** Compressing..."
226 if [ -e ${distdir}/${tarver}.tar.gz ]; then
227 rm ${distdir}/${tarver}.tar.gz
228 fi
229 gzip --best ${distdir}/${tarver}.tar
230 popd > /dev/null
231fi
232
233
234#----------------------------------------------------------------------
235# build the RPM
236
237if [ -z "${skiprpm}" ]; then
238 echo "*** Building RPMs..."
239 cp ${distdir}/${tarver}.tar.gz ${rpmtop}/SOURCES
1e4a197e 240 rpmbuild ${rpmflag} \
4726eec6
RD
241 --define "_topdir ${rpmtop}" \
242 --define "_tmppath ${builddir}" \
243 ${distdir}/wxPython${port}.spec
244 if [ "$?" != "0" ]; then
245 echo "*** RPM failure, exiting."
246 exit 1
247 else
357262e4 248 echo "*** Moving RPMs to ${distdir}"
4726eec6
RD
249 mv -f `find ${rpmtop} -name "wxPython*.rpm"` ${distdir}
250 fi
251fi
252
253#----------------------------------------------------------------------
254# Cleanup
255
256if [ -z ${skipclean} ]; then
257 echo "*** Cleaning up"
258 rm -rf ${rpmtop}
259 rm -rf ${builddir}
260fi
f6bcfd97
BP
261
262
263