]>
Commit | Line | Data |
---|---|---|
357262e4 RD |
1 | %define pref %{_prefix} |
2 | %define python @PYTHON@ | |
3 | %define pyver @PYVER@ | |
357262e4 RD |
4 | %define port @PORT@ |
5 | %define lcport @LCPORT@ | |
1e4a197e | 6 | %define unicode @UNICODE@ |
4726eec6 | 7 | %define tarname @TARNAME@ |
357262e4 | 8 | %define version @VERSION@ |
b817523b | 9 | %define ver2 @VER2@ |
357262e4 | 10 | %define release 1 |
63b1cb82 | 11 | %define wxprefbase %{pref}/lib/wxPython |
8b9a4190 | 12 | %define wxpref %{wxprefbase}-%{version} |
1e4a197e | 13 | %define name wxPython%{port}-py%{pyver} |
4726eec6 | 14 | |
b817523b | 15 | |
1e4a197e RD |
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 | |
b817523b | 20 | |
4726eec6 | 21 | |
1e4a197e RD |
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 | |
1128a89b RD |
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. | |
1e4a197e | 28 | %define debug_flag 1 |
4726eec6 | 29 | |
1e4a197e RD |
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) | |
1fded56b RD |
34 | %define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi) |
35 | %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi) | |
1e4a197e | 36 | %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config |
b817523b | 37 | |
1fded56b RD |
38 | # turn off the generation of debuginfo rpm (RH9) |
39 | %define debug_package %{nil} | |
b817523b | 40 | |
5ccc0a56 RD |
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 | |
6e83b721 | 47 | License: wx Library Licence, Version 3 |
5ccc0a56 | 48 | URL: http://wxPython.org/ |
ba201fa4 | 49 | Packager: Robin Dunn <robin@alldunn.com> |
5ccc0a56 | 50 | Group: Development/Python |
4726eec6 | 51 | BuildRoot: %{_tmppath}/%{name}-buildroot |
5ccc0a56 | 52 | Prefix: %{pref} |
4726eec6 | 53 | |
4726eec6 | 54 | Provides: wxPython = %{version} |
1e4a197e | 55 | Provides: wxPython%{port} = %{version} |
4726eec6 | 56 | |
59455c67 RD |
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}) | |
1fded56b RD |
61 | |
62 | ||
5ccc0a56 | 63 | # old wxPython packages |
1fded56b | 64 | Obsoletes: wxPython wxPython%{port} |
4726eec6 RD |
65 | |
66 | ||
67 | %description | |
68 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
6e83b721 | 69 | wxWidgets C++ GUI library. wxPython provides a large variety of |
4726eec6 RD |
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 | ||
6e83b721 | 73 | This package is implemented using the %{port} port of wxWidgets, and |
4726eec6 RD |
74 | includes the wx%{port} shared libs and etc. |
75 | ||
76 | ||
1e4a197e | 77 | %package -n wxPython%{port}-devel |
5ccc0a56 RD |
78 | Summary: wxPython%{port} development files |
79 | Group: Development/Libraries | |
80 | Requires: wxPython%{port} = %{version} | |
81 | ||
82 | ||
1e4a197e | 83 | %description -n wxPython%{port}-devel |
5ccc0a56 RD |
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 | #---------------------------------------------------------------- | |
4726eec6 | 89 | %prep |
357262e4 | 90 | %setup -q -n %{tarname}-%{version} |
4726eec6 RD |
91 | |
92 | ||
5ccc0a56 | 93 | #---------------------------------------------------------------- |
4726eec6 | 94 | %build |
4726eec6 | 95 | |
1e4a197e | 96 | WXDIR=`pwd` |
59455c67 RD |
97 | mkdir bld |
98 | cd bld | |
4726eec6 | 99 | |
1e4a197e | 100 | # Configure, trying to reduce external dependencies |
59455c67 | 101 | ../configure --with-%{lcport} \ |
5ccc0a56 RD |
102 | --prefix=%{wxpref} \ |
103 | --disable-soname \ | |
59455c67 | 104 | --disable-monolithic \ |
73c7ae5a | 105 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 106 | --with-opengl \ |
1e4a197e RD |
107 | %if %{unicode} |
108 | --enable-gtk2 \ | |
109 | --enable-unicode \ | |
110 | %endif | |
111 | --enable-geometry \ | |
4726eec6 | 112 | --enable-optimise \ |
7f997e3f | 113 | --enable-sound --with-sdl \ |
96d37ab5 | 114 | --enable-display \ |
b817523b RD |
115 | %if %{debug_flag} |
116 | --enable-debug_flag \ | |
117 | %endif | |
1e4a197e | 118 | %if %{builtin_libs} |
4726eec6 RD |
119 | --with-libjpeg=builtin \ |
120 | --with-libpng=builtin \ | |
121 | --with-libtiff=builtin \ | |
122 | --with-zlib=builtin \ | |
1e4a197e | 123 | %endif |
5ccc0a56 | 124 | |
357262e4 | 125 | |
6e83b721 | 126 | # Build wxWidgets and some contrib libs |
59455c67 RD |
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 | ||
4726eec6 | 134 | # Now build wxPython |
1e4a197e | 135 | cd $WXDIR/wxPython |
4726eec6 | 136 | %{python} setup.py \ |
cdc6a041 | 137 | NO_SCRIPTS=1 \ |
1e4a197e RD |
138 | WXPORT=%{lcport} \ |
139 | UNICODE=%{unicode} \ | |
978cadd0 | 140 | WX_CONFIG="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \ |
6e83b721 | 141 | CONTRIBS_INC="$WXDIR/contrib/include" \ |
4726eec6 RD |
142 | build |
143 | ||
1e4a197e | 144 | |
59455c67 RD |
145 | # Build wxrc (XRC resource tool) |
146 | cd $WXDIR/bld/contrib/utils/wxrc | |
147 | make | |
1e4a197e RD |
148 | strip wxrc |
149 | ||
4726eec6 | 150 | |
978cadd0 RD |
151 | #---------------------------------------------------------------- |
152 | %install | |
153 | ||
154 | WXDIR=`pwd` | |
155 | cd bld | |
156 | ||
6e83b721 | 157 | # Install wxWidgets and the contribs |
978cadd0 RD |
158 | make prefix=$RPM_BUILD_ROOT%{wxpref} install |
159 | make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install | |
160 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install | |
161 | make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
162 | make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
163 | ||
164 | ||
1e4a197e RD |
165 | # install wxPython |
166 | cd $WXDIR/wxPython | |
4726eec6 | 167 | %{python} setup.py \ |
cdc6a041 | 168 | NO_SCRIPTS=1 \ |
1e4a197e RD |
169 | WXPORT=%{lcport} \ |
170 | UNICODE=%{unicode} \ | |
5ccc0a56 | 171 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
172 | install \ |
173 | --root=$RPM_BUILD_ROOT | |
174 | ||
59455c67 | 175 | |
59455c67 RD |
176 | cd $WXDIR/wxPython |
177 | ||
59455c67 | 178 | |
cdc6a041 | 179 | # Since I want this RPM to be as generic as possible I won't let |
59455c67 RD |
180 | # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle |
181 | # the #! line to use the real python pathname. Since some distros | |
182 | # install python 2.2 as python2 and others as python I can't let | |
183 | # distutils do that otherwise the dependencies will be fouled up. | |
184 | # Copy them manually instead, leaving the #!/bin/env line intact. | |
185 | # TODO: Should this be dependent on %{builtin_libs} or something like | |
186 | # it? | |
cdc6a041 | 187 | |
8b9a4190 | 188 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 | 189 | for s in \ |
1e4a197e | 190 | helpviewer \ |
cdc6a041 RD |
191 | img2png \ |
192 | img2py \ | |
193 | img2xpm \ | |
1fded56b RD |
194 | pyalacarte \ |
195 | pyalamode \ | |
cdc6a041 | 196 | pycrust \ |
1fded56b | 197 | pywrap \ |
cdc6a041 RD |
198 | pyshell \ |
199 | xrced; do | |
8b9a4190 | 200 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 RD |
201 | done |
202 | ||
203 | ||
1e4a197e | 204 | # Install wxrc |
59455c67 | 205 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
8b9a4190 RD |
206 | |
207 | ||
bc59c206 RD |
208 | # install KDE & GNOME menus |
209 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development | |
210 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications | |
211 | for d in distrib/*.desktop; do | |
212 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development | |
213 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications | |
214 | done | |
215 | ||
216 | # install KDE icons | |
217 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps | |
218 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps | |
219 | install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png | |
220 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png | |
221 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png | |
222 | install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png | |
223 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png | |
224 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png | |
225 | ||
226 | # install Mandrake menu | |
227 | mkdir -p $RPM_BUILD_ROOT/%{_libdir}/menu | |
228 | cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF | |
229 | ?package(%{name}): \\ | |
230 | command="%{_bindir}/pyshell" \\ | |
231 | needs="X11" \\ | |
232 | icon="PyCrust.png" \\ | |
233 | section="Applications/Development/Tools" \\ | |
234 | title="PyShell" \\ | |
235 | longtitle="GUI Python Shell" | |
236 | ?package(%{name}): \\ | |
237 | command="%{_bindir}/pycrust" \\ | |
238 | needs="X11" \\ | |
239 | icon="PyCrust.png" \\ | |
240 | section="Applications/Development/Tools" \\ | |
241 | title="PyCrust" \\ | |
242 | longtitle="GUI Python Shell with Filling" | |
243 | ?package(%{name}): \\ | |
244 | command="%{_bindir}/pyalamode" \\ | |
245 | needs="X11" \\ | |
246 | icon="PyCrust.png" \\ | |
247 | section="Applications/Development/Tools" \\ | |
248 | title="PyAlaMode" \\ | |
249 | longtitle="GUI Python Shell with Filling and editor windows" | |
250 | ?package(%{name}): \\ | |
251 | command="%{_bindir}/xrced" \\ | |
252 | needs="X11" \\ | |
253 | icon="XRCed.png" \\ | |
254 | section="Applications/Development/Tools" \\ | |
255 | title="XRCed" \\ | |
256 | longtitle="wxPython XRC resource editor" | |
257 | EOF | |
1fded56b | 258 | |
63b1cb82 | 259 | |
bc59c206 RD |
260 | #---------------------------------------------------------------- |
261 | ||
8b9a4190 | 262 | %pre |
63b1cb82 | 263 | if [ -e %{wxprefbase} ]; then |
bc59c206 | 264 | # in case there are old dirs from an old install |
8b9a4190 | 265 | rm -r %{wxprefbase} |
63b1cb82 | 266 | fi |
63b1cb82 | 267 | |
bc59c206 RD |
268 | |
269 | %post | |
270 | if [ ! -e %{wxprefbase} ]; then | |
271 | ln -s wxPython-%{version} %{wxprefbase} | |
272 | fi | |
273 | # This is done on Mandrake to update its menus: | |
274 | if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
275 | ||
276 | ||
63b1cb82 | 277 | %postun |
a55bea57 | 278 | rm -f %{wxprefbase} |
bc59c206 RD |
279 | # This is done on Mandrake to update its menus: |
280 | if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
281 | ||
63b1cb82 | 282 | |
5ccc0a56 | 283 | #---------------------------------------------------------------- |
bc59c206 RD |
284 | %clean |
285 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
286 | |
287 | ||
5ccc0a56 | 288 | #---------------------------------------------------------------- |
1e4a197e | 289 | |
59455c67 | 290 | %files |
5ccc0a56 | 291 | %defattr(-,root,root) |
59455c67 | 292 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
1fded56b | 293 | %doc wxPython/docs/* |
59455c67 RD |
294 | %{_bindir}/* |
295 | %{_libdir}/python%{pyver}/site-packages/* | |
a55bea57 RD |
296 | %dir %{wxpref} |
297 | %dir %{wxpref}/lib | |
59455c67 RD |
298 | %{wxpref}/lib/libwx* |
299 | %{wxpref}/share | |
bc59c206 RD |
300 | %{_datadir}/applnk/Development/* |
301 | %{_datadir}/applications/* | |
302 | %{_datadir}/icons/hicolor/*/apps/* | |
303 | %{_datadir}/pixmaps/* | |
304 | %{_libdir}/menu/* | |
305 | ||
306 | ##%{wxprefbase} | |
5ccc0a56 | 307 | |
4726eec6 | 308 | |
59455c67 RD |
309 | %files -n wxPython%{port}-devel |
310 | %defattr(-,root,root) | |
311 | %{wxpref}/include | |
312 | %{wxpref}/lib/wx | |
313 | %{wxconfigname} | |
314 | %{wxpref}/bin/wx-config | |
4726eec6 | 315 | |
5ccc0a56 | 316 | #---------------------------------------------------------------- |
4726eec6 | 317 | # end of file |