]>
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@ |
63b1cb82 | 10 | %define wxprefbase %{pref}/lib/wxPython |
8b9a4190 | 11 | %define wxpref %{wxprefbase}-%{version} |
1e4a197e | 12 | %define name wxPython%{port}-py%{pyver} |
4726eec6 | 13 | |
b817523b | 14 | |
ca46ba60 RD |
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. | |
e9bbaad7 | 18 | %if %{?release:0}%{!?release:1} |
ca46ba60 RD |
19 | %define release 1 |
20 | %endif | |
21 | ||
22 | ||
1e4a197e RD |
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 | |
b817523b | 27 | |
4726eec6 | 28 | |
1e4a197e RD |
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 | |
1128a89b RD |
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. | |
1e4a197e | 35 | %define debug_flag 1 |
4726eec6 | 36 | |
1e4a197e RD |
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) | |
1fded56b RD |
41 | %define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi) |
42 | %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi) | |
1e4a197e | 43 | %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config |
b817523b | 44 | |
1fded56b RD |
45 | # turn off the generation of debuginfo rpm (RH9) |
46 | %define debug_package %{nil} | |
b817523b | 47 | |
5ccc0a56 RD |
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 | |
6e83b721 | 54 | License: wx Library Licence, Version 3 |
5ccc0a56 | 55 | URL: http://wxPython.org/ |
ba201fa4 | 56 | Packager: Robin Dunn <robin@alldunn.com> |
5ccc0a56 | 57 | Group: Development/Python |
4726eec6 | 58 | BuildRoot: %{_tmppath}/%{name}-buildroot |
5ccc0a56 | 59 | Prefix: %{pref} |
4726eec6 | 60 | |
4726eec6 | 61 | Provides: wxPython = %{version} |
1e4a197e | 62 | Provides: wxPython%{port} = %{version} |
4726eec6 | 63 | |
59455c67 RD |
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}) | |
1fded56b RD |
68 | |
69 | ||
5ccc0a56 | 70 | # old wxPython packages |
1fded56b | 71 | Obsoletes: wxPython wxPython%{port} |
4726eec6 RD |
72 | |
73 | ||
74 | %description | |
75 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
6e83b721 | 76 | wxWidgets C++ GUI library. wxPython provides a large variety of |
4726eec6 RD |
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 | ||
6e83b721 | 80 | This package is implemented using the %{port} port of wxWidgets, and |
4726eec6 RD |
81 | includes the wx%{port} shared libs and etc. |
82 | ||
83 | ||
1e4a197e | 84 | %package -n wxPython%{port}-devel |
5ccc0a56 RD |
85 | Summary: wxPython%{port} development files |
86 | Group: Development/Libraries | |
87 | Requires: wxPython%{port} = %{version} | |
88 | ||
89 | ||
1e4a197e | 90 | %description -n wxPython%{port}-devel |
5ccc0a56 RD |
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 | #---------------------------------------------------------------- | |
4726eec6 | 96 | %prep |
357262e4 | 97 | %setup -q -n %{tarname}-%{version} |
4726eec6 RD |
98 | |
99 | ||
5ccc0a56 | 100 | #---------------------------------------------------------------- |
4726eec6 | 101 | %build |
4726eec6 | 102 | |
1e4a197e | 103 | WXDIR=`pwd` |
59455c67 RD |
104 | mkdir bld |
105 | cd bld | |
4726eec6 | 106 | |
1e4a197e | 107 | # Configure, trying to reduce external dependencies |
59455c67 | 108 | ../configure --with-%{lcport} \ |
5ccc0a56 RD |
109 | --prefix=%{wxpref} \ |
110 | --disable-soname \ | |
59455c67 | 111 | --disable-monolithic \ |
73c7ae5a | 112 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 113 | --with-opengl \ |
1e4a197e RD |
114 | %if %{unicode} |
115 | --enable-gtk2 \ | |
116 | --enable-unicode \ | |
ca46ba60 RD |
117 | %else |
118 | --disable-gtk2 \ | |
1e4a197e RD |
119 | %endif |
120 | --enable-geometry \ | |
4726eec6 | 121 | --enable-optimise \ |
7f997e3f | 122 | --enable-sound --with-sdl \ |
96d37ab5 | 123 | --enable-display \ |
b817523b RD |
124 | %if %{debug_flag} |
125 | --enable-debug_flag \ | |
126 | %endif | |
1e4a197e | 127 | %if %{builtin_libs} |
4726eec6 RD |
128 | --with-libjpeg=builtin \ |
129 | --with-libpng=builtin \ | |
130 | --with-libtiff=builtin \ | |
131 | --with-zlib=builtin \ | |
1e4a197e | 132 | %endif |
5ccc0a56 | 133 | |
357262e4 | 134 | |
6e83b721 | 135 | # Build wxWidgets and some contrib libs |
59455c67 RD |
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 | ||
4726eec6 | 143 | # Now build wxPython |
1e4a197e | 144 | cd $WXDIR/wxPython |
4726eec6 | 145 | %{python} setup.py \ |
cdc6a041 | 146 | NO_SCRIPTS=1 \ |
1e4a197e RD |
147 | WXPORT=%{lcport} \ |
148 | UNICODE=%{unicode} \ | |
fda33067 RD |
149 | WX_CONFIG="$WXDIR/bld/wx-config --inplace" \ |
150 | build | |
4726eec6 | 151 | |
1e4a197e | 152 | |
59455c67 RD |
153 | # Build wxrc (XRC resource tool) |
154 | cd $WXDIR/bld/contrib/utils/wxrc | |
155 | make | |
1e4a197e RD |
156 | strip wxrc |
157 | ||
4726eec6 | 158 | |
978cadd0 RD |
159 | #---------------------------------------------------------------- |
160 | %install | |
161 | ||
162 | WXDIR=`pwd` | |
163 | cd bld | |
164 | ||
6e83b721 | 165 | # Install wxWidgets and the contribs |
978cadd0 RD |
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 | ||
1e4a197e RD |
173 | # install wxPython |
174 | cd $WXDIR/wxPython | |
4726eec6 | 175 | %{python} setup.py \ |
cdc6a041 | 176 | NO_SCRIPTS=1 \ |
1e4a197e RD |
177 | WXPORT=%{lcport} \ |
178 | UNICODE=%{unicode} \ | |
5ccc0a56 | 179 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
180 | install \ |
181 | --root=$RPM_BUILD_ROOT | |
182 | ||
59455c67 | 183 | |
59455c67 RD |
184 | cd $WXDIR/wxPython |
185 | ||
59455c67 | 186 | |
cdc6a041 | 187 | # Since I want this RPM to be as generic as possible I won't let |
59455c67 RD |
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? | |
cdc6a041 | 195 | |
8b9a4190 | 196 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 | 197 | for s in \ |
1e4a197e | 198 | helpviewer \ |
cdc6a041 RD |
199 | img2png \ |
200 | img2py \ | |
201 | img2xpm \ | |
1fded56b RD |
202 | pyalacarte \ |
203 | pyalamode \ | |
cdc6a041 | 204 | pycrust \ |
1fded56b | 205 | pywrap \ |
cdc6a041 RD |
206 | pyshell \ |
207 | xrced; do | |
8b9a4190 | 208 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 RD |
209 | done |
210 | ||
211 | ||
1e4a197e | 212 | # Install wxrc |
59455c67 | 213 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
8b9a4190 RD |
214 | |
215 | ||
bc59c206 RD |
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 | |
1fded56b | 266 | |
63b1cb82 | 267 | |
bc59c206 RD |
268 | #---------------------------------------------------------------- |
269 | ||
8b9a4190 | 270 | %pre |
63b1cb82 | 271 | if [ -e %{wxprefbase} ]; then |
bc59c206 | 272 | # in case there are old dirs from an old install |
8b9a4190 | 273 | rm -r %{wxprefbase} |
63b1cb82 | 274 | fi |
63b1cb82 | 275 | |
bc59c206 RD |
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 | ||
63b1cb82 | 285 | %postun |
a55bea57 | 286 | rm -f %{wxprefbase} |
bc59c206 RD |
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 | ||
63b1cb82 | 290 | |
5ccc0a56 | 291 | #---------------------------------------------------------------- |
bc59c206 RD |
292 | %clean |
293 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
294 | |
295 | ||
5ccc0a56 | 296 | #---------------------------------------------------------------- |
1e4a197e | 297 | |
59455c67 | 298 | %files |
5ccc0a56 | 299 | %defattr(-,root,root) |
59455c67 | 300 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
1fded56b | 301 | %doc wxPython/docs/* |
59455c67 RD |
302 | %{_bindir}/* |
303 | %{_libdir}/python%{pyver}/site-packages/* | |
a55bea57 RD |
304 | %dir %{wxpref} |
305 | %dir %{wxpref}/lib | |
59455c67 RD |
306 | %{wxpref}/lib/libwx* |
307 | %{wxpref}/share | |
bc59c206 RD |
308 | %{_datadir}/applnk/Development/* |
309 | %{_datadir}/applications/* | |
310 | %{_datadir}/icons/hicolor/*/apps/* | |
311 | %{_datadir}/pixmaps/* | |
312 | %{_libdir}/menu/* | |
313 | ||
314 | ##%{wxprefbase} | |
5ccc0a56 | 315 | |
4726eec6 | 316 | |
59455c67 RD |
317 | %files -n wxPython%{port}-devel |
318 | %defattr(-,root,root) | |
319 | %{wxpref}/include | |
320 | %{wxpref}/lib/wx | |
321 | %{wxconfigname} | |
322 | %{wxpref}/bin/wx-config | |
4726eec6 | 323 | |
5ccc0a56 | 324 | #---------------------------------------------------------------- |
4726eec6 | 325 | # end of file |