]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/wxPythonFull.spec.in
Add wxversion/ to the dist tarball.
[wxWidgets.git] / wxPython / distrib / wxPythonFull.spec.in
1 %define pref %{_prefix}
2 %define python @PYTHON@
3 %define pyver @PYVER@
4 %define port @PORT@
5 %define lcport @LCPORT@
6 %define unicode @UNICODE@
7 %define tarname @TARNAME@
8 %define version @VERSION@
9 %define ver2 @VER2@
10 %define wxprefbase %{pref}/lib/wxPython
11 %define wxpref %{wxprefbase}-%{version}
12 %define name wxPython%{port}-py%{pyver}
13
14
15 # Allow the release tag to be specified on the rpmbuild command
16 # line with --define 'release SOMETHING' If no such definition is
17 # used then the release number is 1.
18 %if %{?release:0}%{!?release:1}
19 %define release 1
20 %endif
21
22
23 # Should the builtin image and etc. libs be used, or system libs?
24 # Distro specific RPMs should probably set this to 0, generic ones
25 # should use 1
26 %define builtin_libs 1
27
28
29 # Should --enable-debug_flag be used in release builds? Using it
30 # defines __WXDEBUG__ and gives us runtime diagnostics that are turned
31 # into Python exceptions starting with 2.3.4. (So turning it on is a
32 # very helpful thing IMO and is recommended.) The code is still
33 # compiled with optimization flags and such when this option is used,
34 # it simply turns on some extra code.
35 %define debug_flag 1
36
37
38 # build the name of the real wx-config from the port, flags, etc.
39 %define dbgflg %(if [ "%{debug_flag}" = "1" ]; then echo d; fi)
40 %define uniflg %(if [ "%{unicode}" = "1" ]; then echo u; fi)
41 %define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi)
42 %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi)
43 %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config
44
45 # turn off the generation of debuginfo rpm (RH9)
46 %define debug_package %{nil}
47
48 #----------------------------------------------------------------
49 Summary: Cross platform GUI toolkit for Python using wx%{port}
50 Name: %{name}
51 Version: %{version}
52 Release: %{release}
53 Source0: %{tarname}-%{version}.tar.gz
54 License: wx Library Licence, Version 3
55 URL: http://wxPython.org/
56 Packager: Robin Dunn <robin@alldunn.com>
57 Group: Development/Python
58 BuildRoot: %{_tmppath}/%{name}-buildroot
59 Prefix: %{pref}
60
61 Provides: wxPython = %{version}
62 Provides: wxPython%{port} = %{version}
63
64 # Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so
65 # Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
66 # Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so
67 # Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2})
68
69
70 # old wxPython packages
71 Obsoletes: wxPython wxPython%{port}
72
73
74 %description
75 wxPython is a GUI toolkit for Python that is a wrapper around the
76 wxWidgets C++ GUI library. wxPython provides a large variety of
77 window types and controls, all implemented with a native look and feel
78 (and native runtime speed) on the platforms it is supported on.
79
80 This package is implemented using the %{port} port of wxWidgets, and
81 includes the wx%{port} shared libs and etc.
82
83
84 %package -n wxPython%{port}-devel
85 Summary: wxPython%{port} development files
86 Group: Development/Libraries
87 Requires: wxPython%{port} = %{version}
88
89
90 %description -n wxPython%{port}-devel
91 This packages contains the headers and etc. for building apps or
92 Python extension modules that use the same wx%{port} shared libraries
93 that wxPython uses.
94
95 #----------------------------------------------------------------
96 %prep
97 %setup -q -n %{tarname}-%{version}
98
99
100 #----------------------------------------------------------------
101 %build
102
103 WXDIR=`pwd`
104 mkdir bld
105 cd bld
106
107 # Configure, trying to reduce external dependencies
108 ../configure --with-%{lcport} \
109 --prefix=%{wxpref} \
110 --disable-soname \
111 --disable-monolithic \
112 --enable-rpath=%{wxpref}/lib \
113 --with-opengl \
114 %if %{unicode}
115 --enable-gtk2 \
116 --enable-unicode \
117 %else
118 --disable-gtk2 \
119 %endif
120 --enable-geometry \
121 --enable-optimise \
122 --enable-sound --with-sdl \
123 --enable-display \
124 %if %{debug_flag}
125 --enable-debug_flag \
126 %endif
127 %if %{builtin_libs}
128 --with-libjpeg=builtin \
129 --with-libpng=builtin \
130 --with-libtiff=builtin \
131 --with-zlib=builtin \
132 %endif
133
134
135 # Build wxWidgets and some contrib libs
136 make
137 make -C contrib/src/gizmos
138 make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0"
139 make -C contrib/src/stc
140 make -C contrib/src/xrc
141
142
143 # Now build wxPython
144 cd $WXDIR/wxPython
145 %{python} setup.py \
146 NO_SCRIPTS=1 \
147 WXPORT=%{lcport} \
148 UNICODE=%{unicode} \
149 WX_CONFIG="$WXDIR/bld/wx-config --inplace" \
150 build
151
152
153 # Build wxrc (XRC resource tool)
154 cd $WXDIR/bld/contrib/utils/wxrc
155 make
156 strip wxrc
157
158
159 #----------------------------------------------------------------
160 %install
161
162 WXDIR=`pwd`
163 cd bld
164
165 # Install wxWidgets and the contribs
166 make prefix=$RPM_BUILD_ROOT%{wxpref} install
167 make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install
168 make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install
169 make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install
170 make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install
171
172
173 # install wxPython
174 cd $WXDIR/wxPython
175 %{python} setup.py \
176 NO_SCRIPTS=1 \
177 WXPORT=%{lcport} \
178 UNICODE=%{unicode} \
179 WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \
180 install \
181 --root=$RPM_BUILD_ROOT
182
183
184 cd $WXDIR/wxPython
185
186
187 # Since I want this RPM to be as generic as possible I won't let
188 # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle
189 # the #! line to use the real python pathname. Since some distros
190 # install python 2.2 as python2 and others as python I can't let
191 # distutils do that otherwise the dependencies will be fouled up.
192 # Copy them manually instead, leaving the #!/bin/env line intact.
193 # TODO: Should this be dependent on %{builtin_libs} or something like
194 # it?
195
196 mkdir -p $RPM_BUILD_ROOT%{pref}/bin
197 for s in \
198 helpviewer \
199 img2png \
200 img2py \
201 img2xpm \
202 pyalacarte \
203 pyalamode \
204 pycrust \
205 pywrap \
206 pyshell \
207 xrced; do
208 cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin
209 done
210
211
212 # Install wxrc
213 cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin
214
215
216 # install KDE & GNOME menus
217 mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development
218 mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications
219 for d in distrib/*.desktop; do
220 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development
221 install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications
222 done
223
224 # install KDE icons
225 mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps
226 mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps
227 install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png
228 install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png
229 install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png
230 install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png
231 install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png
232 install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png
233
234 # install Mandrake menu
235 mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu
236 cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF
237 ?package(%{name}): \\
238 command="%{_bindir}/pyshell" \\
239 needs="X11" \\
240 icon="PyCrust.png" \\
241 section="Applications/Development/Tools" \\
242 title="PyShell" \\
243 longtitle="GUI Python Shell"
244 ?package(%{name}): \\
245 command="%{_bindir}/pycrust" \\
246 needs="X11" \\
247 icon="PyCrust.png" \\
248 section="Applications/Development/Tools" \\
249 title="PyCrust" \\
250 longtitle="GUI Python Shell with Filling"
251 ?package(%{name}): \\
252 command="%{_bindir}/pyalamode" \\
253 needs="X11" \\
254 icon="PyCrust.png" \\
255 section="Applications/Development/Tools" \\
256 title="PyAlaMode" \\
257 longtitle="GUI Python Shell with Filling and editor windows"
258 ?package(%{name}): \\
259 command="%{_bindir}/xrced" \\
260 needs="X11" \\
261 icon="XRCed.png" \\
262 section="Applications/Development/Tools" \\
263 title="XRCed" \\
264 longtitle="wxPython XRC resource editor"
265 EOF
266
267
268 #----------------------------------------------------------------
269
270 %pre
271 if [ -e %{wxprefbase} ]; then
272 # in case there are old dirs from an old install
273 rm -r %{wxprefbase}
274 fi
275
276
277 %post
278 if [ ! -e %{wxprefbase} ]; then
279 ln -s wxPython-%{version} %{wxprefbase}
280 fi
281 # This is done on Mandrake to update its menus:
282 if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
283
284
285 %postun
286 rm -f %{wxprefbase}
287 # This is done on Mandrake to update its menus:
288 if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi
289
290
291 #----------------------------------------------------------------
292 %clean
293 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
294
295
296 #----------------------------------------------------------------
297
298 %files
299 %defattr(-,root,root)
300 %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt
301 %doc wxPython/docs/*
302 %{_bindir}/*
303 %{pref}/lib*/python%{pyver}/site-packages/*
304 %dir %{wxpref}
305 %dir %{wxpref}/lib
306 %{wxpref}/lib/libwx*
307 %{wxpref}/share
308 %{_datadir}/applnk/Development/*
309 %{_datadir}/applications/*
310 %{_datadir}/icons/hicolor/*/apps/*
311 %{_datadir}/pixmaps/*
312 %{_libdir}/menu/*
313
314 ##%{wxprefbase}
315
316
317 %files -n wxPython%{port}-devel
318 %defattr(-,root,root)
319 %{wxpref}/include
320 %{wxpref}/lib/wx
321 %{wxconfigname}
322 %{wxpref}/bin/wx-config
323 %{wxpref}/bin/wx-config-%{ver2}
324
325 #----------------------------------------------------------------
326 # end of file