| 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 wxprefbase %{pref}/lib/wxPython |
| 12 | %define wxpref %{wxprefbase}-%{version} |
| 13 | %define name wxPython%{port}-py%{pyver} |
| 14 | |
| 15 | |
| 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 |
| 20 | |
| 21 | |
| 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 |
| 27 | |
| 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) |
| 32 | %define DBGFLG %(if [ "%{debug_flag}" = "1" ]; then echo D; fi) |
| 33 | %define UNIFLG %(if [ "%{unicode}" = "1" ]; then echo U; fi) |
| 34 | %define wxconfigname %{wxpref}/bin/wx%{lcport}%{uniflg}%{dbgflg}-%{ver2}-config |
| 35 | |
| 36 | # turn off the generation of debuginfo rpm (RH9) |
| 37 | %define debug_package %{nil} |
| 38 | |
| 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/ |
| 47 | Packager: Robin Dunn <robin@alldunn.com> |
| 48 | Group: Development/Python |
| 49 | BuildRoot: %{_tmppath}/%{name}-buildroot |
| 50 | Prefix: %{pref} |
| 51 | |
| 52 | Provides: wxPython = %{version} |
| 53 | Provides: wxPython%{port} = %{version} |
| 54 | |
| 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 | |
| 61 | # old wxPython packages |
| 62 | Obsoletes: wxPython wxPython%{port} |
| 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 | |
| 71 | This package is implemented using the %{port} port of wxWindows, and |
| 72 | includes the wx%{port} shared libs and etc. |
| 73 | |
| 74 | |
| 75 | %package -n wxPython%{port}-devel |
| 76 | Summary: wxPython%{port} development files |
| 77 | Group: Development/Libraries |
| 78 | Requires: wxPython%{port} = %{version} |
| 79 | |
| 80 | |
| 81 | %description -n wxPython%{port}-devel |
| 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 | #---------------------------------------------------------------- |
| 87 | %prep |
| 88 | %setup -q -n %{tarname}-%{version} |
| 89 | |
| 90 | |
| 91 | #---------------------------------------------------------------- |
| 92 | %build |
| 93 | |
| 94 | WXDIR=`pwd` |
| 95 | mkdir bld |
| 96 | cd bld |
| 97 | |
| 98 | # Configure, trying to reduce external dependencies |
| 99 | ../configure --with-%{lcport} \ |
| 100 | --prefix=%{wxpref} \ |
| 101 | --disable-soname \ |
| 102 | --disable-monolithic \ |
| 103 | --enable-rpath=%{wxpref}/lib \ |
| 104 | --with-opengl \ |
| 105 | %if %{unicode} |
| 106 | --enable-gtk2 \ |
| 107 | --enable-unicode \ |
| 108 | %endif |
| 109 | --enable-geometry \ |
| 110 | --enable-optimise \ |
| 111 | %if %{debug_flag} |
| 112 | --enable-debug_flag \ |
| 113 | %endif |
| 114 | %if %{builtin_libs} |
| 115 | --with-libjpeg=builtin \ |
| 116 | --with-libpng=builtin \ |
| 117 | --with-libtiff=builtin \ |
| 118 | --with-zlib=builtin \ |
| 119 | %endif |
| 120 | |
| 121 | |
| 122 | # Build wxWindows and some contrib libs |
| 123 | make |
| 124 | make -C contrib/src/gizmos |
| 125 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" |
| 126 | make -C contrib/src/stc |
| 127 | make -C contrib/src/xrc |
| 128 | |
| 129 | |
| 130 | # Link the contrib header directories in place so we can build all of |
| 131 | # wxPython without installing wxWindows |
| 132 | if [ ! -e $WXDIR/include/wx/gizmos ]; then |
| 133 | cd $WXDIR/include/wx |
| 134 | ln -s ../../contrib/include/wx/* . |
| 135 | fi |
| 136 | |
| 137 | |
| 138 | # Now build wxPython |
| 139 | cd $WXDIR/wxPython |
| 140 | %{python} setup.py \ |
| 141 | NO_SCRIPTS=1 \ |
| 142 | WXPORT=%{lcport} \ |
| 143 | UNICODE=%{unicode} \ |
| 144 | WX_CONFIG="$WXDIR/bld/wx-config --prefix=$WXDIR --exec-prefix=$WXDIR/bld" \ |
| 145 | build |
| 146 | |
| 147 | |
| 148 | # Build wxrc (XRC resource tool) |
| 149 | cd $WXDIR/bld/contrib/utils/wxrc |
| 150 | make |
| 151 | strip wxrc |
| 152 | |
| 153 | |
| 154 | #---------------------------------------------------------------- |
| 155 | %install |
| 156 | |
| 157 | WXDIR=`pwd` |
| 158 | cd bld |
| 159 | |
| 160 | # Install wxWindows and the contribs so the wxPython build can find |
| 161 | # all the headers it needs |
| 162 | make prefix=$RPM_BUILD_ROOT%{wxpref} install |
| 163 | make -C contrib/src/gizmos prefix=$RPM_BUILD_ROOT%{wxpref} install |
| 164 | make -C contrib/src/ogl CXXFLAGS="-DwxUSE_DEPRECATED=0" prefix=$RPM_BUILD_ROOT%{wxpref} install |
| 165 | make -C contrib/src/stc prefix=$RPM_BUILD_ROOT%{wxpref} install |
| 166 | make -C contrib/src/xrc prefix=$RPM_BUILD_ROOT%{wxpref} install |
| 167 | |
| 168 | |
| 169 | # install wxPython |
| 170 | cd $WXDIR/wxPython |
| 171 | %{python} setup.py \ |
| 172 | NO_SCRIPTS=1 \ |
| 173 | WXPORT=%{lcport} \ |
| 174 | UNICODE=%{unicode} \ |
| 175 | WX_CONFIG="$RPM_BUILD_ROOT%{wxpref}/bin/wx-config --prefix=$RPM_BUILD_ROOT%{wxpref}" \ |
| 176 | install \ |
| 177 | --root=$RPM_BUILD_ROOT |
| 178 | |
| 179 | |
| 180 | |
| 181 | cd $WXDIR/wxPython |
| 182 | |
| 183 | # install the wxPython headers |
| 184 | cp -R include $RPM_BUILD_ROOT%{wxpref} |
| 185 | mkdir -p $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files |
| 186 | cp src/*.i $RPM_BUILD_ROOT%{wxpref}/include/wx/wxPython/i_files |
| 187 | |
| 188 | |
| 189 | # Since I want this RPM to be as generic as possible I won't let |
| 190 | # distutils copy the scripts (NO_SCRIPTS=1 above) since it will mangle |
| 191 | # the #! line to use the real python pathname. Since some distros |
| 192 | # install python 2.2 as python2 and others as python I can't let |
| 193 | # distutils do that otherwise the dependencies will be fouled up. |
| 194 | # Copy them manually instead, leaving the #!/bin/env line intact. |
| 195 | # TODO: Should this be dependent on %{builtin_libs} or something like |
| 196 | # it? |
| 197 | |
| 198 | mkdir -p $RPM_BUILD_ROOT%{pref}/bin |
| 199 | for s in \ |
| 200 | helpviewer \ |
| 201 | img2png \ |
| 202 | img2py \ |
| 203 | img2xpm \ |
| 204 | pyalacarte \ |
| 205 | pyalamode \ |
| 206 | pycrust \ |
| 207 | pywrap \ |
| 208 | pyshell \ |
| 209 | xrced; do |
| 210 | cp scripts/$s $RPM_BUILD_ROOT%{pref}/bin |
| 211 | done |
| 212 | |
| 213 | |
| 214 | # Install wxrc |
| 215 | cp $WXDIR/bld/contrib/utils/wxrc/wxrc $RPM_BUILD_ROOT%{pref}/bin |
| 216 | |
| 217 | |
| 218 | # install KDE & GNOME menus |
| 219 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applnk/Development |
| 220 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/applications |
| 221 | for d in distrib/*.desktop; do |
| 222 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applnk/Development |
| 223 | install -m 644 $d $RPM_BUILD_ROOT%{_datadir}/applications |
| 224 | done |
| 225 | |
| 226 | # install KDE icons |
| 227 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/{16x16,32x32}/apps |
| 228 | mkdir -p $RPM_BUILD_ROOT%{_datadir}/pixmaps |
| 229 | install -m 644 wx/py/PyCrust_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/PyCrust.png |
| 230 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/PyCrust.png |
| 231 | install -m 644 wx/py/PyCrust_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/PyCrust.png |
| 232 | install -m 644 wx/tools/XRCed/XRCed_16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/XRCed.png |
| 233 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/XRCed.png |
| 234 | install -m 644 wx/tools/XRCed/XRCed_32.png $RPM_BUILD_ROOT%{_datadir}/pixmaps/XRCed.png |
| 235 | |
| 236 | # install Mandrake menu |
| 237 | mkdir -p $RPM_BUILD_ROOT/%{_libdir}/menu |
| 238 | cat > $RPM_BUILD_ROOT%{_libdir}/menu/%{name} <<EOF |
| 239 | ?package(%{name}): \\ |
| 240 | command="%{_bindir}/pyshell" \\ |
| 241 | needs="X11" \\ |
| 242 | icon="PyCrust.png" \\ |
| 243 | section="Applications/Development/Tools" \\ |
| 244 | title="PyShell" \\ |
| 245 | longtitle="GUI Python Shell" |
| 246 | ?package(%{name}): \\ |
| 247 | command="%{_bindir}/pycrust" \\ |
| 248 | needs="X11" \\ |
| 249 | icon="PyCrust.png" \\ |
| 250 | section="Applications/Development/Tools" \\ |
| 251 | title="PyCrust" \\ |
| 252 | longtitle="GUI Python Shell with Filling" |
| 253 | ?package(%{name}): \\ |
| 254 | command="%{_bindir}/pyalamode" \\ |
| 255 | needs="X11" \\ |
| 256 | icon="PyCrust.png" \\ |
| 257 | section="Applications/Development/Tools" \\ |
| 258 | title="PyAlaMode" \\ |
| 259 | longtitle="GUI Python Shell with Filling and editor windows" |
| 260 | ?package(%{name}): \\ |
| 261 | command="%{_bindir}/xrced" \\ |
| 262 | needs="X11" \\ |
| 263 | icon="XRCed.png" \\ |
| 264 | section="Applications/Development/Tools" \\ |
| 265 | title="XRCed" \\ |
| 266 | longtitle="wxPython XRC resource editor" |
| 267 | EOF |
| 268 | |
| 269 | |
| 270 | #---------------------------------------------------------------- |
| 271 | |
| 272 | %pre |
| 273 | if [ -e %{wxprefbase} ]; then |
| 274 | # in case there are old dirs from an old install |
| 275 | rm -r %{wxprefbase} |
| 276 | fi |
| 277 | |
| 278 | |
| 279 | %post |
| 280 | if [ ! -e %{wxprefbase} ]; then |
| 281 | ln -s wxPython-%{version} %{wxprefbase} |
| 282 | fi |
| 283 | # This is done on Mandrake to update its menus: |
| 284 | if [ -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi |
| 285 | |
| 286 | |
| 287 | %postun |
| 288 | rm -f %{wxprefbase} |
| 289 | # This is done on Mandrake to update its menus: |
| 290 | if [ "$1" = "0" -a -x /usr/bin/update-menus ]; then /usr/bin/update-menus || true ; fi |
| 291 | |
| 292 | |
| 293 | #---------------------------------------------------------------- |
| 294 | %clean |
| 295 | [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT |
| 296 | |
| 297 | |
| 298 | #---------------------------------------------------------------- |
| 299 | |
| 300 | %files |
| 301 | %defattr(-,root,root) |
| 302 | %doc docs/preamble.txt docs/licence.txt docs/lgpl.txt docs/readme.txt docs/changes.txt |
| 303 | %doc wxPython/docs/* |
| 304 | %{_bindir}/* |
| 305 | %{_libdir}/python%{pyver}/site-packages/* |
| 306 | %dir %{wxpref} |
| 307 | %dir %{wxpref}/lib |
| 308 | %{wxpref}/lib/libwx* |
| 309 | %{wxpref}/share |
| 310 | %{_datadir}/applnk/Development/* |
| 311 | %{_datadir}/applications/* |
| 312 | %{_datadir}/icons/hicolor/*/apps/* |
| 313 | %{_datadir}/pixmaps/* |
| 314 | %{_libdir}/menu/* |
| 315 | |
| 316 | ##%{wxprefbase} |
| 317 | |
| 318 | |
| 319 | %files -n wxPython%{port}-devel |
| 320 | %defattr(-,root,root) |
| 321 | %{wxpref}/include |
| 322 | %{wxpref}/lib/wx |
| 323 | %{wxconfigname} |
| 324 | %{wxpref}/bin/wx-config |
| 325 | |
| 326 | #---------------------------------------------------------------- |
| 327 | # end of file |