File wxGTK.spec of Package wxGTK

#
# spec file for package wxGTK (Version 2.8.10.1)
#
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define  srcname  wxPython-src

Name:           wxGTK
BuildRequires:  SDL-devel cppunit-devel esound-devel gcc-c++ gnome-vfs2-devel gtk2-devel libexpat-devel
BuildRequires:  libgnomeprintui-devel libmspack-devel libtiff-devel python-devel python-xml
License:        GPL v2 or later
Group:          System/Libraries
AutoReqProv:    on
Version:        2.8.10.1
Release:        4
%define  wx_version %(echo %{version} | sed 's/\.[0-9][0-9]*\.[0-9][0-9]*$//')
Summary:        C++ Framework for Cross-Platform Development
%if 0
# Source from http://www.wxpython.org/
Source0:        http://downloads.sourceforge.net/wxpython/%{srcname}-%{version}.tar.bz2
%else
# WARNING: This is not a comment, but the real command to repack souce:
#%(sh %{_sourcedir}/%{name}-clear-source %{srcname}-%{version}.tar.bz2)
Source0:        %{srcname}-%{version}-clean.tar.bz2
%endif
Source1:        wxGTK-clear-source
Source2:        README.unicode
Url:            http://www.wxwidgets.org/
Provides:       wxgtk
Obsoletes:      wxgtk
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Patch0:         wxGTK-2.6.3.3-decl.patch
Patch1:         wxGTK-enable-wxrc.patch
Patch3:         wxGTK-datarootdir.patch
Patch5:         wxGTK-missing_return.patch
Patch6:         wxGTK-GSocket-clash.patch
Patch7:         wxGTK-python-abi.patch
Patch8:         wxGTK-python-no-strict-aliasing.patch
Patch9:         wxGTK-python-no-GraphicsRenderer-CreateBitmap.patch
Patch10:        wxGTK-2.8.10.1-python-platlib.patch
# compile with debug stuff (adds lots of asserts, which can help finding
# problems in applications)
%define usedebug    0

%description
wxWidgets is a free C++ framework to make cross-platform programming
easy. It supports Windows 3.1/95/98/NT, and Unix with
GTK/Motif/Lesstif. This is the version for GTK+. This package only
contains the runtime libraries and other data needed by the runtime
libraries.

Additional documentation is available in the package wxGTK-doc and you
can find some examples in the package wxGTK-examples.



Authors:
--------
    Robert Roebling <robert@roebling.de>

%package devel
License:        GPL v2 or later
Summary:        Everything needed for development with wxGTK
Group:          Development/Libraries/GNOME
Provides:       wxgtk:/usr/bin/wx-config
Requires:       wxGTK = %{version}
Requires:       wxGTK-gl = %{version}
Requires:       gtk2-devel

%description devel
This package contains all files needed for developing with wxGTK
(headers, *.so symbolic links, etc.)



Authors:
--------
    Robert Roebling <robert@roebling.de>

%package gl
License:        GPL v2 or later
Summary:        OpenGl add-on for wxGTK
Group:          Development/Libraries/GNOME
Requires:       wxGTK

%description gl
This package contains the OpenGl add-on library for wxGTK, the GTK+
port of wxWidgets.



Authors:
--------
    Robert Roebling <robert@roebling.de>

%package compat
License:        GPL v2 or later
Summary:        Non-Unicode wxWidgets Compatibility Package
Group:          System/Libraries
Requires:       wxGTK

%description compat
wxWidgets is a free C++ framework to make cross-platform programming
easy. It supports Windows 3.1/95/98/NT, and UNIX with
GTK/Motif/Lesstif. This is the version for GTK+. This package only
contains the runtime libraries and other data needed by the runtime
libraries.

This package contains a library compiled without Unicode support, which
is needed for some improperly written applications.



Authors:
--------
    Robert Roebling <robert@roebling.de>

%package -n python-wxGTK
License:        GPL v2 or later
Group:          Development/Libraries/Python
Requires:       wxGTK
Provides:       wxPython
Url:            http://www.wxpython.org/
Summary:        Cross Platform GUI Toolkit for Python Using wxGTK
%{py_requires}

%description -n python-wxGTK
wxPython is a GUI toolkit for Python that is a wrapper around the
wxWidgets C++ GUI library.  wxPython provides a large variety of window
types and controls, all implemented with a native look and feel (and
native runtime speed) on the platforms it is supported on.

Additional documentation is available in package python-wxGTK-doc and
demos and examples are in package python-wxGTK-examples.



Authors:
--------
    Robin Dunn <robin@alldunn.com>

%prep
%setup -q -n %{srcname}-%{version}
%patch0
%patch1
%patch3
%patch5
%patch6 -p4
%patch7
%patch8
%patch9
%patch10
cp %{S:2} .
mkdir wxWidgets-unicode
mkdir wxWidgets-ansi
chmod -x wxPython/wx/tools/Editra/src/extern/README wxPython/src/aui.i
touch wxPython/src/gtk/_gdi_wrap.cpp

%build
%{suse_update_config -f}
autoconf
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$RPM_OPT_FLAGS"
common_configure_opts="--prefix=%{_prefix} \
    --datadir=%{_datadir} \
    --libdir=%{_libdir} \
    --with-opengl \
    --with-libmspack \
    --with-sdl \
    --enable-sound \
    --with-gnomeprint \
    --with-gnomevfs \
    --enable-iff \
    --enable-geometry \
    --enable-optimise \
    --with-gtk=2 \
%if %{usedebug}
    --enable-debug \
%endif
    --enable-controls \
    --enable-calendar \
    --enable-tabdialog \
    --enable-std_iostreams\
    --enable-plugins \
    --disable-precomp-headers"
# Recommended by developers but breaks some packages (bnc#530027) and ABI compatibility:
#--enable-stl
# build ANSI version
pushd wxWidgets-ansi
../configure --disable-unicode ${common_configure_opts}
# can support maemo hildon
make %{?jobs:-j%jobs}
make %{?jobs:-j%jobs} -C contrib
popd
# build Unicode version
pushd wxWidgets-unicode
../configure --enable-unicode ${common_configure_opts}
# doesn't work with unicode, code was not ported:    --with-odbc \
# See https://bugzilla.novell.com/show_bug.cgi?id=397044 for more
#../src/common/db.cpp: In member function 'bool wxDb::Open(const wxString&, void*, bool)':
#../src/common/db.cpp:873: error: ambiguous overload for 'operator=' in '((wxDb*)this)->wxDb::outConnectionStr = outConnectBuffer'
# can support maemo hildon
make %{?jobs:-j%jobs}
make %{?jobs:-j%jobs} -C contrib
popd

%install
# install ANSI version
pushd wxWidgets-ansi
%makeinstall
%makeinstall -C contrib
popd
# install Unicode version (after ANSI!)
pushd wxWidgets-unicode
%makeinstall
%makeinstall -C contrib
popd
# wxPython
export CFLAGS="$RPM_OPT_FLAGS -I$RPM_BUILD_ROOT%{_libdir}/wx/include/gtk2-unicode-release-2.8"
export CXXFLAGS="$CFLAGS"
export LDFLAGS=-L$RPM_BUILD_ROOT%{_libdir}
pushd wxPython
python setup.py \
    WX_CONFIG="$RPM_BUILD_ROOT%{_libdir}/wx/config/gtk2-unicode-release-2.8 --prefix=$RPM_BUILD_ROOT%{_prefix}" \
    EP_ADD_OPTS=1 \
    NO_SCRIPTS=1 \
    WXPORT=gtk2 \
    UNICODE=1 \
    build \
    install \
    --prefix=%{_prefix} \
    --root=$RPM_BUILD_ROOT \
    --record-rpm=INSTALLED_FILES
build_options=%{py_sitedir}/wx-2.8-gtk2-unicode/wx/build/build_options.py
sed -i 's/^WX_CONFIG=.*/WX_CONFIG="wx-config --unicode"/' $RPM_BUILD_ROOT$build_options
python -c "import py_compile; py_compile.compile('$RPM_BUILD_ROOT$build_options', None, '$build_options', True);"
popd
# generate filelists
(cd $RPM_BUILD_ROOT; ls .%{_libdir}/libwx_*.so.*) | grep -v _gl- | sed 's/^\.//' > FILELIST
%if %{usedebug}
%define mask ud
%else
%define mask u
%endif
grep '%{mask}[-_]' FILELIST > FILELIST.unicode
grep -v '%{mask}[-_]' FILELIST > FILELIST.ansi
(cd $RPM_BUILD_ROOT; ls .%{_libdir}/libwx_*.so.*) | grep _gl- | sed 's/^\.//' > FILELIST.gl
(cd $RPM_BUILD_ROOT; find .%{_includedir}/wx-%{wx_version}/wx -type f -maxdepth 1) | grep -v /wxPython | sed 's/^\.//' > FILELIST.devel
(cd $RPM_BUILD_ROOT; find .%{_includedir}/wx-%{wx_version}/wx -type d -mindepth 1 -maxdepth 1) | grep -v /wxPython | sed 's/^\.//' >> FILELIST.devel
(cd $RPM_BUILD_ROOT; find .%{_bindir} -type f -mindepth 1 -maxdepth 1) | grep -v -e '\(-config\|wxrc\)' | sed 's/^\.//' > FILELIST.python
%find_lang wxstd
%find_lang wxmsw
cat wxstd.lang wxmsw.lang >> FILELIST.unicode
# Create %%lang tags for mo files in non-standard path:
for LNG_DIR in $RPM_BUILD_ROOT%{py_sitedir}/wx*/wx/tools/Editra/locale/* ; do
    LNG=${LNG_DIR##*/}
    echo "%%lang($LNG) %%{py_sitedir}${LNG_DIR#$RPM_BUILD_ROOT%{py_sitedir}}" >>FILELIST.python
done

%post -p /sbin/ldconfig

%post gl -p /sbin/ldconfig

%post compat -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%postun gl -p /sbin/ldconfig

%postun compat -p /sbin/ldconfig

%clean
#rm -rf $RPM_BUILD_ROOT

%files -f FILELIST.unicode
%defattr (644, root, root, 755)
%doc docs/*.txt
%doc docs/base docs/gtk docs/publicity
%doc README.1st.txt README.unicode
%dir %{_libdir}/wx
%dir %{_libdir}/wx/2.8
%{_libdir}/wx/2.8/*.so

%files compat -f FILELIST.ansi
%defattr(755, root, root)

%files devel -f FILELIST.devel
%defattr (755, root, root, 755)
%{_bindir}/wxrc
%{_bindir}/wxrc-%{wx_version}
%{_bindir}/*-config*
%{_libdir}/wx/config
%defattr (644, root, root, 755)
%doc docs/tech
%dir %{_includedir}/wx-%{wx_version}
%dir %{_includedir}/wx-%{wx_version}/wx
%{_includedir}/wx-%{wx_version}/wx/wxPython/*.h
%{_libdir}/wx/include
%{_libdir}/lib*.so
%{_datadir}/aclocal/wxwin.m4
%{_datadir}/bakefile

%files gl -f FILELIST.gl
%defattr(755, root, root)

%files -n python-wxGTK -f FILELIST.python
%defattr(-, root, root)
%doc wxPython/docs/*.txt wxPython/docs/*.html wxPython/docs/screenshots wxPython/licence
%dir %{_includedir}/wx-%{wx_version}/wx
%{_includedir}/wx-%{wx_version}/wx/wxPython
%exclude %{_includedir}/wx-%{wx_version}/wx/wxPython/*.h
%if %suse_version > 1110
%{python_sitearch}/*
%{python_sitelib}/*
%exclude %{python_sitearch}/wx*/wx/tools/Editra/locale/*
%else
%{py_sitedir}/*
%exclude %{py_sitedir}/wx*/wx/tools/Editra/locale/*
%endif

%changelog
openSUSE Build Service is sponsored by