]> git.saurik.com Git - wxWidgets.git/blob - wxPython/distrib/wxPythonFull.spec.in
After calling sizeToFit, round the size up to the next integer
[wxWidgets.git] / wxPython / distrib / wxPythonFull.spec.in
1 %define pref %{_prefix}
2 %define python @PYTHON@
3 %define pyver @PYVER@
4 %define port @PORT@
5 %define lcport @LCPORT@
6 %define unicode @UNICODE@
7 %define tarname @TARNAME@
8 %define version @VERSION@
9 %define ver2 @VER2@
10 %define release 1
11 %define wxpref %{pref}/lib/wxPython
12 %define name wxPython%{port}-py%{pyver}
13
14
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
19
20
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
26
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 DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi)
32 %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi)
33 %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config
34
35 # turn off the generation of debuginfo rpm (RH9)
36 %define debug_package %{nil}
37
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/
46 Packager: Robin Dunn <robin@alldunn.com>
47 Group: Development/Python
48 BuildRoot: %{_tmppath}/%{name}-buildroot
49 Prefix: %{pref}
50
51 Provides: wxPython = %{version}
52 Provides: wxPython%{port} = %{version}
53
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
60 # old wxPython packages
61 Obsoletes: wxPython wxPython%{port}
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
70 This package is implemented using the %{port} port of wxWindows, and
71 includes the wx%{port} shared libs and etc.
72
73
74 %package -n wxPython%{port}-devel
75 Summary: wxPython%{port} development files
76 Group: Development/Libraries
77 Requires: wxPython%{port} = %{version}
78
79
80 %description -n wxPython%{port}-devel
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 #----------------------------------------------------------------
86 %prep
87 %setup -q -n %{tarname}-%{version}
88
89
90 #----------------------------------------------------------------
91 %build
92 if [ "$SMP" != "" ]; then
93 MAKE="make -j$SMP"
94 else
95 MAKE="make"
96 fi
97
98 WXDIR=`pwd`
99 mkdir build
100 cd build
101
102 # Configure, trying to reduce external dependencies
103 $WXDIR/configure --with-%{lcport} \
104 --prefix=%{wxpref} \
105 --disable-soname \
106 --enable-rpath=%{wxpref}/lib \
107 --with-opengl \
108 %if %{unicode}
109 --enable-gtk2 \
110 --enable-unicode \
111 %endif
112 --enable-geometry \
113 --enable-optimise \
114 %if %{debug_flag}
115 --enable-debug_flag \
116 %endif
117 %if %{builtin_libs}
118 --with-libjpeg=builtin \
119 --with-libpng=builtin \
120 --with-libtiff=builtin \
121 --with-zlib=builtin \
122 %endif
123
124
125 # Build wxWindows
126 $MAKE
127
128
129 # Now build wxPython
130 cd $WXDIR/wxPython
131 %{python} setup.py \
132 IN_CVS_TREE=1 \
133 NO_SCRIPTS=1 \
134 WXPORT=%{lcport} \
135 UNICODE=%{unicode} \
136 WX_CONFIG="$WXDIR/build/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/build" \
137 build
138
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
148 for f in wxrc.cpp ../../src/xrc/xml.cpp ../../src/xrc/xmlres.cpp; do
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
157 $wCXX `$WX_CONFIG --libs` *.o -o wxrc
158 strip wxrc
159
160
161 #----------------------------------------------------------------
162 %install
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
172 %{python} setup.py \
173 IN_CVS_TREE=1 \
174 NO_SCRIPTS=1 \
175 WXPORT=%{lcport} \
176 UNICODE=%{unicode} \
177 WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \
178 install \
179 --root=$RPM_BUILD_ROOT
180
181 # Since I want this RPM to be as generic as possible I won't let
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?
189
190 mkdir -p $RPM_BUILD_ROOT/usr/bin
191 for s in \
192 helpviewer \
193 img2png \
194 img2py \
195 img2xpm \
196 pyalacarte \
197 pyalamode \
198 pycrust \
199 pywrap \
200 pyshell \
201 xrced; do
202 cp scripts/$s $RPM_BUILD_ROOT/%{pref}/bin
203 done
204
205
206 # Install wxrc
207 cp $WXDIR/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT/%{pref}/bin
208
209
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
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
258 ###GFL -r $RPM_BUILD_ROOT %{_iconsdir} >> FILELIST
259 ##$GFL -r $RPM_BUILD_ROOT %{_menudir} >> FILELIST
260
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
266
267
268 #----------------------------------------------------------------
269 ##%post
270 ##%{update_menus}
271 ##
272 ##%postun
273 ##%{clean_menus}
274
275 #----------------------------------------------------------------
276 %clean
277 [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
278
279
280 #----------------------------------------------------------------
281
282 %files -f FILELIST
283 %defattr(-,root,root)
284 %doc docs/preamble.txt docs/licence.txt docs/readme.txt docs/changes.txt
285 %doc wxPython/README.txt wxPython/CHANGES.txt
286 %doc wxPython/docs/*
287
288 %files -n wxPython%{port}-devel -f DEVELLIST
289 %defattr(-,root,root)
290
291
292 #----------------------------------------------------------------
293 # end of file