]>
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 | |
1fded56b 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}) | |
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 RD |
92 | %build |
93 | if [ "$SMP" != "" ]; then | |
94 | MAKE="make -j$SMP" | |
95 | else | |
96 | MAKE="make" | |
97 | fi | |
98 | ||
1e4a197e | 99 | WXDIR=`pwd` |
4726eec6 RD |
100 | mkdir build |
101 | cd build | |
102 | ||
1e4a197e RD |
103 | # Configure, trying to reduce external dependencies |
104 | $WXDIR/configure --with-%{lcport} \ | |
5ccc0a56 RD |
105 | --prefix=%{wxpref} \ |
106 | --disable-soname \ | |
73c7ae5a | 107 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 108 | --with-opengl \ |
1e4a197e RD |
109 | %if %{unicode} |
110 | --enable-gtk2 \ | |
111 | --enable-unicode \ | |
112 | %endif | |
113 | --enable-geometry \ | |
4726eec6 | 114 | --enable-optimise \ |
b817523b RD |
115 | %if %{debug_flag} |
116 | --enable-debug_flag \ | |
117 | %endif | |
1e4a197e | 118 | %if %{builtin_libs} |
4726eec6 RD |
119 | --with-libjpeg=builtin \ |
120 | --with-libpng=builtin \ | |
121 | --with-libtiff=builtin \ | |
122 | --with-zlib=builtin \ | |
1e4a197e | 123 | %endif |
5ccc0a56 | 124 | |
357262e4 | 125 | |
4726eec6 RD |
126 | # Build wxWindows |
127 | $MAKE | |
128 | ||
4726eec6 RD |
129 | |
130 | # Now build wxPython | |
1e4a197e | 131 | cd $WXDIR/wxPython |
4726eec6 RD |
132 | %{python} setup.py \ |
133 | IN_CVS_TREE=1 \ | |
cdc6a041 | 134 | NO_SCRIPTS=1 \ |
1e4a197e RD |
135 | WXPORT=%{lcport} \ |
136 | UNICODE=%{unicode} \ | |
137 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \ | |
4726eec6 RD |
138 | build |
139 | ||
1e4a197e RD |
140 | |
141 | ||
142 | # Build wxrc (XRC resource tool) but don't use the makefiles since they expect | |
143 | # a shared version of the xrc lib to have been built... | |
144 | cd $WXDIR/contrib/utils/wxrc | |
145 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" | |
146 | wCC=`$WX_CONFIG --cc` | |
147 | wCXX=`$WX_CONFIG --cxx` | |
148 | ||
1fded56b | 149 | for f in wxrc.cpp ../../src/xrc/xml.cpp ../../src/xrc/xmlres.cpp; do |
1e4a197e RD |
150 | echo $f |
151 | $wCXX `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
152 | done | |
153 | for f in ../../src/xrc/expat/xmlparse/xmlparse.c ../../src/xrc/expat/xmltok/xmlrole.c ../../src/xrc/expat/xmltok/xmltok.c; do | |
154 | echo $f | |
155 | $wCC `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
156 | done | |
157 | ||
1e4a197e RD |
158 | $wCXX `$WX_CONFIG --libs` *.o -o wxrc |
159 | strip wxrc | |
160 | ||
4726eec6 | 161 | |
5ccc0a56 | 162 | #---------------------------------------------------------------- |
4726eec6 | 163 | %install |
1e4a197e RD |
164 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
165 | ||
166 | # install wxWindows | |
167 | WXDIR=`pwd` | |
168 | cd build | |
169 | make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
170 | ||
171 | # install wxPython | |
172 | cd $WXDIR/wxPython | |
4726eec6 RD |
173 | %{python} setup.py \ |
174 | IN_CVS_TREE=1 \ | |
cdc6a041 | 175 | NO_SCRIPTS=1 \ |
1e4a197e RD |
176 | WXPORT=%{lcport} \ |
177 | UNICODE=%{unicode} \ | |
5ccc0a56 | 178 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
179 | install \ |
180 | --root=$RPM_BUILD_ROOT | |
181 | ||
cdc6a041 | 182 | # Since I want this RPM to be as generic as possible I won't let |
1e4a197e RD |
183 | # distutils copy the scripts since it will mangle the #! line to use |
184 | # the real python pathname. Since some distros install python 2.2 as | |
185 | # python2 and others as python, then I can't let distutils do that | |
186 | # otherwise the dependencies will be fouled up. Copy them manually | |
187 | # instead, leaving the #!/bin/env line intact. | |
188 | # | |
189 | # TODO: Should this be dependent on %{builtin_libs} or something like 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 |
8b9a4190 RD |
208 | cp $WXDIR/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
209 | ||
210 | ||
211 | # link specific name to generic name | |
212 | ln -s wxPython-%{version} $RPM_BUILD_ROOT%{wxprefbase} | |
213 | ||
4726eec6 RD |
214 | |
215 | ||
1fded56b RD |
216 | # Copy icons and make menu entries |
217 | #-- This only works for Mandrake. Is there a cross-distro way to do it? | |
8b9a4190 RD |
218 | ##mkdir -p $RPM_BUILD_ROOT%{_iconsdir} |
219 | ##mkdir -p $RPM_BUILD_ROOT%{_miconsdir} | |
220 | ##mkdir -p $RPM_BUILD_ROOT%{_menudir} | |
221 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_32.png $RPM_BUILD_ROOT%{_iconsdir}/PyCrust.png | |
222 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_16.png $RPM_BUILD_ROOT%{_miconsdir}/PyCrust.png | |
223 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_iconsdir}/XRCed.png | |
224 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_miconsdir}/XRCed.png | |
1fded56b | 225 | ## |
8b9a4190 | 226 | ##cat > $RPM_BUILD_ROOT%{_menudir}/%{name} <<EOF |
1fded56b RD |
227 | ##?package(%{name}): command="%_bindir/pyshell" needs="X11" \ |
228 | ##icon="PyCrust.png" section="Applications/Development" \ | |
229 | ##title="PyShell" longtitle="Python Shell" | |
230 | ## | |
231 | ##?package(%{name}): command="%_bindir/pycrust" needs="X11" \ | |
232 | ##icon="PyCrust.png" section="Applications/Development" \ | |
233 | ##title="PyCrust" longtitle="Python Shell with Filling" | |
234 | ## | |
235 | ##?package(%{name}): command="%_bindir/pyalamode" needs="X11" \ | |
236 | ##icon="PyCrust.png" section="Applications/Development" \ | |
237 | ##title="PyAlaMode" longtitle="Python Shell with Filling and editor windows" | |
238 | ## | |
239 | ##?package(%{name}): command="%_bindir/xrced" needs="X11" \ | |
240 | ##icon="XRCed.png" section="Applications/Development" \ | |
241 | ##title="XRCed" longtitle="wxPython XRC resource editor" | |
242 | ## | |
243 | ##EOF | |
244 | ||
245 | ||
246 | ||
1e4a197e RD |
247 | # Generate the filelists. For some reason the %defattr below is still |
248 | # resulting in many (but not all) files not owned by root when just | |
249 | # specifying directories and wildcards to be included in each package. | |
250 | # So instead we'll build some explicit filelists here and use %attr on | |
251 | # each entry. | |
252 | cd $WXDIR | |
253 | mkdir -p $RPM_BUILD_ROOT%{pref}/share/doc | |
254 | GFL="%{python} wxPython/distrib/genfilelist.py" | |
255 | $GFL $RPM_BUILD_ROOT %{pref} > FILELIST | |
256 | $GFL -r $RPM_BUILD_ROOT %{pref}/bin >> FILELIST | |
257 | $GFL $RPM_BUILD_ROOT %{pref}/lib >> FILELIST | |
258 | $GFL -r $RPM_BUILD_ROOT %{pref}/lib/python%{pyver} >> FILELIST | |
259 | $GFL -r $RPM_BUILD_ROOT %{pref}/share >> FILELIST | |
260 | $GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST | |
8b9a4190 | 261 | $GFL $RPM_BUILD_ROOT %{wxprefbase} >> FILELIST |
1e4a197e RD |
262 | $GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST |
263 | $GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST | |
264 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST | |
1fded56b RD |
265 | ###GFL -r $RPM_BUILD_ROOT %{_iconsdir} >> FILELIST |
266 | ##$GFL -r $RPM_BUILD_ROOT %{_menudir} >> FILELIST | |
4726eec6 | 267 | |
1e4a197e RD |
268 | $GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST |
269 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST | |
270 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/lib/wx >> DEVELLIST | |
271 | $GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST | |
272 | $GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST | |
4726eec6 RD |
273 | |
274 | ||
1fded56b RD |
275 | #---------------------------------------------------------------- |
276 | ##%post | |
277 | ##%{update_menus} | |
278 | ## | |
279 | ##%postun | |
280 | ##%{clean_menus} | |
281 | ||
63b1cb82 | 282 | |
8b9a4190 | 283 | %pre |
63b1cb82 | 284 | if [ -e %{wxprefbase} ]; then |
8b9a4190 | 285 | rm -r %{wxprefbase} |
63b1cb82 | 286 | fi |
63b1cb82 RD |
287 | |
288 | %postun | |
289 | if [ -e %{wxprefbase} ]; then | |
290 | rm %{wxprefbase} | |
291 | fi | |
292 | ||
5ccc0a56 | 293 | #---------------------------------------------------------------- |
1e4a197e RD |
294 | %clean |
295 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
296 | |
297 | ||
5ccc0a56 | 298 | #---------------------------------------------------------------- |
1e4a197e RD |
299 | |
300 | %files -f FILELIST | |
5ccc0a56 | 301 | %defattr(-,root,root) |
1e4a197e RD |
302 | %doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt |
303 | %doc wxPython/README.txt wxPython/CHANGES.txt | |
1fded56b | 304 | %doc wxPython/docs/* |
5ccc0a56 | 305 | |
1e4a197e | 306 | %files -n wxPython%{port}-devel -f DEVELLIST |
4726eec6 | 307 | %defattr(-,root,root) |
4726eec6 RD |
308 | |
309 | ||
5ccc0a56 | 310 | #---------------------------------------------------------------- |
4726eec6 | 311 | # end of file |