]> git.saurik.com Git - wxWidgets.git/blame - wxPython/distrib/wxPythonFull.spec.in
Do not uninstall wxaddons module or files.
[wxWidgets.git] / wxPython / distrib / wxPythonFull.spec.in
CommitLineData
70934952
RD
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
b908d8bf 18# Which version of Python to build with. Used to assemble python
c1c4cf89 19# binary name so use '2.3', '2.4', etc.
b908d8bf 20%if %{?pyver:0}%{!?pyver:1}
c1c4cf89 21%define pyver 2.4
70934952 22%endif
4726eec6 23
b817523b 24
b908d8bf 25# Which wxWidgets port to build and use. Current acceptable values
70934952
RD
26# are 'gtk' and 'gtk2'.
27%if %{?port:0}%{!?port:1}
28%define port gtk2
ca46ba60
RD
29%endif
30
31
70934952
RD
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
70934952 38
1e4a197e
RD
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
70934952
RD
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
b817523b 47
4726eec6 48
1e4a197e
RD
49# Should --enable-debug_flag be used in release builds? Using it
50# defines __WXDEBUG__ and gives us runtime diagnostics that are turned
70934952
RD
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}
1e4a197e 56%define debug_flag 1
70934952
RD
57%endif
58
59
b908d8bf 60# Used to set the Release tag below. I normally use it to define what
095315e2 61# distro the RPM was built on and also include the version of Python
b908d8bf
RD
62# it was built with.
63%if %{?release:0}%{!?release:1}
64%define release 1_py%{pyver}
65%endif
66
67
095315e2
RD
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}
0f475e8a 82%define mediactrl 1
095315e2
RD
83%endif
84
b908d8bf 85
70934952
RD
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@
4726eec6 94
70934952
RD
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)
1e4a197e 98
70934952
RD
99%define wxprefbase %{pref}/lib/wxPython
100%define wxpref %{wxprefbase}-%{version}-%{port}-%{chartype}
101%define pkgname wxPython
b817523b 102
70934952 103# turn off the generation of debuginfo rpm (RH9) ??
1fded56b 104%define debug_package %{nil}
b817523b 105
70934952
RD
106
107#----------------------------------------------------------------------
108# Package definition
109#----------------------------------------------------------------------
110Name: %{pkgname}%{ver2}
111Summary: Cross platform GUI toolkit for Python
5ccc0a56
RD
112Version: %{version}
113Release: %{release}
bf158fe6 114Source0: %{tarname}-%{version}.tar.bz2
6e83b721 115License: wx Library Licence, Version 3
5ccc0a56 116URL: http://wxPython.org/
ba201fa4 117Packager: Robin Dunn <robin@alldunn.com>
5ccc0a56 118Group: Development/Python
70934952 119BuildRoot: %{_tmppath}/%{pkgname}-buildroot
5ccc0a56 120Prefix: %{pref}
4726eec6 121
70934952
RD
122%description
123Cross platform GUI toolkit for Python
4726eec6 124
1fded56b
RD
125
126
4726eec6 127
70934952
RD
128%package -n %{pkgname}%{ver2}-%{port}-%{chartype}
129Summary: Cross platform GUI toolkit for Python
130Group: Development/Python
131Requires: %{pkgname}-common
c1c4cf89 132Obsoletes: wxPythonGTK%{gtktype}-py%{pyver}, wxPythonGTK%{gtktype}
70934952 133Provides: wxPython
4726eec6 134
4726eec6 135
70934952
RD
136%description -n %{pkgname}%{ver2}-%{port}-%{chartype}
137wxPython is a GUI toolkit for the Python programming language. It
02b800ce 138allows Python programmers to create programs with a robust, highly
70934952
RD
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++.
4726eec6 142
70934952
RD
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.
4726eec6 150
5ccc0a56
RD
151
152
70934952
RD
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}
5ccc0a56 182This packages contains the headers and etc. for building apps or
70934952 183Python extension modules that use the same wxWidgets shared libraries
5ccc0a56
RD
184that wxPython uses.
185
70934952
RD
186
187
188#----------------------------------------------------------------------
4726eec6 189%prep
357262e4 190%setup -q -n %{tarname}-%{version}
4726eec6
RD
191
192
70934952 193#----------------------------------------------------------------------
4726eec6 194%build
4726eec6 195
1e4a197e 196WXDIR=`pwd`
70934952
RD
197
198# Configure and build wxWidgets
59455c67
RD
199mkdir bld
200cd bld
ff006095
RD
201../configure \
202%if %{using_gtk1}
203 --with-gtk=1 \
204%else
205 --with-gtk=2 \
206%endif
5ccc0a56 207 --prefix=%{wxpref} \
0f475e8a 208 --disable-monolithic \
8da2fe32 209 --disable-rpath \
4726eec6 210 --with-opengl \
1f975825 211 --with-gnomeprint \
1e4a197e 212 --enable-geometry \
fa5a80d6 213 --enable-graphics_ctx \
4726eec6 214 --enable-optimise \
7f997e3f 215 --enable-sound --with-sdl \
095315e2
RD
216%if %{mediactrl}
217 --enable-mediactrl \
218%endif
96d37ab5 219 --enable-display \
70934952
RD
220%if %{unicode}
221 --enable-unicode \
ff006095
RD
222%else
223 --disable-unicode \
70934952 224%endif
b817523b
RD
225%if %{debug_flag}
226 --enable-debug_flag \
227%endif
8c1a4666 228 --disable-debugreport \
1e4a197e 229%if %{builtin_libs}
4726eec6
RD
230 --with-libjpeg=builtin \
231 --with-libpng=builtin \
232 --with-libtiff=builtin \
233 --with-zlib=builtin \
1e4a197e 234%endif
5ccc0a56 235
357262e4 236
59455c67
RD
237make
238make -C contrib/src/gizmos
59455c67 239make -C contrib/src/stc
59455c67
RD
240
241
70934952
RD
242
243# Build wxPython
1e4a197e 244cd $WXDIR/wxPython
4726eec6 245%{python} setup.py \
70934952 246 WXPORT=%{port} \
1e4a197e 247 UNICODE=%{unicode} \
70934952 248 EP_ADD_OPTS=1 \
095315e2 249 EP_FULL_VER=%{fullver} \
70934952 250 NO_SCRIPTS=1 \
8da2fe32
RD
251 WX_CONFIG="$WXDIR/bld/wx-config --no_rpath" \
252 build_ext --rpath=%{wxpref}/lib \
253 build
4726eec6 254
1e4a197e 255
1e4a197e 256
70934952 257#----------------------------------------------------------------------
978cadd0
RD
258%install
259
260WXDIR=`pwd`
978cadd0 261
70934952
RD
262# Install wxGTK and contribs
263cd bld
978cadd0
RD
264make prefix=$RPM_BUILD_ROOT%{wxpref} install
265make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
978cadd0 266make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install
978cadd0
RD
267
268
70934952
RD
269
270# Install wxPython for wxGTK
1e4a197e 271cd $WXDIR/wxPython
4726eec6 272%{python} setup.py \
70934952 273 WXPORT=%{port} \
1e4a197e 274 UNICODE=%{unicode} \
70934952 275 EP_ADD_OPTS=1 \
095315e2 276 EP_FULL_VER=%{fullver} \
70934952 277 NO_SCRIPTS=1 \
8da2fe32
RD
278 WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref} --no_rpath" \
279 build_ext --rpath=%{wxpref}/lib \
4726eec6
RD
280 install \
281 --root=$RPM_BUILD_ROOT
282
59455c67 283
70934952
RD
284# remove the wx-config symlink, we'll redo it when installing the -devel package
285rm $RPM_BUILD_ROOT%{wxpref}/bin/wx-config
286
287# make sure that debug info is stripped
288strip $RPM_BUILD_ROOT%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx/*.so
59455c67 289
59455c67 290
cdc6a041 291# Since I want this RPM to be as generic as possible I won't let
59455c67
RD
292# distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
293# the #! line to use the real python pathname. Since some distros
294# install python 2.2 as python2 and others as python I can't let
295# distutils do that otherwise the dependencies will be fouled up.
70934952
RD
296# Copy them manually instead, leaving the #!/usr/bin/env line intact.
297cd $WXDIR/wxPython
8b9a4190 298mkdir -p $RPM_BUILD_ROOT%{pref}/bin
cdc6a041 299for s in \
1e4a197e 300 helpviewer \
cdc6a041
RD
301 img2png \
302 img2py \
303 img2xpm \
1fded56b
RD
304 pyalacarte \
305 pyalamode \
cdc6a041 306 pycrust \
1fded56b 307 pywrap \
cdc6a041 308 pyshell \
70934952 309 pywxrc \
cdc6a041 310 xrced; do
8b9a4190 311 cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin
cdc6a041
RD
312done
313
314
8b9a4190 315
70934952 316# install KDE & GNOME menu items
bc59c206
RD
317mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development
318mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
319for d in distrib/*.desktop; do
320 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development
321 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications
322done
323
324# install KDE icons
325mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps
326mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
327install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png
328install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png
329install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png
330install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png
331install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png
332install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png
333
70934952 334# install Mandrake menu items
ea48a085 335mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu
70934952
RD
336cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{pkgname} <<EOF
337?package(%{pkgname}): \\
bc59c206
RD
338 command="%{_bindir}/pyshell" \\
339 needs="X11" \\
340 icon="PyCrust.png" \\
341 section="Applications/Development/Tools" \\
342 title="PyShell" \\
343 longtitle="GUI Python Shell"
70934952 344?package(%{pkgname}): \\
bc59c206
RD
345 command="%{_bindir}/pycrust" \\
346 needs="X11" \\
347 icon="PyCrust.png" \\
348 section="Applications/Development/Tools" \\
349 title="PyCrust" \\
350 longtitle="GUI Python Shell with Filling"
70934952 351?package(%{pkgname}): \\
bc59c206
RD
352 command="%{_bindir}/pyalamode" \\
353 needs="X11" \\
354 icon="PyCrust.png" \\
355 section="Applications/Development/Tools" \\
356 title="PyAlaMode" \\
357 longtitle="GUI Python Shell with Filling and editor windows"
70934952 358?package(%{pkgname}): \\
bc59c206
RD
359 command="%{_bindir}/xrced" \\
360 needs="X11" \\
361 icon="XRCed.png" \\
362 section="Applications/Development/Tools" \\
363 title="XRCed" \\
364 longtitle="wxPython XRC resource editor"
365EOF
1fded56b 366
63b1cb82 367
70934952 368#----------------------------------------------------------------------
bc59c206 369
70934952
RD
370%post -n %{pkgname}%{ver2}-%{port}-%{chartype}
371if [ ! -e %{wxprefbase} ]; then
372 ln -s %{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase}
63b1cb82 373fi
63b1cb82 374
70934952
RD
375%preun -n %{pkgname}%{ver2}-%{port}-%{chartype}
376if [ -L %{wxprefbase} ]; then
377 if [ `readlink %{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then
378 rm -f %{wxprefbase}
379 fi
bc59c206 380fi
70934952
RD
381
382
383
384
385%post -n %{pkgname}-common-%{port}-%{chartype}
bc59c206
RD
386# This is done on Mandrake to update its menus:
387if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
388
70934952 389%postun -n %{pkgname}-common-%{port}-%{chartype}
bc59c206
RD
390# This is done on Mandrake to update its menus:
391if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
392
63b1cb82 393
70934952
RD
394
395%post -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
396cd %{wxpref}/bin
397ln -s ../lib/wx/config/%{port}-%{chartype}* wx-config
398
399%preun -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
400rm %{wxpref}/bin/wx-config
401
402
403#----------------------------------------------------------------------
bc59c206
RD
404%clean
405[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
4726eec6
RD
406
407
70934952 408#----------------------------------------------------------------------
1e4a197e 409
70934952 410%files -n %{pkgname}%{ver2}-%{port}-%{chartype}
5ccc0a56 411%defattr(-,root,root)
59455c67 412%doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt
1fded56b 413%doc wxPython/docs/*
70934952
RD
414%dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}
415%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/*
0f475e8a
RD
416%dir %{pref}/lib*/python%{pyver}/site-packages/wxaddons
417%{pref}/lib*/python%{pyver}/site-packages/wxaddons/*
a55bea57
RD
418%dir %{wxpref}
419%dir %{wxpref}/lib
0f475e8a
RD
420%{wxpref}/lib/libwx_*
421%dir %{wxpref}/bin
422%{wxpref}/bin/wxrc*
59455c67 423%{wxpref}/share
70934952
RD
424
425
426
427%files -n %{pkgname}-common-%{port}-%{chartype}
428%defattr(-,root,root)
429%{pref}/lib*/python%{pyver}/site-packages/wxversion.*
430%{pref}/lib*/python%{pyver}/site-packages/wx.pth
431%{_bindir}/*
bc59c206
RD
432%{_datadir}/applnk/Development/*
433%{_datadir}/applications/*
434%{_datadir}/icons/hicolor/*/apps/*
435%{_datadir}/pixmaps/*
436%{_libdir}/menu/*
437
5ccc0a56 438
4726eec6 439
70934952
RD
440
441
442%files -n %{pkgname}%{ver2}-devel-%{port}-%{chartype}
59455c67
RD
443%defattr(-,root,root)
444%{wxpref}/include
445%{wxpref}/lib/wx
70934952
RD
446%dir %{wxpref}/bin
447
4726eec6 448
70934952 449#----------------------------------------------------------------------
4726eec6 450# end of file