]>
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 |
5ccc0a56 | 11 | %define wxpref %{pref}/lib/wxPython |
1e4a197e | 12 | %define name wxPython%{port}-py%{pyver} |
4726eec6 | 13 | |
b817523b | 14 | |
1e4a197e RD |
15 | # Should the builtin image and etc. libs be used, or system libs? |
16 | # Distro specific RPMs should probably set this to 0, generic ones | |
17 | # should use 1 | |
18 | %define builtin_libs 1 | |
b817523b | 19 | |
4726eec6 | 20 | |
1e4a197e RD |
21 | # Should --enable-debug_flag be used in release builds? Using it |
22 | # defines __WXDEBUG__ and gives us runtime diagnostics that are turned | |
23 | # into Python exceptions starting with 2.3.4. (So turning it on is a | |
24 | # very helpful thing IMO and is recommended.) | |
25 | %define debug_flag 1 | |
4726eec6 | 26 | |
1e4a197e RD |
27 | |
28 | # build the name of the real wx-config from the port, flags, etc. | |
29 | %define dbgflg %(if [ "%{debug_flag}" = "1" ]; then echo d; fi) | |
30 | %define uniflg %(if [ "%{unicode}" = "1" ]; then echo u; fi) | |
1fded56b RD |
31 | %define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi) |
32 | %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi) | |
1e4a197e | 33 | %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config |
b817523b | 34 | |
1fded56b RD |
35 | # turn off the generation of debuginfo rpm (RH9) |
36 | %define debug_package %{nil} | |
b817523b | 37 | |
5ccc0a56 RD |
38 | #---------------------------------------------------------------- |
39 | Summary: Cross platform GUI toolkit for Python using wx%{port} | |
40 | Name: %{name} | |
41 | Version: %{version} | |
42 | Release: %{release} | |
43 | Source0: %{tarname}-%{version}.tar.gz | |
44 | License: wxWindows Library Licence, Version 3 | |
45 | URL: http://wxPython.org/ | |
ba201fa4 | 46 | Packager: Robin Dunn <robin@alldunn.com> |
5ccc0a56 | 47 | Group: Development/Python |
4726eec6 | 48 | BuildRoot: %{_tmppath}/%{name}-buildroot |
5ccc0a56 | 49 | Prefix: %{pref} |
4726eec6 | 50 | |
4726eec6 | 51 | Provides: wxPython = %{version} |
1e4a197e | 52 | Provides: wxPython%{port} = %{version} |
4726eec6 | 53 | |
1fded56b RD |
54 | Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so |
55 | Provides: libwx_%{lcport}%{uniflg}%{dbgflg}-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2}) | |
56 | Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so | |
57 | Provides: libwx_%{lcport}%{uniflg}%{dbgflg}_gl-%{ver2}.so(WX%{port}%{UNIFLG}%{DBGFLG}_%{ver2}) | |
58 | ||
59 | ||
5ccc0a56 | 60 | # old wxPython packages |
1fded56b | 61 | Obsoletes: wxPython wxPython%{port} |
4726eec6 RD |
62 | |
63 | ||
64 | %description | |
65 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
66 | wxWindows C++ GUI library. wxPython provides a large variety of | |
67 | window types and controls, all implemented with a native look and feel | |
68 | (and native runtime speed) on the platforms it is supported on. | |
69 | ||
5ccc0a56 | 70 | This package is implemented using the %{port} port of wxWindows, and |
4726eec6 RD |
71 | includes the wx%{port} shared libs and etc. |
72 | ||
73 | ||
1e4a197e | 74 | %package -n wxPython%{port}-devel |
5ccc0a56 RD |
75 | Summary: wxPython%{port} development files |
76 | Group: Development/Libraries | |
77 | Requires: wxPython%{port} = %{version} | |
78 | ||
79 | ||
1e4a197e | 80 | %description -n wxPython%{port}-devel |
5ccc0a56 RD |
81 | This packages contains the headers and etc. for building apps or |
82 | Python extension modules that use the same wx%{port} shared libraries | |
83 | that wxPython uses. | |
84 | ||
85 | #---------------------------------------------------------------- | |
4726eec6 | 86 | %prep |
357262e4 | 87 | %setup -q -n %{tarname}-%{version} |
4726eec6 RD |
88 | |
89 | ||
5ccc0a56 | 90 | #---------------------------------------------------------------- |
4726eec6 RD |
91 | %build |
92 | if [ "$SMP" != "" ]; then | |
93 | MAKE="make -j$SMP" | |
94 | else | |
95 | MAKE="make" | |
96 | fi | |
97 | ||
1e4a197e | 98 | WXDIR=`pwd` |
4726eec6 RD |
99 | mkdir build |
100 | cd build | |
101 | ||
1e4a197e RD |
102 | # Configure, trying to reduce external dependencies |
103 | $WXDIR/configure --with-%{lcport} \ | |
5ccc0a56 RD |
104 | --prefix=%{wxpref} \ |
105 | --disable-soname \ | |
73c7ae5a | 106 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 107 | --with-opengl \ |
1e4a197e RD |
108 | %if %{unicode} |
109 | --enable-gtk2 \ | |
110 | --enable-unicode \ | |
111 | %endif | |
112 | --enable-geometry \ | |
4726eec6 | 113 | --enable-optimise \ |
b817523b RD |
114 | %if %{debug_flag} |
115 | --enable-debug_flag \ | |
116 | %endif | |
1e4a197e | 117 | %if %{builtin_libs} |
4726eec6 RD |
118 | --with-libjpeg=builtin \ |
119 | --with-libpng=builtin \ | |
120 | --with-libtiff=builtin \ | |
121 | --with-zlib=builtin \ | |
1e4a197e | 122 | %endif |
5ccc0a56 | 123 | |
357262e4 | 124 | |
4726eec6 RD |
125 | # Build wxWindows |
126 | $MAKE | |
127 | ||
4726eec6 RD |
128 | |
129 | # Now build wxPython | |
1e4a197e | 130 | cd $WXDIR/wxPython |
4726eec6 RD |
131 | %{python} setup.py \ |
132 | IN_CVS_TREE=1 \ | |
cdc6a041 | 133 | NO_SCRIPTS=1 \ |
1e4a197e RD |
134 | WXPORT=%{lcport} \ |
135 | UNICODE=%{unicode} \ | |
136 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \ | |
4726eec6 RD |
137 | build |
138 | ||
1e4a197e RD |
139 | |
140 | ||
141 | # Build wxrc (XRC resource tool) but don't use the makefiles since they expect | |
142 | # a shared version of the xrc lib to have been built... | |
143 | cd $WXDIR/contrib/utils/wxrc | |
144 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" | |
145 | wCC=`$WX_CONFIG --cc` | |
146 | wCXX=`$WX_CONFIG --cxx` | |
147 | ||
1fded56b | 148 | for f in wxrc.cpp ../../src/xrc/xml.cpp ../../src/xrc/xmlres.cpp; do |
1e4a197e RD |
149 | echo $f |
150 | $wCXX `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
151 | done | |
152 | for f in ../../src/xrc/expat/xmlparse/xmlparse.c ../../src/xrc/expat/xmltok/xmlrole.c ../../src/xrc/expat/xmltok/xmltok.c; do | |
153 | echo $f | |
154 | $wCC `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
155 | done | |
156 | ||
1e4a197e RD |
157 | $wCXX `$WX_CONFIG --libs` *.o -o wxrc |
158 | strip wxrc | |
159 | ||
4726eec6 | 160 | |
5ccc0a56 | 161 | #---------------------------------------------------------------- |
4726eec6 | 162 | %install |
1e4a197e RD |
163 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
164 | ||
165 | # install wxWindows | |
166 | WXDIR=`pwd` | |
167 | cd build | |
168 | make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
169 | ||
170 | # install wxPython | |
171 | cd $WXDIR/wxPython | |
4726eec6 RD |
172 | %{python} setup.py \ |
173 | IN_CVS_TREE=1 \ | |
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 | ||
cdc6a041 | 181 | # Since I want this RPM to be as generic as possible I won't let |
1e4a197e RD |
182 | # distutils copy the scripts since it will mangle the #! line to use |
183 | # the real python pathname. Since some distros install python 2.2 as | |
184 | # python2 and others as python, then I can't let distutils do that | |
185 | # otherwise the dependencies will be fouled up. Copy them manually | |
186 | # instead, leaving the #!/bin/env line intact. | |
187 | # | |
188 | # TODO: Should this be dependent on %{builtin_libs} or something like it? | |
cdc6a041 RD |
189 | |
190 | mkdir -p $RPM_BUILD_ROOT/usr/bin | |
191 | for s in \ | |
1e4a197e | 192 | helpviewer \ |
cdc6a041 RD |
193 | img2png \ |
194 | img2py \ | |
195 | img2xpm \ | |
1fded56b RD |
196 | pyalacarte \ |
197 | pyalamode \ | |
cdc6a041 | 198 | pycrust \ |
1fded56b | 199 | pywrap \ |
cdc6a041 RD |
200 | pyshell \ |
201 | xrced; do | |
1e4a197e | 202 | cp scripts/$s $RPM_BUILD_ROOT/%{pref}/bin |
cdc6a041 RD |
203 | done |
204 | ||
205 | ||
1e4a197e RD |
206 | # Install wxrc |
207 | cp $WXDIR/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT/%{pref}/bin | |
4726eec6 RD |
208 | |
209 | ||
1fded56b RD |
210 | # Copy icons and make menu entries |
211 | #-- This only works for Mandrake. Is there a cross-distro way to do it? | |
212 | ##mkdir -p $RPM_BUILD_ROOT/%{_iconsdir} | |
213 | ##mkdir -p $RPM_BUILD_ROOT/%{_miconsdir} | |
214 | ##mkdir -p $RPM_BUILD_ROOT/%{_menudir} | |
215 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_32.png $RPM_BUILD_ROOT/%{_iconsdir}/PyCrust.png | |
216 | ##install -p -m 644 $WXDIR/wxPython/wxPython/py/PyCrust_16.png $RPM_BUILD_ROOT/%{_miconsdir}/PyCrust.png | |
217 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT/%{_iconsdir}/XRCed.png | |
218 | ##install -p -m 644 $WXDIR/wxPython/wxPython/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT/%{_miconsdir}/XRCed.png | |
219 | ## | |
220 | ##cat > $RPM_BUILD_ROOT/%{_menudir}/%{name} <<EOF | |
221 | ##?package(%{name}): command="%_bindir/pyshell" needs="X11" \ | |
222 | ##icon="PyCrust.png" section="Applications/Development" \ | |
223 | ##title="PyShell" longtitle="Python Shell" | |
224 | ## | |
225 | ##?package(%{name}): command="%_bindir/pycrust" needs="X11" \ | |
226 | ##icon="PyCrust.png" section="Applications/Development" \ | |
227 | ##title="PyCrust" longtitle="Python Shell with Filling" | |
228 | ## | |
229 | ##?package(%{name}): command="%_bindir/pyalamode" needs="X11" \ | |
230 | ##icon="PyCrust.png" section="Applications/Development" \ | |
231 | ##title="PyAlaMode" longtitle="Python Shell with Filling and editor windows" | |
232 | ## | |
233 | ##?package(%{name}): command="%_bindir/xrced" needs="X11" \ | |
234 | ##icon="XRCed.png" section="Applications/Development" \ | |
235 | ##title="XRCed" longtitle="wxPython XRC resource editor" | |
236 | ## | |
237 | ##EOF | |
238 | ||
239 | ||
240 | ||
1e4a197e RD |
241 | # Generate the filelists. For some reason the %defattr below is still |
242 | # resulting in many (but not all) files not owned by root when just | |
243 | # specifying directories and wildcards to be included in each package. | |
244 | # So instead we'll build some explicit filelists here and use %attr on | |
245 | # each entry. | |
246 | cd $WXDIR | |
247 | mkdir -p $RPM_BUILD_ROOT%{pref}/share/doc | |
248 | GFL="%{python} wxPython/distrib/genfilelist.py" | |
249 | $GFL $RPM_BUILD_ROOT %{pref} > FILELIST | |
250 | $GFL -r $RPM_BUILD_ROOT %{pref}/bin >> FILELIST | |
251 | $GFL $RPM_BUILD_ROOT %{pref}/lib >> FILELIST | |
252 | $GFL -r $RPM_BUILD_ROOT %{pref}/lib/python%{pyver} >> FILELIST | |
253 | $GFL -r $RPM_BUILD_ROOT %{pref}/share >> FILELIST | |
254 | $GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST | |
255 | $GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST | |
256 | $GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST | |
257 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST | |
1fded56b RD |
258 | ###GFL -r $RPM_BUILD_ROOT %{_iconsdir} >> FILELIST |
259 | ##$GFL -r $RPM_BUILD_ROOT %{_menudir} >> FILELIST | |
4726eec6 | 260 | |
1e4a197e RD |
261 | $GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST |
262 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST | |
263 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/lib/wx >> DEVELLIST | |
264 | $GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST | |
265 | $GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST | |
4726eec6 RD |
266 | |
267 | ||
1fded56b RD |
268 | #---------------------------------------------------------------- |
269 | ##%post | |
270 | ##%{update_menus} | |
271 | ## | |
272 | ##%postun | |
273 | ##%{clean_menus} | |
274 | ||
5ccc0a56 | 275 | #---------------------------------------------------------------- |
1e4a197e RD |
276 | %clean |
277 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
278 | |
279 | ||
5ccc0a56 | 280 | #---------------------------------------------------------------- |
1e4a197e RD |
281 | |
282 | %files -f FILELIST | |
5ccc0a56 | 283 | %defattr(-,root,root) |
1e4a197e RD |
284 | %doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt |
285 | %doc wxPython/README.txt wxPython/CHANGES.txt | |
1fded56b | 286 | %doc wxPython/docs/* |
5ccc0a56 | 287 | |
1e4a197e | 288 | %files -n wxPython%{port}-devel -f DEVELLIST |
4726eec6 | 289 | %defattr(-,root,root) |
4726eec6 RD |
290 | |
291 | ||
5ccc0a56 | 292 | #---------------------------------------------------------------- |
4726eec6 | 293 | # end of file |