]>
Commit | Line | Data |
---|---|---|
70934952 RD |
1 | #---------------------------------------------------------------------- |
2 | # Name: wxPython.spec | |
3 | # Purpose: RPM Build and packaging instructions | |
4 | # | |
5 | # Author: Robin Dunn | |
6 | # | |
7 | # RCS-ID: $Id$ | |
8 | # Copyright: (c) 2004 by Total Control Software | |
9 | # Licence: wxWindows license | |
10 | #---------------------------------------------------------------------- | |
11 | ||
12 | ||
13 | # The following values can be set on the rpmbuild command line with | |
14 | # --define 'name VALUE' If no value is set on the command line then | |
15 | # the default value set here will be used instead. | |
16 | ||
17 | ||
18 | # Used to set the Release tag below. I normally use it to define what | |
19 | # distro the RPM was build on and also include the version of Python | |
20 | # it was built with. | |
21 | %if %{?release:0}%{!?release:1} | |
22 | %define release 1_py%{pyver} | |
23 | %endif | |
4726eec6 | 24 | |
b817523b | 25 | |
70934952 RD |
26 | # Which wxWidgets port to build and use. Current acceptable valuse |
27 | # are 'gtk' and 'gtk2'. | |
28 | %if %{?port:0}%{!?port:1} | |
29 | %define port gtk2 | |
ca46ba60 RD |
30 | %endif |
31 | ||
32 | ||
70934952 RD |
33 | # Build in unicode mode? Can only be used if port is gtk2, acceptable |
34 | # values are '0' and '1' | |
35 | %if %{?unicode:0}%{!?unicode:1} | |
36 | %define unicode 1 | |
37 | %endif | |
38 | ||
39 | # Which version of Python to build with. Used to assemble python | |
40 | # binary name so use '2.2', '2.3', etc. | |
41 | %if %{?pyver:0}%{!?pyver:1} | |
42 | %define pyver 2.3 | |
43 | %endif | |
44 | ||
45 | ||
46 | ||
47 | ||
1e4a197e RD |
48 | # Should the builtin image and etc. libs be used, or system libs? |
49 | # Distro specific RPMs should probably set this to 0, generic ones | |
70934952 RD |
50 | # should use 1. |
51 | # NOTE: I'm trying 0 for this next release to see if I can get rid of | |
52 | # this... | |
53 | %if %{?builtin_libs:0}%{!?builtin_libs:1} | |
54 | %define builtin_libs 0 | |
55 | %endif | |
b817523b | 56 | |
4726eec6 | 57 | |
1e4a197e RD |
58 | # Should --enable-debug_flag be used in release builds? Using it |
59 | # defines __WXDEBUG__ and gives us runtime diagnostics that are turned | |
70934952 RD |
60 | # into Python exceptions. (So turning it on is a very helpful thing |
61 | # IMO and is recommended.) The code is still compiled with | |
62 | # optimization flags and and without debug info and such when this | |
63 | # option is used, it simply turns on some extra code. | |
64 | %if %{?debug_flag:0}%{!?debug_flag:1} | |
1e4a197e | 65 | %define debug_flag 1 |
70934952 RD |
66 | %endif |
67 | ||
68 | ||
69 | #---------------------------------------------------------------------- | |
70 | # Other variables used below | |
71 | ||
72 | %define pref %{_prefix} | |
73 | %define python /usr/bin/python%{pyver} | |
74 | %define tarname @TARNAME@ | |
75 | %define version @VERSION@ | |
76 | %define ver2 @VER2@ | |
4726eec6 | 77 | |
70934952 RD |
78 | %define chartype %(if [ "%{unicode}" = "1" ]; then echo unicode; else echo ansi; fi) |
79 | %define gtktype %(if [ "%{port}" = "gtk2" ]; then echo 2; fi) | |
80 | %define using_gtk1 %(if [ "%{port}" = "gtk" ]; then echo 1; else echo 0; fi) | |
1e4a197e | 81 | |
70934952 RD |
82 | %define wxprefbase %{pref}/lib/wxPython |
83 | %define wxpref %{wxprefbase}-%{version}-%{port}-%{chartype} | |
84 | %define pkgname wxPython | |
b817523b | 85 | |
70934952 | 86 | # turn off the generation of debuginfo rpm (RH9) ?? |
1fded56b | 87 | %define debug_package %{nil} |
b817523b | 88 | |
70934952 RD |
89 | |
90 | #---------------------------------------------------------------------- | |
91 | # Package definition | |
92 | #---------------------------------------------------------------------- | |
93 | Name: %{pkgname}%{ver2} | |
94 | Summary: Cross platform GUI toolkit for Python | |
5ccc0a56 RD |
95 | Version: %{version} |
96 | Release: %{release} | |
97 | Source0: %{tarname}-%{version}.tar.gz | |
6e83b721 | 98 | License: wx Library Licence, Version 3 |
5ccc0a56 | 99 | URL: http://wxPython.org/ |
ba201fa4 | 100 | Packager: Robin Dunn <robin@alldunn.com> |
5ccc0a56 | 101 | Group: Development/Python |
70934952 | 102 | BuildRoot: %{_tmppath}/%{pkgname}-buildroot |
5ccc0a56 | 103 | Prefix: %{pref} |
4726eec6 | 104 | |
70934952 RD |
105 | %description |
106 | Cross platform GUI toolkit for Python | |
4726eec6 | 107 | |
1fded56b RD |
108 | |
109 | ||
4726eec6 | 110 | |
70934952 RD |
111 | %package -n %{pkgname}%{ver2}-%{port}-%{chartype} |
112 | Summary: Cross platform GUI toolkit for Python | |
113 | Group: Development/Python | |
114 | Requires: %{pkgname}-common | |
115 | Obsoletes: wxPythonGTK%{gtktype}-py%{pyver} | |
116 | Provides: wxPython | |
4726eec6 | 117 | |
4726eec6 | 118 | |
70934952 RD |
119 | %description -n %{pkgname}%{ver2}-%{port}-%{chartype} |
120 | wxPython is a GUI toolkit for the Python programming language. It | |
121 | allows Python programmers to create programs with a robust, highly | |
122 | functional graphical user interface, simply and easily. It is | |
123 | implemented as a Python extension module (native code) that wraps the | |
124 | popular wxWidgets cross platform GUI library, which is written in C++. | |
4726eec6 | 125 | |
70934952 RD |
126 | wxPython is a cross-platform toolkit. The same program will usually |
127 | run on multiple platforms without modification. Currently supported | |
128 | platforms are 32-bit Microsoft Windows, most Unix or unix-like | |
129 | systems, and Macintosh OS X. | |
130 | ||
131 | This package contains the wxPython runtime files built for the | |
132 | wxWidgets %{port} port with %{chartype} character type. | |
4726eec6 | 133 | |
5ccc0a56 RD |
134 | |
135 | ||
70934952 RD |
136 | |
137 | ||
138 | %package -n %{pkgname}-common-%{port}-%{chartype} | |
139 | Summary: Common files for needed by all wxPython runtimes | |
140 | Group: Development/Python | |
141 | Provides: %{pkgname}-common | |
142 | ||
143 | # They obsolete each other so any of them can be installed over another | |
144 | # without conflicts | |
145 | Obsoletes: %{pkgname}-common-gtk-ansi | |
146 | Obsoletes: %{pkgname}-common-gtk2-ansi | |
147 | Obsoletes: %{pkgname}-common-gtk2-unicode | |
148 | ||
149 | %description -n %{pkgname}-common-%{port}-%{chartype} | |
150 | This package contains the common files needed by any version of the | |
151 | wxPython runtime. This pacakge also installs a wx.pth file which will | |
152 | determine which of the installed runtimes is the default version of | |
153 | wxPython that is imported automatically with a bare "import wx". | |
154 | ||
155 | ||
156 | ||
157 | ||
158 | ||
159 | %package -n %{pkgname}%{ver2}-devel-%{port}-%{chartype} | |
160 | Summary: wxPython development files | |
161 | Group: Development/Libraries | |
162 | Requires: %{pkgname}%{ver2}-%{port}-%{chartype} = %{version} | |
163 | ||
164 | %description -n %{pkgname}%{ver2}-devel-%{port}-%{chartype} | |
5ccc0a56 | 165 | This packages contains the headers and etc. for building apps or |
70934952 | 166 | Python extension modules that use the same wxWidgets shared libraries |
5ccc0a56 RD |
167 | that wxPython uses. |
168 | ||
70934952 RD |
169 | |
170 | ||
171 | #---------------------------------------------------------------------- | |
4726eec6 | 172 | %prep |
357262e4 | 173 | %setup -q -n %{tarname}-%{version} |
4726eec6 RD |
174 | |
175 | ||
70934952 | 176 | #---------------------------------------------------------------------- |
4726eec6 | 177 | %build |
4726eec6 | 178 | |
1e4a197e | 179 | WXDIR=`pwd` |
70934952 RD |
180 | |
181 | # Configure and build wxWidgets | |
59455c67 RD |
182 | mkdir bld |
183 | cd bld | |
70934952 | 184 | ../configure --with-gtk \ |
5ccc0a56 | 185 | --prefix=%{wxpref} \ |
70934952 | 186 | --enable-monolithic \ |
73c7ae5a | 187 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 188 | --with-opengl \ |
1e4a197e | 189 | --enable-geometry \ |
4726eec6 | 190 | --enable-optimise \ |
7f997e3f | 191 | --enable-sound --with-sdl \ |
96d37ab5 | 192 | --enable-display \ |
70934952 RD |
193 | %if %{using_gtk1} |
194 | --disable-gtk2 \ | |
195 | %else | |
196 | --enable-gtk2 \ | |
197 | %endif | |
198 | %if %{unicode} | |
199 | --enable-unicode \ | |
200 | %endif | |
b817523b RD |
201 | %if %{debug_flag} |
202 | --enable-debug_flag \ | |
203 | %endif | |
1e4a197e | 204 | %if %{builtin_libs} |
4726eec6 RD |
205 | --with-libjpeg=builtin \ |
206 | --with-libpng=builtin \ | |
207 | --with-libtiff=builtin \ | |
208 | --with-zlib=builtin \ | |
1e4a197e | 209 | %endif |
5ccc0a56 | 210 | |
357262e4 | 211 | |
59455c67 RD |
212 | make |
213 | make -C contrib/src/gizmos | |
214 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" | |
215 | make -C contrib/src/stc | |
59455c67 RD |
216 | |
217 | ||
70934952 RD |
218 | |
219 | # Build wxPython | |
1e4a197e | 220 | cd $WXDIR/wxPython |
4726eec6 | 221 | %{python} setup.py \ |
70934952 | 222 | WXPORT=%{port} \ |
1e4a197e | 223 | UNICODE=%{unicode} \ |
70934952 RD |
224 | EP_ADD_OPTS=1 \ |
225 | NO_SCRIPTS=1 \ | |
fda33067 RD |
226 | WX_CONFIG="$WXDIR/bld/wx-config --inplace" \ |
227 | build | |
4726eec6 | 228 | |
1e4a197e | 229 | |
1e4a197e | 230 | |
70934952 | 231 | #---------------------------------------------------------------------- |
978cadd0 RD |
232 | %install |
233 | ||
234 | WXDIR=`pwd` | |
978cadd0 | 235 | |
70934952 RD |
236 | # Install wxGTK and contribs |
237 | cd bld | |
978cadd0 RD |
238 | make prefix=$RPM_BUILD_ROOT%{wxpref} install |
239 | make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install | |
240 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install | |
241 | make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install | |
978cadd0 RD |
242 | |
243 | ||
70934952 RD |
244 | |
245 | # Install wxPython for wxGTK | |
1e4a197e | 246 | cd $WXDIR/wxPython |
4726eec6 | 247 | %{python} setup.py \ |
70934952 | 248 | WXPORT=%{port} \ |
1e4a197e | 249 | UNICODE=%{unicode} \ |
70934952 RD |
250 | EP_ADD_OPTS=1 \ |
251 | NO_SCRIPTS=1 \ | |
5ccc0a56 | 252 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
253 | install \ |
254 | --root=$RPM_BUILD_ROOT | |
255 | ||
59455c67 | 256 | |
70934952 RD |
257 | # remove the wx-config symlink, we'll redo it when installing the -devel package |
258 | rm $RPM_BUILD_ROOT%{wxpref}/bin/wx-config | |
259 | ||
260 | # make sure that debug info is stripped | |
261 | strip $RPM_BUILD_ROOT%{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/wx/*.so | |
59455c67 | 262 | |
59455c67 | 263 | |
cdc6a041 | 264 | # Since I want this RPM to be as generic as possible I won't let |
59455c67 RD |
265 | # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle |
266 | # the #! line to use the real python pathname. Since some distros | |
267 | # install python 2.2 as python2 and others as python I can't let | |
268 | # distutils do that otherwise the dependencies will be fouled up. | |
70934952 RD |
269 | # Copy them manually instead, leaving the #!/usr/bin/env line intact. |
270 | cd $WXDIR/wxPython | |
8b9a4190 | 271 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 | 272 | for s in \ |
1e4a197e | 273 | helpviewer \ |
cdc6a041 RD |
274 | img2png \ |
275 | img2py \ | |
276 | img2xpm \ | |
1fded56b RD |
277 | pyalacarte \ |
278 | pyalamode \ | |
cdc6a041 | 279 | pycrust \ |
1fded56b | 280 | pywrap \ |
cdc6a041 | 281 | pyshell \ |
70934952 | 282 | pywxrc \ |
cdc6a041 | 283 | xrced; do |
8b9a4190 | 284 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
cdc6a041 RD |
285 | done |
286 | ||
287 | ||
8b9a4190 | 288 | |
70934952 | 289 | # install KDE & GNOME menu items |
bc59c206 RD |
290 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development |
291 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications | |
292 | for d in distrib/*.desktop; do | |
293 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development | |
294 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications | |
295 | done | |
296 | ||
297 | # install KDE icons | |
298 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps | |
299 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps | |
300 | install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png | |
301 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png | |
302 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png | |
303 | install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png | |
304 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png | |
305 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png | |
306 | ||
70934952 | 307 | # install Mandrake menu items |
ea48a085 | 308 | mkdir -p $RPM_BUILD_ROOT%{_libdir}/menu |
70934952 RD |
309 | cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{pkgname} <<EOF |
310 | ?package(%{pkgname}): \\ | |
bc59c206 RD |
311 | command="%{_bindir}/pyshell" \\ |
312 | needs="X11" \\ | |
313 | icon="PyCrust.png" \\ | |
314 | section="Applications/Development/Tools" \\ | |
315 | title="PyShell" \\ | |
316 | longtitle="GUI Python Shell" | |
70934952 | 317 | ?package(%{pkgname}): \\ |
bc59c206 RD |
318 | command="%{_bindir}/pycrust" \\ |
319 | needs="X11" \\ | |
320 | icon="PyCrust.png" \\ | |
321 | section="Applications/Development/Tools" \\ | |
322 | title="PyCrust" \\ | |
323 | longtitle="GUI Python Shell with Filling" | |
70934952 | 324 | ?package(%{pkgname}): \\ |
bc59c206 RD |
325 | command="%{_bindir}/pyalamode" \\ |
326 | needs="X11" \\ | |
327 | icon="PyCrust.png" \\ | |
328 | section="Applications/Development/Tools" \\ | |
329 | title="PyAlaMode" \\ | |
330 | longtitle="GUI Python Shell with Filling and editor windows" | |
70934952 | 331 | ?package(%{pkgname}): \\ |
bc59c206 RD |
332 | command="%{_bindir}/xrced" \\ |
333 | needs="X11" \\ | |
334 | icon="XRCed.png" \\ | |
335 | section="Applications/Development/Tools" \\ | |
336 | title="XRCed" \\ | |
337 | longtitle="wxPython XRC resource editor" | |
338 | EOF | |
1fded56b | 339 | |
63b1cb82 | 340 | |
70934952 | 341 | #---------------------------------------------------------------------- |
bc59c206 | 342 | |
70934952 RD |
343 | %post -n %{pkgname}%{ver2}-%{port}-%{chartype} |
344 | if [ ! -e %{wxprefbase} ]; then | |
345 | ln -s %{pkgname}-%{version}-%{port}-%{chartype} %{wxprefbase} | |
63b1cb82 | 346 | fi |
63b1cb82 | 347 | |
70934952 RD |
348 | %preun -n %{pkgname}%{ver2}-%{port}-%{chartype} |
349 | if [ -L %{wxprefbase} ]; then | |
350 | if [ `readlink %{wxprefbase}` == %{pkgname}-%{version}-%{port}-%{chartype} ]; then | |
351 | rm -f %{wxprefbase} | |
352 | fi | |
bc59c206 | 353 | fi |
70934952 RD |
354 | |
355 | ||
356 | ||
357 | ||
358 | %post -n %{pkgname}-common-%{port}-%{chartype} | |
bc59c206 RD |
359 | # This is done on Mandrake to update its menus: |
360 | if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
361 | ||
70934952 | 362 | %postun -n %{pkgname}-common-%{port}-%{chartype} |
bc59c206 RD |
363 | # This is done on Mandrake to update its menus: |
364 | if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi | |
365 | ||
63b1cb82 | 366 | |
70934952 RD |
367 | |
368 | %post -n %{pkgname}%{ver2}-devel-%{port}-%{chartype} | |
369 | cd %{wxpref}/bin | |
370 | ln -s ../lib/wx/config/%{port}-%{chartype}* wx-config | |
371 | ||
372 | %preun -n %{pkgname}%{ver2}-devel-%{port}-%{chartype} | |
373 | rm %{wxpref}/bin/wx-config | |
374 | ||
375 | ||
376 | #---------------------------------------------------------------------- | |
bc59c206 RD |
377 | %clean |
378 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
379 | |
380 | ||
70934952 | 381 | #---------------------------------------------------------------------- |
1e4a197e | 382 | |
70934952 | 383 | %files -n %{pkgname}%{ver2}-%{port}-%{chartype} |
5ccc0a56 | 384 | %defattr(-,root,root) |
59455c67 | 385 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
1fded56b | 386 | %doc wxPython/docs/* |
70934952 RD |
387 | %dir %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype} |
388 | %{pref}/lib*/python%{pyver}/site-packages/wx-%{ver2}*-%{port}-%{chartype}/* | |
a55bea57 RD |
389 | %dir %{wxpref} |
390 | %dir %{wxpref}/lib | |
70934952 | 391 | %{wxpref}/lib/libwx_gtk* |
59455c67 | 392 | %{wxpref}/share |
70934952 RD |
393 | |
394 | ||
395 | ||
396 | %files -n %{pkgname}-common-%{port}-%{chartype} | |
397 | %defattr(-,root,root) | |
398 | %{pref}/lib*/python%{pyver}/site-packages/wxversion.* | |
399 | %{pref}/lib*/python%{pyver}/site-packages/wx.pth | |
400 | %{_bindir}/* | |
bc59c206 RD |
401 | %{_datadir}/applnk/Development/* |
402 | %{_datadir}/applications/* | |
403 | %{_datadir}/icons/hicolor/*/apps/* | |
404 | %{_datadir}/pixmaps/* | |
405 | %{_libdir}/menu/* | |
406 | ||
5ccc0a56 | 407 | |
4726eec6 | 408 | |
70934952 RD |
409 | |
410 | ||
411 | %files -n %{pkgname}%{ver2}-devel-%{port}-%{chartype} | |
59455c67 RD |
412 | %defattr(-,root,root) |
413 | %{wxpref}/include | |
414 | %{wxpref}/lib/wx | |
70934952 RD |
415 | %dir %{wxpref}/bin |
416 | ||
4726eec6 | 417 | |
70934952 | 418 | #---------------------------------------------------------------------- |
4726eec6 | 419 | # end of file |