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.2', '2.3', 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 build on and also include the version of Python
63 %if %{?release:0}%{!?release:1}
64 %define release
1_py
%{pyver}
69 #----------------------------------------------------------------------
70 # Other variables used below
72 %define pref
%{_prefix}
73 %define python
/usr
/bin
/python
%{pyver}
74 %define tarname @TARNAME@
75 %define version @VERSION@
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)
82 %define wxprefbase
%{pref}/lib
/wxPython
83 %define wxpref
%{wxprefbase}-%{version}-%{port}-%{chartype}
84 %define pkgname wxPython
86 # turn off the generation of debuginfo rpm (RH9) ??
87 %define debug_package
%{nil}
90 #----------------------------------------------------------------------
92 #----------------------------------------------------------------------
93 Name: %{pkgname}%{ver2}
94 Summary: Cross platform GUI toolkit
for Python
97 Source0: %{tarname}-%{version}.tar.gz
98 License: wx Library Licence
, Version 3
99 URL: http
://wxPython.org
/
100 Packager: Robin Dunn
<robin@alldunn.com
>
101 Group: Development
/Python
102 BuildRoot: %{_tmppath}/%{pkgname}-buildroot
106 Cross platform GUI toolkit
for Python
111 %package -n
%{pkgname}%{ver2}-%{port}-%{chartype}
112 Summary: Cross platform GUI toolkit
for Python
113 Group: Development
/Python
114 Requires: %{pkgname}-common
115 Obsoletes
: wxPythonGTK
%{gtktype}-py%{pyver}
119 %description -n
%{pkgname}%{ver2}-%{port}-%{chartype}
120 wxPython is a GUI toolkit
for the Python programming language. It
121 allows Python programmers to create programs with a robust
, highly
122 functional graphical user interface
, simply and easily. It is
123 implemented as a Python extension module
(native code
) that wraps the
124 popular wxWidgets cross platform GUI library
, which is written
in C
++.
126 wxPython is a cross
-platform toolkit. The same program will usually
127 run on multiple platforms without modification. Currently supported
128 platforms are
32-bit Microsoft Windows
, most Unix or unix
-like
129 systems
, and Macintosh OS X.
131 This package contains the wxPython runtime files built
for the
132 wxWidgets
%{port} port with %{chartype} character
type.
138 %package -n
%{pkgname}-common-%{port}-%{chartype}
139 Summary: Common files
for needed by all wxPython runtimes
140 Group: Development
/Python
141 Provides: %{pkgname}-common
143 # They obsolete each other so any of them can be installed over another
145 Obsoletes
: %{pkgname}-common
-gtk
-ansi
146 Obsoletes
: %{pkgname}-common
-gtk2
-ansi
147 Obsoletes
: %{pkgname}-common
-gtk2
-unicode
149 %description -n
%{pkgname}-common-%{port}-%{chartype}
150 This package contains the common files needed by any version of the
151 wxPython runtime. This pacakge also installs a wx.pth file which will
152 determine which of the installed runtimes is the default version of
153 wxPython that is imported automatically with a bare "import wx".
159 %package -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
160 Summary: wxPython development files
161 Group: Development
/Libraries
162 Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version}
164 %description -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
165 This packages contains the headers and etc.
for building apps or
166 Python extension modules that use the same wxWidgets shared libraries
171 #----------------------------------------------------------------------
173 %setup -q
-n
%{tarname}-%{version}
176 #----------------------------------------------------------------------
181 # Configure and build wxWidgets
184 ..
/configure
--with
-gtk \
186 --enable-monolithic \
191 --enable-sound
--with
-sdl \
202 --enable-debug_flag \
204 --disable
-debugreport \
206 --with
-libjpeg
=builtin \
207 --with
-libpng
=builtin \
208 --with
-libtiff
=builtin \
209 --with
-zlib
=builtin \
214 make -C contrib
/src
/gizmos
215 ##make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
216 make -C contrib
/src
/stc
227 WX_CONFIG
="$WXDIR
/bld
/wx
-config
--no_rpath" \
228 build_ext
--rpath
=%{wxpref}/lib \
233 #----------------------------------------------------------------------
238 # Install wxGTK and contribs
240 make prefix
=$RPM_BUILD_ROOT
%{wxpref} install
241 make -C contrib
/src
/gizmos prefix
=$RPM_BUILD_ROOT
%{wxpref} install
242 ##make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install
243 make -C contrib
/src
/stc prefix
=$RPM_BUILD_ROOT
%{wxpref} install
247 # Install wxPython for wxGTK
254 WX_CONFIG
="$RPM_BUILD_ROOT
%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref} --no_rpath" \
255 build_ext
--rpath
=%{wxpref}/lib \
257 --root
=$RPM_BUILD_ROOT
260 # remove the wx-config symlink, we'll redo it when installing the -devel package
261 rm $RPM_BUILD_ROOT
%{wxpref}/bin
/wx
-config
263 # make sure that debug info is stripped
264 strip $RPM_BUILD_ROOT
%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx
/*.so
267 # Since I want this RPM to be as generic as possible I won't let
268 # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
269 # the #! line to use the real python pathname. Since some distros
270 # install python 2.2 as python2 and others as python I can't let
271 # distutils do that otherwise the dependencies will be fouled up.
272 # Copy them manually instead, leaving the #!/usr/bin/env line intact.
274 mkdir -p $RPM_BUILD_ROOT
%{pref}/bin
287 cp scripts
/$s $RPM_BUILD_ROOT
%{pref}/bin
292 # install KDE & GNOME menu items
293 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/applnk
/Development
294 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/applications
295 for d
in distrib
/*.desktop
; do
296 install -m
644 $d $RPM_BUILD_ROOT
%{_datadir}/applnk
/Development
297 install -m
644 $d $RPM_BUILD_ROOT
%{_datadir}/applications
301 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/icons/hicolor/{16x16,32x32}/apps
302 mkdir -p $RPM_BUILD_ROOT
%{_datadir}/pixmaps
303 install -m
644 wx
/py
/PyCrust_16.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/16x16
/apps
/PyCrust.png
304 install -m
644 wx
/py
/PyCrust_32.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/32x32
/apps
/PyCrust.png
305 install -m
644 wx
/py
/PyCrust_32.png $RPM_BUILD_ROOT
%{_datadir}/pixmaps
/PyCrust.png
306 install -m
644 wx
/tools
/XRCed
/XRCed_16.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/16x16
/apps
/XRCed.png
307 install -m
644 wx
/tools
/XRCed
/XRCed_32.png $RPM_BUILD_ROOT
%{_datadir}/icons
/hicolor
/32x32
/apps
/XRCed.png
308 install -m
644 wx
/tools
/XRCed
/XRCed_32.png $RPM_BUILD_ROOT
%{_datadir}/pixmaps
/XRCed.png
310 # install Mandrake menu items
311 mkdir -p $RPM_BUILD_ROOT
%{_libdir}/menu
312 cat
> $RPM_BUILD_ROOT
%{_libdir}/menu/%{pkgname} <<EOF
313 ?package
(%{pkgname}): \\
314 command="
%{_bindir}/pyshell" \\
316 icon
="PyCrust.png" \\
317 section
="Applications
/Development
/Tools" \\
319 longtitle
="GUI Python Shell"
320 ?package
(%{pkgname}): \\
321 command="
%{_bindir}/pycrust" \\
323 icon
="PyCrust.png" \\
324 section
="Applications
/Development
/Tools" \\
326 longtitle
="GUI Python Shell with Filling"
327 ?package
(%{pkgname}): \\
328 command="
%{_bindir}/pyalamode" \\
330 icon
="PyCrust.png" \\
331 section
="Applications
/Development
/Tools" \\
333 longtitle
="GUI Python Shell with Filling and editor windows"
334 ?package
(%{pkgname}): \\
335 command="
%{_bindir}/xrced" \\
338 section
="Applications
/Development
/Tools" \\
340 longtitle
="wxPython XRC resource editor"
344 #----------------------------------------------------------------------
346 %post -n
%{pkgname}%{ver2}-%{port}-%{chartype}
347 if [ ! -e
%{wxprefbase} ]; then
348 ln
-s
%{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
351 %preun -n
%{pkgname}%{ver2}-%{port}-%{chartype}
352 if [ -L
%{wxprefbase} ]; then
353 if [ `readlink
%{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
361 %post -n
%{pkgname}-common-%{port}-%{chartype}
362 # This is done on Mandrake to update its menus:
363 if [ -x
/usr
/bin
/update
-menus
]; then /usr
/bin
/update
-menus || true
; fi
365 %postun -n
%{pkgname}-common-%{port}-%{chartype}
366 # This is done on Mandrake to update its menus:
367 if [ "$
1"
= "
0"
-a
-x
/usr
/bin
/update
-menus
]; then /usr
/bin
/update
-menus || true
; fi
371 %post -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
373 ln
-s ..
/lib
/wx
/config
/%{port}-%{chartype}* wx
-config
375 %preun -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
376 rm %{wxpref}/bin
/wx
-config
379 #----------------------------------------------------------------------
381 [ "$RPM_BUILD_ROOT"
!= "
/"
] && rm -rf $RPM_BUILD_ROOT
384 #----------------------------------------------------------------------
386 %files -n
%{pkgname}%{ver2}-%{port}-%{chartype}
387 %defattr(-,root
,root
)
388 %doc docs
/preamble.txt docs
/licence.txt docs
/lgpl.txt docs
/readme.txt docs
/changes.txt
390 %dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
391 %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
394 %{wxpref}/lib
/libwx_gtk
*
399 %files -n
%{pkgname}-common-%{port}-%{chartype}
400 %defattr(-,root
,root
)
401 %{pref}/lib*/python%{pyver}/site
-packages
/wxversion.
*
402 %{pref}/lib*/python%{pyver}/site
-packages
/wx.pth
404 %{_datadir}/applnk
/Development
/*
405 %{_datadir}/applications
/*
406 %{_datadir}/icons
/hicolor
/*/apps
/*
407 %{_datadir}/pixmaps
/*
414 %files -n
%{pkgname}%{ver2}-devel-%{port}-%{chartype}
415 %defattr(-,root
,root
)
421 #----------------------------------------------------------------------