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