]>
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 | |
45 | License: wxWindows Library Licence, Version 3 | |
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 | |
67 | wxWindows C++ GUI library. wxPython provides a large variety of | |
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 | ||
5ccc0a56 | 71 | This package is implemented using the %{port} port of wxWindows, 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 \ |
96d37ab5 RD |
111 | --enable-sound \ |
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 | |
59455c67 RD |
124 | # Build wxWindows and some contrib libs |
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 | ||
978cadd0 RD |
132 | # Link the contrib header directories in place so we can build all of |
133 | # wxPython without installing wxWindows | |
134 | if [ ! -e $WXDIR/include/wx/gizmos ]; then | |
135 | cd $WXDIR/include/wx | |
136 | ln -s ../../contrib/include/wx/* . | |
137 | fi | |
4726eec6 | 138 | |
4726eec6 RD |
139 | |
140 | # Now build wxPython | |
1e4a197e | 141 | cd $WXDIR/wxPython |
4726eec6 | 142 | %{python} setup.py \ |
cdc6a041 | 143 | NO_SCRIPTS=1 \ |
1e4a197e RD |
144 | WXPORT=%{lcport} \ |
145 | UNICODE=%{unicode} \ | |
978cadd0 | 146 | WX_CONFIG="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \ |
4726eec6 RD |
147 | build |
148 | ||
1e4a197e | 149 | |
59455c67 RD |
150 | # Build wxrc (XRC resource tool) |
151 | cd $WXDIR/bld/contrib/utils/wxrc | |
152 | make | |
1e4a197e RD |
153 | strip wxrc |
154 | ||
4726eec6 | 155 | |
978cadd0 RD |
156 | #---------------------------------------------------------------- |
157 | %install | |
158 | ||
159 | WXDIR=`pwd` | |
160 | cd bld | |
161 | ||
162 | # Install wxWindows and the contribs so the wxPython build can find | |
163 | # all the headers it needs | |
164 | make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
165 | make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install | |
166 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install | |
167 | make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
168 | make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
169 | ||
170 | ||
1e4a197e RD |
171 | # install wxPython |
172 | cd $WXDIR/wxPython | |
4726eec6 | 173 | %{python} setup.py \ |
cdc6a041 | 174 | NO_SCRIPTS=1 \ |
1e4a197e RD |
175 | WXPORT=%{lcport} \ |
176 | UNICODE=%{unicode} \ | |
5ccc0a56 | 177 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
178 | install \ |
179 | --root=$RPM_BUILD_ROOT | |
180 | ||
59455c67 | 181 | |
59455c67 | 182 | |
59455c67 RD |
183 | cd $WXDIR/wxPython |
184 | ||
185 | # install the wxPython headers | |
186 | cp -R include $RPM_BUILD_ROOT%{wxpref} | |
187 | mkdir -p $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files | |
188 | cp src/*.i $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files | |
189 | ||
190 | ||
cdc6a041 | 191 | # Since I want this RPM to be as generic as possible I won't let |
59455c67 RD |
192 | # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle |
193 | # the #! line to use the real python pathname. Since some distros | |
194 | # install python 2.2 as python2 and others as python I can't let | |
195 | # distutils do that otherwise the dependencies will be fouled up. | |
196 | # Copy them manually instead, leaving the #!/bin/env line intact. | |
197 | # TODO: Should this be dependent on %{builtin_libs} or something like | |
198 | # it? | |
cdc6a041 | 199 | |
8b9a4190 | 200 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 | 201 | for s in \ |
1e4a197e | 202 | helpviewer \ |
cdc6a041 RD |
203 | img2png \ |
204 | img2py \ | |
205 | img2xpm \ | |
1fded56b RD |
206 | pyalacarte \ |
207 | pyalamode \ | |
cdc6a041 | 208 | pycrust \ |
1fded56b | 209 | pywrap \ |
cdc6a041 RD |
210 | pyshell \ |
211 | xrced; do | |
8b9a4190 | 212 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 RD |
213 | done |
214 | ||
215 | ||
1e4a197e | 216 | # Install wxrc |
59455c67 | 217 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
8b9a4190 RD |
218 | |
219 | ||
bc59c206 RD |
220 | # install KDE & GNOME menus |
221 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development | |
222 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications | |
223 | for d in distrib/*.desktop; do | |
224 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development | |
225 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications | |
226 | done | |
227 | ||
228 | # install KDE icons | |
229 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps | |
230 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps | |
231 | install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png | |
232 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png | |
233 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png | |
234 | install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png | |
235 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png | |
236 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png | |
237 | ||
238 | # install Mandrake menu | |
239 | mkdir -p $RPM_BUILD_ROOT/%{_libdir}/menu | |
240 | cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF | |
241 | ?package(%{name}): \\ | |
242 | command="%{_bindir}/pyshell" \\ | |
243 | needs="X11" \\ | |
244 | icon="PyCrust.png" \\ | |
245 | section="Applications/Development/Tools" \\ | |
246 | title="PyShell" \\ | |
247 | longtitle="GUI Python Shell" | |
248 | ?package(%{name}): \\ | |
249 | command="%{_bindir}/pycrust" \\ | |
250 | needs="X11" \\ | |
251 | icon="PyCrust.png" \\ | |
252 | section="Applications/Development/Tools" \\ | |
253 | title="PyCrust" \\ | |
254 | longtitle="GUI Python Shell with Filling" | |
255 | ?package(%{name}): \\ | |
256 | command="%{_bindir}/pyalamode" \\ | |
257 | needs="X11" \\ | |
258 | icon="PyCrust.png" \\ | |
259 | section="Applications/Development/Tools" \\ | |
260 | title="PyAlaMode" \\ | |
261 | longtitle="GUI Python Shell with Filling and editor windows" | |
262 | ?package(%{name}): \\ | |
263 | command="%{_bindir}/xrced" \\ | |
264 | needs="X11" \\ | |
265 | icon="XRCed.png" \\ | |
266 | section="Applications/Development/Tools" \\ | |
267 | title="XRCed" \\ | |
268 | longtitle="wxPython XRC resource editor" | |
269 | EOF | |
1fded56b | 270 | |
63b1cb82 | 271 | |
bc59c206 RD |
272 | #---------------------------------------------------------------- |
273 | ||
8b9a4190 | 274 | %pre |
63b1cb82 | 275 | if [ -e %{wxprefbase} ]; then |
bc59c206 | 276 | # in case there are old dirs from an old install |
8b9a4190 | 277 | rm -r %{wxprefbase} |
63b1cb82 | 278 | fi |
63b1cb82 | 279 | |
bc59c206 RD |
280 | |
281 | %post | |
282 | if [ ! -e %{wxprefbase} ]; then | |
283 | ln -s wxPython-%{version} %{wxprefbase} | |
284 | fi | |
285 | # This is done on Mandrake to update its menus: | |
286 | if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
287 | ||
288 | ||
63b1cb82 | 289 | %postun |
a55bea57 | 290 | rm -f %{wxprefbase} |
bc59c206 RD |
291 | # This is done on Mandrake to update its menus: |
292 | if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
293 | ||
63b1cb82 | 294 | |
5ccc0a56 | 295 | #---------------------------------------------------------------- |
bc59c206 RD |
296 | %clean |
297 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
298 | |
299 | ||
5ccc0a56 | 300 | #---------------------------------------------------------------- |
1e4a197e | 301 | |
59455c67 | 302 | %files |
5ccc0a56 | 303 | %defattr(-,root,root) |
59455c67 | 304 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
1fded56b | 305 | %doc wxPython/docs/* |
59455c67 RD |
306 | %{_bindir}/* |
307 | %{_libdir}/python%{pyver}/site-packages/* | |
a55bea57 RD |
308 | %dir %{wxpref} |
309 | %dir %{wxpref}/lib | |
59455c67 RD |
310 | %{wxpref}/lib/libwx* |
311 | %{wxpref}/share | |
bc59c206 RD |
312 | %{_datadir}/applnk/Development/* |
313 | %{_datadir}/applications/* | |
314 | %{_datadir}/icons/hicolor/*/apps/* | |
315 | %{_datadir}/pixmaps/* | |
316 | %{_libdir}/menu/* | |
317 | ||
318 | ##%{wxprefbase} | |
5ccc0a56 | 319 | |
4726eec6 | 320 | |
59455c67 RD |
321 | %files -n wxPython%{port}-devel |
322 | %defattr(-,root,root) | |
323 | %{wxpref}/include | |
324 | %{wxpref}/lib/wx | |
325 | %{wxconfigname} | |
326 | %{wxpref}/bin/wx-config | |
4726eec6 | 327 | |
5ccc0a56 | 328 | #---------------------------------------------------------------- |
4726eec6 | 329 | # end of file |