]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/distrib/wxPythonFull.spec.in
PRIOR/NEXT build fixes.
[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.3', '2.4', etc.
20%if %{?pyver:0}%{!?pyver:1}
21%define pyver 2.4
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 built 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# This one is used to control whether the full 4 components of the
69# verseion number are used in the site-packages subdirectory name. By
70# default only 2 or 3 components (depending on stable/unstable status)
71# are used.
72%if %{?fullver:0}%{!?fullver:1}
73%define fullver 0
74%endif
75
76
77# Whether to add --enable-mediactrl to the wxWidgets configure. For
78# some older versions of gstreamer-0.8 it currently incorerctly allows
79# its use eventhough there is a compatibility problem that causes a
80# failed compile.
81%if %{?mediactrl:0}%{!?mediactrl:1}
82%define mediactrl 0
83%endif
84
85
86#----------------------------------------------------------------------
87# Other variables used below
88
89%define pref %{_prefix}
90%define python /usr/bin/python%{pyver}
91%define tarname @TARNAME@
92%define version @VERSION@
93%define ver2 @VER2@
94
95%define chartype %(if [ "%{unicode}" = "1" ]; then echo unicode; else echo ansi; fi)
96%define gtktype %(if [ "%{port}" = "gtk2" ]; then echo 2; fi)
97%define using_gtk1 %(if [ "%{port}" = "gtk" ]; then echo 1; else echo 0; fi)
98
99%define wxprefbase %{pref}/lib/wxPython
100%define wxpref %{wxprefbase}-%{version}-%{port}-%{chartype}
101%define pkgname wxPython
102
103# turn off the generation of debuginfo rpm (RH9) ??
104%define debug_package %{nil}
105
106
107#----------------------------------------------------------------------
108# Package definition
109#----------------------------------------------------------------------
110Name: %{pkgname}%{ver2}
111Summary: Cross platform GUI toolkit for Python
112Version: %{version}
113Release: %{release}
114Source0: %{tarname}-%{version}.tar.gz
115License: wx Library Licence, Version 3
116URL: http://wxPython.org/
117Packager: Robin Dunn <robin@alldunn.com>
118Group: Development/Python
119BuildRoot: %{_tmppath}/%{pkgname}-buildroot
120Prefix: %{pref}
121
122%description
123Cross platform GUI toolkit for Python
124
125
126
127
128%package -n %{pkgname}%{ver2}-%{port}-%{chartype}
129Summary: Cross platform GUI toolkit for Python
130Group: Development/Python
131Requires: %{pkgname}-common
132Obsoletes: wxPythonGTK%{gtktype}-py%{pyver}, wxPythonGTK%{gtktype}
133Provides: wxPython
134
135
136%description -n %{pkgname}%{ver2}-%{port}-%{chartype}
137wxPython is a GUI toolkit for the Python programming language. It
138allows Python programmers to create programs with a robust, highly
139functional graphical user interface, simply and easily. It is
140implemented as a Python extension module (native code) that wraps the
141popular wxWidgets cross platform GUI library, which is written in C++.
142
143wxPython is a cross-platform toolkit. The same program will usually
144run on multiple platforms without modification. Currently supported
145platforms are 32-bit Microsoft Windows, most Unix or unix-like
146systems, and Macintosh OS X.
147
148This package contains the wxPython runtime files built for the
149wxWidgets %{port} port with %{chartype} character type.
150
151
152
153
154
155%package -n %{pkgname}-common-%{port}-%{chartype}
156Summary: Common files for needed by all wxPython runtimes
157Group: Development/Python
158Provides: %{pkgname}-common
159
160# They obsolete each other so any of them can be installed over another
161# without conflicts
162Obsoletes: %{pkgname}-common-gtk-ansi
163Obsoletes: %{pkgname}-common-gtk2-ansi
164Obsoletes: %{pkgname}-common-gtk2-unicode
165
166%description -n %{pkgname}-common-%{port}-%{chartype}
167This package contains the common files needed by any version of the
168wxPython runtime. This pacakge also installs a wx.pth file which will
169determine which of the installed runtimes is the default version of
170wxPython that is imported automatically with a bare "import wx".
171
172
173
174
175
176%package -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
177Summary: wxPython development files
178Group: Development/Libraries
179Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version}
180
181%description -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
182This packages contains the headers and etc. for building apps or
183Python extension modules that use the same wxWidgets shared libraries
184that wxPython uses.
185
186
187
188#----------------------------------------------------------------------
189%prep
190%setup -q -n %{tarname}-%{version}
191
192
193#----------------------------------------------------------------------
194%build
195
196WXDIR=`pwd`
197
198# Configure and build wxWidgets
199mkdir bld
200cd bld
201../configure \
202%if %{using_gtk1}
203 --with-gtk=1 \
204%else
205 --with-gtk=2 \
206%endif
207 --prefix=%{wxpref} \
208 --enable-monolithic \
209 --disable-rpath \
210 --with-opengl \
211 --with-gnomeprint \
212 --enable-geometry \
213 --enable-optimise \
214 --enable-sound --with-sdl \
215%if %{mediactrl}
216 --enable-mediactrl \
217%endif
218 --enable-display \
219%if %{unicode}
220 --enable-unicode \
221%else
222 --disable-unicode \
223%endif
224%if %{debug_flag}
225 --enable-debug_flag \
226%endif
227 --disable-debugreport \
228%if %{builtin_libs}
229 --with-libjpeg=builtin \
230 --with-libpng=builtin \
231 --with-libtiff=builtin \
232 --with-zlib=builtin \
233%endif
234
235
236make
237make -C contrib/src/animate
238make -C contrib/src/gizmos
239make -C contrib/src/stc
240
241
242
243# Build wxPython
244cd $WXDIR/wxPython
245%{python} setup.py \
246 WXPORT=%{port} \
247 UNICODE=%{unicode} \
248 EP_ADD_OPTS=1 \
249 EP_FULL_VER=%{fullver} \
250 NO_SCRIPTS=1 \
251 WX_CONFIG="$WXDIR/bld/wx-config --no_rpath" \
252 build_ext --rpath=%{wxpref}/lib \
253 build
254
255
256
257#----------------------------------------------------------------------
258%install
259
260WXDIR=`pwd`
261
262# Install wxGTK and contribs
263cd bld
264make prefix=$RPM_BUILD_ROOT%{wxpref} install
265make -C contrib/src/animate prefix=$RPM_BUILD_ROOT%{wxpref} install
266make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
267make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install
268
269
270
271# Install wxPython for wxGTK
272cd $WXDIR/wxPython
273%{python} setup.py \
274 WXPORT=%{port} \
275 UNICODE=%{unicode} \
276 EP_ADD_OPTS=1 \
277 EP_FULL_VER=%{fullver} \
278 NO_SCRIPTS=1 \
279 WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref} --no_rpath" \
280 build_ext --rpath=%{wxpref}/lib \
281 install \
282 --root=$RPM_BUILD_ROOT
283
284
285# remove the wx-config symlink, we'll redo it when installing the -devel package
286rm $RPM_BUILD_ROOT%{wxpref}/bin/wx-config
287
288# make sure that debug info is stripped
289strip $RPM_BUILD_ROOT%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx/*.so
290
291
292# Since I want this RPM to be as generic as possible I won't let
293# distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
294# the #! line to use the real python pathname. Since some distros
295# install python 2.2 as python2 and others as python I can't let
296# distutils do that otherwise the dependencies will be fouled up.
297# Copy them manually instead, leaving the #!/usr/bin/env line intact.
298cd $WXDIR/wxPython
299mkdir -p $RPM_BUILD_ROOT%{pref}/bin
300for s in \
301 helpviewer \
302 img2png \
303 img2py \
304 img2xpm \
305 pyalacarte \
306 pyalamode \
307 pycrust \
308 pywrap \
309 pyshell \
310 pywxrc \
311 xrced; do
312 cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin
313done
314
315
316
317# install KDE & GNOME menu items
318mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development
319mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
320for d in distrib/*.desktop; do
321 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development
322 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications
323done
324
325# install KDE icons
326mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps
327mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
328install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png
329install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png
330install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png
331install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png
332install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png
333install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png
334
335# install Mandrake menu items
336mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu
337cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{pkgname} <<EOF
338?package(%{pkgname}): \\
339 command="%{_bindir}/pyshell" \\
340 needs="X11" \\
341 icon="PyCrust.png" \\
342 section="Applications/Development/Tools" \\
343 title="PyShell" \\
344 longtitle="GUI Python Shell"
345?package(%{pkgname}): \\
346 command="%{_bindir}/pycrust" \\
347 needs="X11" \\
348 icon="PyCrust.png" \\
349 section="Applications/Development/Tools" \\
350 title="PyCrust" \\
351 longtitle="GUI Python Shell with Filling"
352?package(%{pkgname}): \\
353 command="%{_bindir}/pyalamode" \\
354 needs="X11" \\
355 icon="PyCrust.png" \\
356 section="Applications/Development/Tools" \\
357 title="PyAlaMode" \\
358 longtitle="GUI Python Shell with Filling and editor windows"
359?package(%{pkgname}): \\
360 command="%{_bindir}/xrced" \\
361 needs="X11" \\
362 icon="XRCed.png" \\
363 section="Applications/Development/Tools" \\
364 title="XRCed" \\
365 longtitle="wxPython XRC resource editor"
366EOF
367
368
369#----------------------------------------------------------------------
370
371%post -n %{pkgname}%{ver2}-%{port}-%{chartype}
372if [ ! -e %{wxprefbase} ]; then
373 ln -s %{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
374fi
375
376%preun -n %{pkgname}%{ver2}-%{port}-%{chartype}
377if [ -L %{wxprefbase} ]; then
378 if [ `readlink %{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
379 rm -f %{wxprefbase}
380 fi
381fi
382
383
384
385
386%post -n %{pkgname}-common-%{port}-%{chartype}
387# This is done on Mandrake to update its menus:
388if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
389
390%postun -n %{pkgname}-common-%{port}-%{chartype}
391# This is done on Mandrake to update its menus:
392if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
393
394
395
396%post -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
397cd %{wxpref}/bin
398ln -s ../lib/wx/config/%{port}-%{chartype}* wx-config
399
400%preun -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
401rm %{wxpref}/bin/wx-config
402
403
404#----------------------------------------------------------------------
405%clean
406[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
407
408
409#----------------------------------------------------------------------
410
411%files -n %{pkgname}%{ver2}-%{port}-%{chartype}
412%defattr(-,root,root)
413%doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt
414%doc wxPython/docs/*
415%dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
416%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
417%dir %{wxpref}
418%dir %{wxpref}/lib
419%{wxpref}/lib/libwx_gtk*
420%{wxpref}/share
421
422
423
424%files -n %{pkgname}-common-%{port}-%{chartype}
425%defattr(-,root,root)
426%{pref}/lib*/python%{pyver}/site-packages/wxversion.*
427%{pref}/lib*/python%{pyver}/site-packages/wx.pth
428%{_bindir}/*
429%{_datadir}/applnk/Development/*
430%{_datadir}/applications/*
431%{_datadir}/icons/hicolor/*/apps/*
432%{_datadir}/pixmaps/*
433%{_libdir}/menu/*
434
435
436
437
438
439%files -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
440%defattr(-,root,root)
441%{wxpref}/include
442%{wxpref}/lib/wx
443%dir %{wxpref}/bin
444
445
446#----------------------------------------------------------------------
447# end of file