]>
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) | |
31 | %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config | |
b817523b RD |
32 | |
33 | ||
5ccc0a56 RD |
34 | #---------------------------------------------------------------- |
35 | Summary: Cross platform GUI toolkit for Python using wx%{port} | |
36 | Name: %{name} | |
37 | Version: %{version} | |
38 | Release: %{release} | |
39 | Source0: %{tarname}-%{version}.tar.gz | |
40 | License: wxWindows Library Licence, Version 3 | |
41 | URL: http://wxPython.org/ | |
ba201fa4 | 42 | Packager: Robin Dunn <robin@alldunn.com> |
5ccc0a56 | 43 | Group: Development/Python |
4726eec6 | 44 | BuildRoot: %{_tmppath}/%{name}-buildroot |
5ccc0a56 RD |
45 | Prefix: %{pref} |
46 | #BuildRequires: %{python} | |
4726eec6 | 47 | |
4726eec6 | 48 | Provides: wxPython = %{version} |
1e4a197e | 49 | Provides: wxPython%{port} = %{version} |
4726eec6 | 50 | |
5ccc0a56 RD |
51 | # old wxPython packages |
52 | Obsoletes: wxPython | |
4726eec6 RD |
53 | |
54 | ||
55 | %description | |
56 | wxPython is a GUI toolkit for Python that is a wrapper around the | |
57 | wxWindows C++ GUI library. wxPython provides a large variety of | |
58 | window types and controls, all implemented with a native look and feel | |
59 | (and native runtime speed) on the platforms it is supported on. | |
60 | ||
5ccc0a56 | 61 | This package is implemented using the %{port} port of wxWindows, and |
4726eec6 RD |
62 | includes the wx%{port} shared libs and etc. |
63 | ||
64 | ||
1e4a197e | 65 | %package -n wxPython%{port}-devel |
5ccc0a56 RD |
66 | Summary: wxPython%{port} development files |
67 | Group: Development/Libraries | |
68 | Requires: wxPython%{port} = %{version} | |
69 | ||
70 | ||
1e4a197e | 71 | %description -n wxPython%{port}-devel |
5ccc0a56 RD |
72 | This packages contains the headers and etc. for building apps or |
73 | Python extension modules that use the same wx%{port} shared libraries | |
74 | that wxPython uses. | |
75 | ||
76 | #---------------------------------------------------------------- | |
4726eec6 | 77 | %prep |
357262e4 | 78 | %setup -q -n %{tarname}-%{version} |
4726eec6 RD |
79 | |
80 | ||
5ccc0a56 | 81 | #---------------------------------------------------------------- |
4726eec6 RD |
82 | %build |
83 | if [ "$SMP" != "" ]; then | |
84 | MAKE="make -j$SMP" | |
85 | else | |
86 | MAKE="make" | |
87 | fi | |
88 | ||
1e4a197e | 89 | WXDIR=`pwd` |
4726eec6 RD |
90 | mkdir build |
91 | cd build | |
92 | ||
1e4a197e RD |
93 | # Configure, trying to reduce external dependencies |
94 | $WXDIR/configure --with-%{lcport} \ | |
5ccc0a56 RD |
95 | --prefix=%{wxpref} \ |
96 | --disable-soname \ | |
73c7ae5a | 97 | --enable-rpath=%{wxpref}/lib \ |
4726eec6 | 98 | --with-opengl \ |
1e4a197e RD |
99 | %if %{unicode} |
100 | --enable-gtk2 \ | |
101 | --enable-unicode \ | |
102 | %endif | |
103 | --enable-geometry \ | |
4726eec6 | 104 | --enable-optimise \ |
b817523b RD |
105 | %if %{debug_flag} |
106 | --enable-debug_flag \ | |
107 | %endif | |
1e4a197e | 108 | %if %{builtin_libs} |
4726eec6 RD |
109 | --with-libjpeg=builtin \ |
110 | --with-libpng=builtin \ | |
111 | --with-libtiff=builtin \ | |
112 | --with-zlib=builtin \ | |
1e4a197e | 113 | %endif |
5ccc0a56 | 114 | |
357262e4 | 115 | |
4726eec6 RD |
116 | # Build wxWindows |
117 | $MAKE | |
118 | ||
4726eec6 RD |
119 | |
120 | # Now build wxPython | |
1e4a197e | 121 | cd $WXDIR/wxPython |
4726eec6 RD |
122 | %{python} setup.py \ |
123 | IN_CVS_TREE=1 \ | |
cdc6a041 | 124 | NO_SCRIPTS=1 \ |
1e4a197e RD |
125 | WXPORT=%{lcport} \ |
126 | UNICODE=%{unicode} \ | |
127 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \ | |
4726eec6 RD |
128 | build |
129 | ||
1e4a197e RD |
130 | ## WX_CONFIG="$WXDIR/build/wx-config --inplace --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
131 | ||
132 | ||
133 | ||
134 | # Build wxrc (XRC resource tool) but don't use the makefiles since they expect | |
135 | # a shared version of the xrc lib to have been built... | |
136 | cd $WXDIR/contrib/utils/wxrc | |
137 | WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" | |
138 | wCC=`$WX_CONFIG --cc` | |
139 | wCXX=`$WX_CONFIG --cxx` | |
140 | ||
141 | for f in wxrc.cpp ../../src/xrc/*.cpp; do | |
142 | echo $f | |
143 | $wCXX `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
144 | done | |
145 | for f in ../../src/xrc/expat/xmlparse/xmlparse.c ../../src/xrc/expat/xmltok/xmlrole.c ../../src/xrc/expat/xmltok/xmltok.c; do | |
146 | echo $f | |
147 | $wCC `$WX_CONFIG --cxxflags` -I ../../include -I ../../src/xrc/expat/xmlparse -I ../../src/xrc/expat/xmltok -c $f | |
148 | done | |
149 | ||
150 | # the handlers are not needed | |
151 | rm xh_*.o xmlrsall.o | |
152 | ||
153 | $wCXX `$WX_CONFIG --libs` *.o -o wxrc | |
154 | strip wxrc | |
155 | ||
4726eec6 | 156 | |
5ccc0a56 | 157 | #---------------------------------------------------------------- |
4726eec6 | 158 | %install |
1e4a197e RD |
159 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
160 | ||
161 | # install wxWindows | |
162 | WXDIR=`pwd` | |
163 | cd build | |
164 | make prefix=$RPM_BUILD_ROOT%{wxpref} install | |
165 | ||
166 | # install wxPython | |
167 | cd $WXDIR/wxPython | |
4726eec6 RD |
168 | %{python} setup.py \ |
169 | IN_CVS_TREE=1 \ | |
cdc6a041 | 170 | NO_SCRIPTS=1 \ |
1e4a197e RD |
171 | WXPORT=%{lcport} \ |
172 | UNICODE=%{unicode} \ | |
5ccc0a56 | 173 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
4726eec6 RD |
174 | install \ |
175 | --root=$RPM_BUILD_ROOT | |
176 | ||
cdc6a041 | 177 | # Since I want this RPM to be as generic as possible I won't let |
1e4a197e RD |
178 | # distutils copy the scripts since it will mangle the #! line to use |
179 | # the real python pathname. Since some distros install python 2.2 as | |
180 | # python2 and others as python, then I can't let distutils do that | |
181 | # otherwise the dependencies will be fouled up. Copy them manually | |
182 | # instead, leaving the #!/bin/env line intact. | |
183 | # | |
184 | # TODO: Should this be dependent on %{builtin_libs} or something like it? | |
cdc6a041 RD |
185 | |
186 | mkdir -p $RPM_BUILD_ROOT/usr/bin | |
187 | for s in \ | |
1e4a197e | 188 | helpviewer \ |
cdc6a041 RD |
189 | img2png \ |
190 | img2py \ | |
191 | img2xpm \ | |
192 | pycrust \ | |
1e4a197e | 193 | pycwrap \ |
cdc6a041 RD |
194 | pyshell \ |
195 | xrced; do | |
1e4a197e | 196 | cp scripts/$s $RPM_BUILD_ROOT/%{pref}/bin |
cdc6a041 RD |
197 | done |
198 | ||
199 | ||
1e4a197e RD |
200 | # Install wxrc |
201 | cp $WXDIR/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT/%{pref}/bin | |
4726eec6 RD |
202 | |
203 | ||
1e4a197e RD |
204 | # Generate the filelists. For some reason the %defattr below is still |
205 | # resulting in many (but not all) files not owned by root when just | |
206 | # specifying directories and wildcards to be included in each package. | |
207 | # So instead we'll build some explicit filelists here and use %attr on | |
208 | # each entry. | |
209 | cd $WXDIR | |
210 | mkdir -p $RPM_BUILD_ROOT%{pref}/share/doc | |
211 | GFL="%{python} wxPython/distrib/genfilelist.py" | |
212 | $GFL $RPM_BUILD_ROOT %{pref} > FILELIST | |
213 | $GFL -r $RPM_BUILD_ROOT %{pref}/bin >> FILELIST | |
214 | $GFL $RPM_BUILD_ROOT %{pref}/lib >> FILELIST | |
215 | $GFL -r $RPM_BUILD_ROOT %{pref}/lib/python%{pyver} >> FILELIST | |
216 | $GFL -r $RPM_BUILD_ROOT %{pref}/share >> FILELIST | |
217 | $GFL $RPM_BUILD_ROOT %{wxpref} >> FILELIST | |
218 | $GFL $RPM_BUILD_ROOT %{wxpref}/lib >> FILELIST | |
219 | $GFL $RPM_BUILD_ROOT "%{wxpref}/lib/libwx*" >> FILELIST | |
220 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/share >> FILELIST | |
4726eec6 | 221 | |
1e4a197e RD |
222 | $GFL $RPM_BUILD_ROOT %{wxpref}/include > DEVELLIST |
223 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/include/wx >> DEVELLIST | |
224 | $GFL -r $RPM_BUILD_ROOT %{wxpref}/lib/wx >> DEVELLIST | |
225 | $GFL $RPM_BUILD_ROOT %{wxconfigname} >> DEVELLIST | |
226 | $GFL $RPM_BUILD_ROOT %{wxpref}/bin/wx-config >> DEVELLIST | |
4726eec6 RD |
227 | |
228 | ||
5ccc0a56 | 229 | #---------------------------------------------------------------- |
1e4a197e RD |
230 | %clean |
231 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT | |
4726eec6 RD |
232 | |
233 | ||
5ccc0a56 | 234 | #---------------------------------------------------------------- |
1e4a197e RD |
235 | |
236 | %files -f FILELIST | |
5ccc0a56 | 237 | %defattr(-,root,root) |
1e4a197e RD |
238 | %doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt |
239 | %doc wxPython/README.txt wxPython/CHANGES.txt | |
5ccc0a56 RD |
240 | |
241 | ||
1e4a197e | 242 | %files -n wxPython%{port}-devel -f DEVELLIST |
4726eec6 | 243 | %defattr(-,root,root) |
4726eec6 RD |
244 | |
245 | ||
5ccc0a56 | 246 | #---------------------------------------------------------------- |
4726eec6 | 247 | # end of file |