]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/distrib/wxPythonFull.spec.in
tweaked build ordering a bit
[wxWidgets.git] / wxPython / distrib / wxPythonFull.spec.in
... / ...
CommitLineData
1#----------------------------------------------------------------------
2# Name: wxPython.spec
3# Purpose: RPM Build and packaging instructions
4#
5# Author: Robin Dunn
6#
7# RCS-ID: $Id$
8# Copyright: (c) 2004 by Total Control Software
9# Licence: wxWindows license
10#----------------------------------------------------------------------
11
12
13# The following values can be set on the rpmbuild command line with
14# --define 'name VALUE' If no value is set on the command line then
15# the default value set here will be used instead.
16
17
18# Which version of Python to build with. Used to assemble python
19# binary name so use '2.2', '2.3', etc.
20%if %{?pyver:0}%{!?pyver:1}
21%define pyver 2.3
22%endif
23
24
25# Which wxWidgets port to build and use. Current acceptable values
26# are 'gtk' and 'gtk2'.
27%if %{?port:0}%{!?port:1}
28%define port gtk2
29%endif
30
31
32# Build in unicode mode? Can only be used if port is gtk2, acceptable
33# values are '0' and '1'
34%if %{?unicode:0}%{!?unicode:1}
35%define unicode 1
36%endif
37
38
39# Should the builtin image and etc. libs be used, or system libs?
40# Distro specific RPMs should probably set this to 0, generic ones
41# should use 1.
42# NOTE: I'm trying 0 for this next release to see if I can get rid of
43# this...
44%if %{?builtin_libs:0}%{!?builtin_libs:1}
45%define builtin_libs 0
46%endif
47
48
49# Should --enable-debug_flag be used in release builds? Using it
50# defines __WXDEBUG__ and gives us runtime diagnostics that are turned
51# into Python exceptions. (So turning it on is a very helpful thing
52# IMO and is recommended.) The code is still compiled with
53# optimization flags and and without debug info and such when this
54# option is used, it simply turns on some extra code.
55%if %{?debug_flag:0}%{!?debug_flag:1}
56%define debug_flag 1
57%endif
58
59
60# Used to set the Release tag below. I normally use it to define what
61# distro the RPM was build on and also include the version of Python
62# it was built with.
63%if %{?release:0}%{!?release:1}
64%define release 1_py%{pyver}
65%endif
66
67
68
69#----------------------------------------------------------------------
70# Other variables used below
71
72%define pref %{_prefix}
73%define python /usr/bin/python%{pyver}
74%define tarname @TARNAME@
75%define version @VERSION@
76%define ver2 @VER2@
77
78%define chartype %(if [ "%{unicode}" = "1" ]; then echo unicode; else echo ansi; fi)
79%define gtktype %(if [ "%{port}" = "gtk2" ]; then echo 2; fi)
80%define using_gtk1 %(if [ "%{port}" = "gtk" ]; then echo 1; else echo 0; fi)
81
82%define wxprefbase %{pref}/lib/wxPython
83%define wxpref %{wxprefbase}-%{version}-%{port}-%{chartype}
84%define pkgname wxPython
85
86# turn off the generation of debuginfo rpm (RH9) ??
87%define debug_package %{nil}
88
89
90#----------------------------------------------------------------------
91# Package definition
92#----------------------------------------------------------------------
93Name: %{pkgname}%{ver2}
94Summary: Cross platform GUI toolkit for Python
95Version: %{version}
96Release: %{release}
97Source0: %{tarname}-%{version}.tar.gz
98License: wx Library Licence, Version 3
99URL: http://wxPython.org/
100Packager: Robin Dunn <robin@alldunn.com>
101Group: Development/Python
102BuildRoot: %{_tmppath}/%{pkgname}-buildroot
103Prefix: %{pref}
104
105%description
106Cross platform GUI toolkit for Python
107
108
109
110
111%package -n %{pkgname}%{ver2}-%{port}-%{chartype}
112Summary: Cross platform GUI toolkit for Python
113Group: Development/Python
114Requires: %{pkgname}-common
115Obsoletes: wxPythonGTK%{gtktype}-py%{pyver}
116Provides: wxPython
117
118
119%description -n %{pkgname}%{ver2}-%{port}-%{chartype}
120wxPython is a GUI toolkit for the Python programming language. It
121 allows Python programmers to create programs with a robust, highly
122functional graphical user interface, simply and easily. It is
123implemented as a Python extension module (native code) that wraps the
124popular wxWidgets cross platform GUI library, which is written in C++.
125
126wxPython is a cross-platform toolkit. The same program will usually
127run on multiple platforms without modification. Currently supported
128platforms are 32-bit Microsoft Windows, most Unix or unix-like
129systems, and Macintosh OS X.
130
131This package contains the wxPython runtime files built for the
132wxWidgets %{port} port with %{chartype} character type.
133
134
135
136
137
138%package -n %{pkgname}-common-%{port}-%{chartype}
139Summary: Common files for needed by all wxPython runtimes
140Group: Development/Python
141Provides: %{pkgname}-common
142
143# They obsolete each other so any of them can be installed over another
144# without conflicts
145Obsoletes: %{pkgname}-common-gtk-ansi
146Obsoletes: %{pkgname}-common-gtk2-ansi
147Obsoletes: %{pkgname}-common-gtk2-unicode
148
149%description -n %{pkgname}-common-%{port}-%{chartype}
150This package contains the common files needed by any version of the
151wxPython runtime. This pacakge also installs a wx.pth file which will
152determine which of the installed runtimes is the default version of
153wxPython that is imported automatically with a bare "import wx".
154
155
156
157
158
159%package -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
160Summary: wxPython development files
161Group: Development/Libraries
162Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version}
163
164%description -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
165This packages contains the headers and etc. for building apps or
166Python extension modules that use the same wxWidgets shared libraries
167that wxPython uses.
168
169
170
171#----------------------------------------------------------------------
172%prep
173%setup -q -n %{tarname}-%{version}
174
175
176#----------------------------------------------------------------------
177%build
178
179WXDIR=`pwd`
180
181# Configure and build wxWidgets
182mkdir bld
183cd bld
184../configure \
185%if %{using_gtk1}
186 --with-gtk=1 \
187%else
188 --with-gtk=2 \
189%endif
190 --prefix=%{wxpref} \
191 --enable-monolithic \
192 --disable-rpath \
193 --with-opengl \
194 --enable-geometry \
195 --enable-optimise \
196 --enable-sound --with-sdl \
197 --enable-display \
198%if %{unicode}
199 --enable-unicode \
200%else
201 --disable-unicode \
202%endif
203%if %{debug_flag}
204 --enable-debug_flag \
205%endif
206 --disable-debugreport \
207%if %{builtin_libs}
208 --with-libjpeg=builtin \
209 --with-libpng=builtin \
210 --with-libtiff=builtin \
211 --with-zlib=builtin \
212%endif
213
214
215make
216make -C contrib/src/animate
217make -C contrib/src/gizmos
218make -C contrib/src/stc
219
220
221
222# Build wxPython
223cd $WXDIR/wxPython
224%{python} setup.py \
225 WXPORT=%{port} \
226 UNICODE=%{unicode} \
227 EP_ADD_OPTS=1 \
228 NO_SCRIPTS=1 \
229 WX_CONFIG="$WXDIR/bld/wx-config --no_rpath" \
230 build_ext --rpath=%{wxpref}/lib \
231 build
232
233
234
235#----------------------------------------------------------------------
236%install
237
238WXDIR=`pwd`
239
240# Install wxGTK and contribs
241cd bld
242make prefix=$RPM_BUILD_ROOT%{wxpref} install
243make -C contrib/src/animate prefix=$RPM_BUILD_ROOT%{wxpref} install
244make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
245make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install
246
247
248
249# Install wxPython for wxGTK
250cd $WXDIR/wxPython
251%{python} setup.py \
252 WXPORT=%{port} \
253 UNICODE=%{unicode} \
254 EP_ADD_OPTS=1 \
255 NO_SCRIPTS=1 \
256 WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref} --no_rpath" \
257 build_ext --rpath=%{wxpref}/lib \
258 install \
259 --root=$RPM_BUILD_ROOT
260
261
262# remove the wx-config symlink, we'll redo it when installing the -devel package
263rm $RPM_BUILD_ROOT%{wxpref}/bin/wx-config
264
265# make sure that debug info is stripped
266strip $RPM_BUILD_ROOT%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx/*.so
267
268
269# Since I want this RPM to be as generic as possible I won't let
270# distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
271# the #! line to use the real python pathname. Since some distros
272# install python 2.2 as python2 and others as python I can't let
273# distutils do that otherwise the dependencies will be fouled up.
274# Copy them manually instead, leaving the #!/usr/bin/env line intact.
275cd $WXDIR/wxPython
276mkdir -p $RPM_BUILD_ROOT%{pref}/bin
277for s in \
278 helpviewer \
279 img2png \
280 img2py \
281 img2xpm \
282 pyalacarte \
283 pyalamode \
284 pycrust \
285 pywrap \
286 pyshell \
287 pywxrc \
288 xrced; do
289 cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin
290done
291
292
293
294# install KDE & GNOME menu items
295mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development
296mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
297for d in distrib/*.desktop; do
298 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development
299 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications
300done
301
302# install KDE icons
303mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps
304mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
305install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png
306install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png
307install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png
308install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png
309install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png
310install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png
311
312# install Mandrake menu items
313mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu
314cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{pkgname} <<EOF
315?package(%{pkgname}): \\
316 command="%{_bindir}/pyshell" \\
317 needs="X11" \\
318 icon="PyCrust.png" \\
319 section="Applications/Development/Tools" \\
320 title="PyShell" \\
321 longtitle="GUI Python Shell"
322?package(%{pkgname}): \\
323 command="%{_bindir}/pycrust" \\
324 needs="X11" \\
325 icon="PyCrust.png" \\
326 section="Applications/Development/Tools" \\
327 title="PyCrust" \\
328 longtitle="GUI Python Shell with Filling"
329?package(%{pkgname}): \\
330 command="%{_bindir}/pyalamode" \\
331 needs="X11" \\
332 icon="PyCrust.png" \\
333 section="Applications/Development/Tools" \\
334 title="PyAlaMode" \\
335 longtitle="GUI Python Shell with Filling and editor windows"
336?package(%{pkgname}): \\
337 command="%{_bindir}/xrced" \\
338 needs="X11" \\
339 icon="XRCed.png" \\
340 section="Applications/Development/Tools" \\
341 title="XRCed" \\
342 longtitle="wxPython XRC resource editor"
343EOF
344
345
346#----------------------------------------------------------------------
347
348%post -n %{pkgname}%{ver2}-%{port}-%{chartype}
349if [ ! -e %{wxprefbase} ]; then
350 ln -s %{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
351fi
352
353%preun -n %{pkgname}%{ver2}-%{port}-%{chartype}
354if [ -L %{wxprefbase} ]; then
355 if [ `readlink %{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
356 rm -f %{wxprefbase}
357 fi
358fi
359
360
361
362
363%post -n %{pkgname}-common-%{port}-%{chartype}
364# This is done on Mandrake to update its menus:
365if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
366
367%postun -n %{pkgname}-common-%{port}-%{chartype}
368# This is done on Mandrake to update its menus:
369if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
370
371
372
373%post -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
374cd %{wxpref}/bin
375ln -s ../lib/wx/config/%{port}-%{chartype}* wx-config
376
377%preun -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
378rm %{wxpref}/bin/wx-config
379
380
381#----------------------------------------------------------------------
382%clean
383[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
384
385
386#----------------------------------------------------------------------
387
388%files -n %{pkgname}%{ver2}-%{port}-%{chartype}
389%defattr(-,root,root)
390%doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt
391%doc wxPython/docs/*
392%dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
393%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
394%dir %{wxpref}
395%dir %{wxpref}/lib
396%{wxpref}/lib/libwx_gtk*
397%{wxpref}/share
398
399
400
401%files -n %{pkgname}-common-%{port}-%{chartype}
402%defattr(-,root,root)
403%{pref}/lib*/python%{pyver}/site-packages/wxversion.*
404%{pref}/lib*/python%{pyver}/site-packages/wx.pth
405%{_bindir}/*
406%{_datadir}/applnk/Development/*
407%{_datadir}/applications/*
408%{_datadir}/icons/hicolor/*/apps/*
409%{_datadir}/pixmaps/*
410%{_libdir}/menu/*
411
412
413
414
415
416%files -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
417%defattr(-,root,root)
418%{wxpref}/include
419%{wxpref}/lib/wx
420%dir %{wxpref}/bin
421
422
423#----------------------------------------------------------------------
424# end of file