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