]>
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 \ |
b817523b RD |
111 | %if %{debug_flag} |
112 | --enable-debug_flag \ | |
113 | %endif | |
1e4a197e | 114 | %if %{builtin_libs} |
4726eec6 RD |
115 | --with-libjpeg=builtin \ |
116 | --with-libpng=builtin \ | |
117 | --with-libtiff=builtin \ | |
118 | --with-zlib=builtin \ | |
1e4a197e | 119 | %endif |
5ccc0a56 | 120 | |
357262e4 | 121 | |
59455c67 RD |
122 | # Build wxWindows and some contrib libs |
123 | make | |
124 | make -C contrib/src/gizmos | |
125 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" | |
126 | make -C contrib/src/stc | |
127 | make -C contrib/src/xrc | |
128 | ||
129 | ||
130 | # Install wxWindows and the contribs so the wxPython build can find | |
131 | # all the headers it needs | |
132 | make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
133 | make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install | |
134 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install | |
135 | make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
136 | make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
4726eec6 | 137 | |
4726eec6 RD |
138 | |
139 | # Now build wxPython | |
1e4a197e | 140 | cd $WXDIR/wxPython |
4726eec6 | 141 | %{python} setup.py \ |
cdc6a041 | 142 | NO_SCRIPTS=1 \ |
1e4a197e RD |
143 | WXPORT=%{lcport} \ |
144 | UNICODE=%{unicode} \ | |
59455c67 | 145 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
146 | build |
147 | ||
59455c67 | 148 | ## $WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" |
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 | |
1e4a197e RD |
156 | # install wxPython |
157 | cd $WXDIR/wxPython | |
4726eec6 | 158 | %{python} setup.py \ |
cdc6a041 | 159 | NO_SCRIPTS=1 \ |
1e4a197e RD |
160 | WXPORT=%{lcport} \ |
161 | UNICODE=%{unicode} \ | |
5ccc0a56 | 162 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
163 | install \ |
164 | --root=$RPM_BUILD_ROOT | |
165 | ||
59455c67 RD |
166 | |
167 | #---------------------------------------------------------------- | |
168 | %install | |
169 | ##[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
170 | ||
171 | WXDIR=`pwd` | |
172 | ||
173 | # # install wxWindows | |
174 | # cd bld | |
175 | # make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
176 | # make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install | |
177 | # make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install | |
178 | # make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
179 | # make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
180 | ||
181 | # # install wxPython | |
182 | # cd $WXDIR/wxPython | |
183 | # %{python} setup.py \ | |
184 | # NO_SCRIPTS=1 \ | |
185 | # WXPORT=%{lcport} \ | |
186 | # UNICODE=%{unicode} \ | |
187 | # WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ | |
188 | # install \ | |
189 | # --root=$RPM_BUILD_ROOT | |
190 | ||
191 | ||
192 | ||
193 | ||
194 | ||
195 | # Other "install" tasks... | |
196 | cd $WXDIR/wxPython | |
197 | ||
198 | # install the wxPython headers | |
199 | cp -R include $RPM_BUILD_ROOT%{wxpref} | |
200 | mkdir -p $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files | |
201 | cp src/*.i $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files | |
202 | ||
203 | ||
cdc6a041 | 204 | # Since I want this RPM to be as generic as possible I won't let |
59455c67 RD |
205 | # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle |
206 | # the #! line to use the real python pathname. Since some distros | |
207 | # install python 2.2 as python2 and others as python I can't let | |
208 | # distutils do that otherwise the dependencies will be fouled up. | |
209 | # Copy them manually instead, leaving the #!/bin/env line intact. | |
210 | # TODO: Should this be dependent on %{builtin_libs} or something like | |
211 | # it? | |
cdc6a041 | 212 | |
8b9a4190 | 213 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 | 214 | for s in \ |
1e4a197e | 215 | helpviewer \ |
cdc6a041 RD |
216 | img2png \ |
217 | img2py \ | |
218 | img2xpm \ | |
1fded56b RD |
219 | pyalacarte \ |
220 | pyalamode \ | |
cdc6a041 | 221 | pycrust \ |
1fded56b | 222 | pywrap \ |
cdc6a041 RD |
223 | pyshell \ |
224 | xrced; do | |
8b9a4190 | 225 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 RD |
226 | done |
227 | ||
228 | ||
1e4a197e | 229 | # Install wxrc |
59455c67 | 230 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
8b9a4190 RD |
231 | |
232 | ||
233 | # link specific name to generic name | |
234 | ln -s wxPython-%{version} $RPM_BUILD_ROOT%{wxprefbase} | |
235 | ||
4726eec6 RD |
236 | |
237 | ||
59455c67 | 238 | |
1fded56b RD |
239 | # Copy icons and make menu entries |
240 | #-- This only works for Mandrake. Is there a cross-distro way to do it? | |
8b9a4190 RD |
241 | ##mkdir -p $RPM_BUILD_ROOT%{_iconsdir} |
242 | ##mkdir -p $RPM_BUILD_ROOT%{_miconsdir} | |
243 | ##mkdir -p $RPM_BUILD_ROOT%{_menudir} | |
244 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_32.png $RPM_BUILD_ROOT%{_iconsdir}/PyCrust.png | |
245 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_16.png $RPM_BUILD_ROOT%{_miconsdir}/PyCrust.png | |
246 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_iconsdir}/XRCed.png | |
247 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_miconsdir}/XRCed.png | |
1fded56b | 248 | ## |
8b9a4190 | 249 | ##cat > $RPM_BUILD_ROOT%{_menudir}/%{name} <<EOF |
1fded56b RD |
250 | ##?package(%{name}): command="%_bindir/pyshell" needs="X11" \ |
251 | ##icon="PyCrust.png" section="Applications/Development" \ | |
252 | ##title="PyShell" longtitle="Python Shell" | |
253 | ## | |
254 | ##?package(%{name}): command="%_bindir/pycrust" needs="X11" \ | |
255 | ##icon="PyCrust.png" section="Applications/Development" \ | |
256 | ##title="PyCrust" longtitle="Python Shell with Filling" | |
257 | ## | |
258 | ##?package(%{name}): command="%_bindir/pyalamode" needs="X11" \ | |
259 | ##icon="PyCrust.png" section="Applications/Development" \ | |
260 | ##title="PyAlaMode" longtitle="Python Shell with Filling and editor windows" | |
261 | ## | |
262 | ##?package(%{name}): command="%_bindir/xrced" needs="X11" \ | |
263 | ##icon="XRCed.png" section="Applications/Development" \ | |
264 | ##title="XRCed" longtitle="wxPython XRC resource editor" | |
265 | ## | |
266 | ##EOF | |
267 | ||
268 | ||
269 | ||
1e4a197e RD |
270 | # Generate the filelists. For some reason the %defattr below is still |
271 | # resulting in many (but not all) files not owned by root when just | |
272 | # specifying directories and wildcards to be included in each package. | |
273 | # So instead we'll build some explicit filelists here and use %attr on | |
274 | # each entry. | |
275 | cd $WXDIR | |
59455c67 RD |
276 | # mkdir -p $RPM_BUILD_ROOT%{pref}/share/doc |
277 | # GFL="%{python} wxPython/distrib/genfilelist.py" | |
278 | # $GFL $RPM_BUILD_ROOT %{pref} > FILELIST | |
279 | # $GFL -r $RPM_BUILD_ROOT %{pref}/bin >> FILELIST | |
280 | # $GFL $RPM_BUILD_ROOT %{pref}/lib >> FILELIST | |
281 | # $GFL -r $RPM_BUILD_ROOT %{pref}/lib/python%{pyver} >> FILELIST | |
282 | # $GFL -r $RPM_BUILD_ROOT %{pref}/share >> FILELIST | |
283 | # $GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST | |
284 | # $GFL $RPM_BUILD_ROOT %{wxprefbase} >> FILELIST | |
285 | # $GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST | |
286 | # $GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST | |
287 | # $GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST | |
288 | # ###GFL -r $RPM_BUILD_ROOT %{_iconsdir} >> FILELIST | |
289 | # ##$GFL -r $RPM_BUILD_ROOT %{_menudir} >> FILELIST | |
290 | ||
291 | # $GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST | |
292 | # $GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST | |
293 | # $GFL -r $RPM_BUILD_ROOT %{wxpref}/lib/wx >> DEVELLIST | |
294 | # $GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST | |
295 | # $GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST | |
4726eec6 RD |
296 | |
297 | ||
1fded56b RD |
298 | #---------------------------------------------------------------- |
299 | ##%post | |
300 | ##%{update_menus} | |
301 | ## | |
302 | ##%postun | |
303 | ##%{clean_menus} | |
304 | ||
63b1cb82 | 305 | |
8b9a4190 | 306 | %pre |
63b1cb82 | 307 | if [ -e %{wxprefbase} ]; then |
8b9a4190 | 308 | rm -r %{wxprefbase} |
63b1cb82 | 309 | fi |
63b1cb82 RD |
310 | |
311 | %postun | |
312 | if [ -e %{wxprefbase} ]; then | |
313 | rm %{wxprefbase} | |
314 | fi | |
315 | ||
5ccc0a56 | 316 | #---------------------------------------------------------------- |
59455c67 RD |
317 | #%clean |
318 | #[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
319 | |
320 | ||
5ccc0a56 | 321 | #---------------------------------------------------------------- |
1e4a197e | 322 | |
59455c67 | 323 | %files |
5ccc0a56 | 324 | %defattr(-,root,root) |
59455c67 | 325 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
1fded56b | 326 | %doc wxPython/docs/* |
59455c67 RD |
327 | %{_bindir}/* |
328 | %{_libdir}/python%{pyver}/site-packages/* | |
329 | %{wxpref}/lib/libwx* | |
330 | %{wxpref}/share | |
331 | %{wxprefbase} | |
5ccc0a56 | 332 | |
4726eec6 | 333 | |
59455c67 RD |
334 | %files -n wxPython%{port}-devel |
335 | %defattr(-,root,root) | |
336 | %{wxpref}/include | |
337 | %{wxpref}/lib/wx | |
338 | %{wxconfigname} | |
339 | %{wxpref}/bin/wx-config | |
4726eec6 | 340 | |
5ccc0a56 | 341 | #---------------------------------------------------------------- |
4726eec6 | 342 | # end of file |