1 #----------------------------------------------------------------------
3 # Purpose: RPM Build and packaging instructions
8 # Copyright: (c) 2004 by Total Control Software
9 # Licence: wxWindows license
10 #----------------------------------------------------------------------
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.
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}
25 # Which wxWidgets port to build and use. Current acceptable values
26 # are 'gtk' and 'gtk2'.
27 %if %{?port:0}%{!?port:1}
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}
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
42 # NOTE: I'm trying 0 for this next release to see if I can get rid of
44 %if %{?builtin_libs:0}%{!?builtin_libs:1}
45 %define builtin_libs
0
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}
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
63 %if %{?release:0}%{!?release:1}
64 %define release
1_py
%{pyver}
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)
72 %if %{?fullver:0}%{!?fullver:1}
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
81 %if %{?mediactrl:0}%{!?mediactrl:1}
86 #----------------------------------------------------------------------
87 # Other variables used below
89 %define pref
%{_prefix}
90 %define python
/usr
/bin
/python
%{pyver}
91 %define tarname @TARNAME@
92 %define version @VERSION@
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)
99 %define wxprefbase
%{pref}/lib
/wxPython
100 %define wxpref
%{wxprefbase}-%{version}-%{port}-%{chartype}
101 %define pkgname wxPython
103 # turn off the generation of debuginfo rpm (RH9) ??
104 %define debug_package
%{nil}
107 #----------------------------------------------------------------------
109 #----------------------------------------------------------------------
110 Name: %{pkgname}%{ver2}
111 Summary: Cross platform GUI toolkit
for Python
114 Source0: %{tarname}-%{version}.tar.bz2
115 License: wx Library Licence
, Version 3
116 URL: http
://wxPython.org
/
117 Packager: Robin Dunn
<robin@alldunn.com
>
118 Group: Development
/Python
119 BuildRoot: %{_tmppath}/%{pkgname}-buildroot
123 Cross platform GUI toolkit
for Python
128 %package -n
%{pkgname}%{ver2}-%{port}-%{chartype}
129 Summary: Cross platform GUI toolkit
for Python
130 Group: Development
/Python
131 Requires: %{pkgname}-common
132 Obsoletes
: wxPythonGTK
%{gtktype}-py%{pyver}, wxPythonGTK%{gtktype}
136 %description -n
%{pkgname}%{ver2}-%{port}-%{chartype}
137 wxPython is a GUI toolkit
for the Python programming language. It
138 allows Python programmers to create programs with a robust
, highly
139 functional graphical user interface
, simply and easily. It is
140 implemented as a Python extension module
(native code
) that wraps the
141 popular wxWidgets cross platform GUI library
, which is written
in C
++.
143 wxPython is a cross
-platform toolkit. The same program will usually
144 run on multiple platforms without modification. Currently supported
145 platforms are
32-bit Microsoft Windows
, most Unix or unix
-like
146 systems
, and Macintosh OS X.
148 This package contains the wxPython runtime files built
for the
149 wxWidgets
%{port} port with %{chartype} character
type.
155 %package -n
%{pkgname}-common-%{port}-%{chartype}
156 Summary: Common files
for needed by all wxPython runtimes
157 Group: Development
/Python
158 Provides: %{pkgname}-common
160 # They obsolete each other so any of them can be installed over another
162 Obsoletes
: %{pkgname}-common
-gtk
-ansi
163 Obsoletes
: %{pkgname}-common
-gtk2
-ansi
164 Obsoletes
: %{pkgname}-common
-gtk2
-unicode
166 %description -n
%{pkgname}-common-%{port}-%{chartype}
167 This package contains the common files needed by any version of the
168 wxPython runtime. This pacakge also installs a wx.pth file which will
169 determine which of the installed runtimes is the default version of
170 wxPython that is imported automatically with a bare "import wx".
176 %package -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
177 Summary: wxPython development files
178 Group: Development
/Libraries
179 Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version}
181 %description -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
182 This packages contains the headers and etc.
for building apps or
183 Python extension modules that use the same wxWidgets shared libraries
188 #----------------------------------------------------------------------
190 %setup -q
-n
%{tarname}-%{version}
193 #----------------------------------------------------------------------
198 # Configure and build wxWidgets
208 --disable
-monolithic \
213 --enable-graphics_ctx \
215 --enable-sound
--with
-sdl \
226 --enable-debug_flag \
228 --disable
-debugreport \
230 --with
-libjpeg
=builtin \
231 --with
-libpng
=builtin \
232 --with
-libtiff
=builtin \
233 --with
-zlib
=builtin \
238 make -C contrib
/src
/animate
239 make -C contrib
/src
/gizmos
240 make -C contrib
/src
/stc
250 EP_FULL_VER
=%{fullver} \
252 WX_CONFIG
="$WXDIR
/bld
/wx
-config
--no_rpath" \
253 build_ext
--rpath
=%{wxpref}/lib \
258 #----------------------------------------------------------------------
263 # Install wxGTK and contribs
265 make prefix
=$RPM_BUILD_ROOT
%{wxpref} install
266 make -C contrib
/src
/animate prefix
=$RPM_BUILD_ROOT
%{wxpref} install
267 make -C contrib
/src
/gizmos prefix
=$RPM_BUILD_ROOT
%{wxpref} install
268 make -C contrib
/src
/stc prefix
=$RPM_BUILD_ROOT
%{wxpref} install
272 # Install wxPython for wxGTK
278 EP_FULL_VER
=%{fullver} \
280 WX_CONFIG
="$RPM_BUILD_ROOT
%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref} --no_rpath" \
281 build_ext
--rpath
=%{wxpref}/lib \
283 --root
=$RPM_BUILD_ROOT
286 # remove the wx-config symlink, we'll redo it when installing the -devel package
287 rm $RPM_BUILD_ROOT
%{wxpref}/bin
/wx
-config
289 # make sure that debug info is stripped
290 strip $RPM_BUILD_ROOT
%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx
/*.so
293 # Since I want this RPM to be as generic as possible I won't let
294 # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
295 # the #! line to use the real python pathname. Since some distros
296 # install python 2.2 as python2 and others as python I can't let
297 # distutils do that otherwise the dependencies will be fouled up.
298 # Copy them manually instead, leaving the #!/usr/bin/env line intact.
300 mkdir -p $RPM_BUILD_ROOT
%{pref}/bin
313 cp scripts
/$s $RPM_BUILD_ROOT
%{pref}/bin
318 # install KDE & GNOME menu items
319 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/applnk
/Development
320 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/applications
321 for d
in distrib
/*.desktop
; do
322 install -m
644 $d $RPM_BUILD_ROOT
%{_datadir}/applnk
/Development
323 install -m
644 $d $RPM_BUILD_ROOT
%{_datadir}/applications
327 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/icons/hicolor/{16x16,32x32}/apps
328 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/pixmaps
329 install -m
644 wx
/py
/PyCrust_16.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/16x16
/apps
/PyCrust.png
330 install -m
644 wx
/py
/PyCrust_32.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/32x32
/apps
/PyCrust.png
331 install -m
644 wx
/py
/PyCrust_32.png $RPM_BUILD_ROOT
%{_datadir}/pixmaps
/PyCrust.png
332 install -m
644 wx
/tools
/XRCed
/XRCed_16.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/16x16
/apps
/XRCed.png
333 install -m
644 wx
/tools
/XRCed
/XRCed_32.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/32x32
/apps
/XRCed.png
334 install -m
644 wx
/tools
/XRCed
/XRCed_32.png $RPM_BUILD_ROOT
%{_datadir}/pixmaps
/XRCed.png
336 # install Mandrake menu items
337 mkdir -p $RPM_BUILD_ROOT
%{_libdir}/menu
338 cat
> $RPM_BUILD_ROOT
%{_libdir}/menu/%{pkgname} <<EOF
339 ?package
(%{pkgname}): \\
340 command="
%{_bindir}/pyshell" \\
342 icon
="PyCrust.png" \\
343 section
="Applications
/Development
/Tools" \\
345 longtitle
="GUI Python Shell"
346 ?package
(%{pkgname}): \\
347 command="
%{_bindir}/pycrust" \\
349 icon
="PyCrust.png" \\
350 section
="Applications
/Development
/Tools" \\
352 longtitle
="GUI Python Shell with Filling"
353 ?package
(%{pkgname}): \\
354 command="
%{_bindir}/pyalamode" \\
356 icon
="PyCrust.png" \\
357 section
="Applications
/Development
/Tools" \\
359 longtitle
="GUI Python Shell with Filling and editor windows"
360 ?package
(%{pkgname}): \\
361 command="
%{_bindir}/xrced" \\
364 section
="Applications
/Development
/Tools" \\
366 longtitle
="wxPython XRC resource editor"
370 #----------------------------------------------------------------------
372 %post -n
%{pkgname}%{ver2}-%{port}-%{chartype}
373 if [ ! -e
%{wxprefbase} ]; then
374 ln
-s
%{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
377 %preun -n
%{pkgname}%{ver2}-%{port}-%{chartype}
378 if [ -L
%{wxprefbase} ]; then
379 if [ `readlink
%{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
387 %post -n
%{pkgname}-common-%{port}-%{chartype}
388 # This is done on Mandrake to update its menus:
389 if [ -x
/usr
/bin
/update
-menus
]; then /usr
/bin
/update
-menus || true
; fi
391 %postun -n
%{pkgname}-common-%{port}-%{chartype}
392 # This is done on Mandrake to update its menus:
393 if [ "$
1"
= "
0"
-a
-x
/usr
/bin
/update
-menus
]; then /usr
/bin
/update
-menus || true
; fi
397 %post -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
399 ln
-s ..
/lib
/wx
/config
/%{port}-%{chartype}* wx
-config
401 %preun -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
402 rm %{wxpref}/bin
/wx
-config
405 #----------------------------------------------------------------------
407 [ "$RPM_BUILD_ROOT"
!= "
/"
] && rm -rf $RPM_BUILD_ROOT
410 #----------------------------------------------------------------------
412 %files -n
%{pkgname}%{ver2}-%{port}-%{chartype}
413 %defattr(-,root
,root
)
414 %doc docs
/preamble.txt docs
/licence.txt docs
/lgpl.txt docs
/readme.txt docs
/changes.txt
416 %dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
417 %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
418 %dir %{pref}/lib*/python%{pyver}/site
-packages
/wxaddons
419 %{pref}/lib*/python%{pyver}/site
-packages
/wxaddons
/*
422 %{wxpref}/lib
/libwx_
*
429 %files -n
%{pkgname}-common-%{port}-%{chartype}
430 %defattr(-,root
,root
)
431 %{pref}/lib*/python%{pyver}/site
-packages
/wxversion.
*
432 %{pref}/lib*/python%{pyver}/site
-packages
/wx.pth
434 %{_datadir}/applnk
/Development
/*
435 %{_datadir}/applications
/*
436 %{_datadir}/icons
/hicolor
/*/apps
/*
437 %{_datadir}/pixmaps
/*
444 %files -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
445 %defattr(-,root
,root
)
451 #----------------------------------------------------------------------