%global python_sitelib  %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
%global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")

%define name 	PyQt
%define version 3.18.1
%define release 5%{?_dist_release}

Summary:	Python bindings for Qt.
Summary(ja):    Qt の Python バインディング
Name:		%{name}
Version:	%{version}
Release:	%{release}
License:	GPLv2
Group:		System Environment/Libraries
URL:		http://www.riverbankcomputing.co.uk/pyqt

Source:		http://www.riverbankcomputing.com/Downloads/PyQt3/GPL/%{name}-x11-gpl-%{version}.tar.gz
# FTBFS against sip-4.15+
Patch1: PyQt-x11-gpl-3.18.1-sip415.patch

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:  libXmu-devel
BuildRequires:	python-devel
BuildRequires:  qt-devel
BuildRequires:  sip-devel
Requires:	python

%description
Python bindings for the Qt C++ class library.

%package devel
Summary: 	Files needed to build other bindings based on Qt
Group: 		Development/Libraries
Requires:	%{name} = %{version}
Requires:	sip-devel qt-devel

%description devel
Files needed to build other bindings for C++ classes that inherit from any
of the Qt classes (e.g. KDE or your own).

%prep
%setup -q -n %{name}-x11-gpl-%{version}
%patch1 -p0 -b .sip415

%build
unset QTDIR || : ; . /etc/profile.d/qt.sh

echo yes | python configure.py -d %{python_sitearch} CXXFLAGS="%{optflags} -DANY=void" CFLAGS="%{optflags} -DANY=void"

# Makefiles are broken, workaround
make -C qt %{?_smp_mflags}
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/sip/qt
cp -r sip/* $RPM_BUILD_ROOT%{_datadir}/sip/qt/

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root, 755)
%doc NEWS README ChangeLog THANKS
%doc doc/PyQt.html
%{_bindir}/*
%{python_sitearch}/*

%files devel
%defattr(-,root,root)
%doc examples*
%{_datadir}/sip/*

%changelog
* Thu Jun 30 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.18.1-5
- rebuild with gcc-5.4.0

* Sat Nov  8 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 3.18.1-4
- rebuilt on current VineSeed
- added patch1
- moved to System Environment/Libraries Group

* Sat Feb 18 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 3.18.1-3
- rebuilt with python-2.7.2

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 3.18.1-2
- rebuilt with python-2.6.4

* Thu Nov 12 2009 Ryoichi INAGAKI <owa@bg.wakwak.com> 3.18.1-1
- new upstream release
- removed qscintilla dependency

* Mon Jul 21 2008 Shu KONNO <owa@bg.wakwak.com> 3.17.3-1vl5
- rebuilt with python-2.5.2
- added pyexeclib macro
- applied new versioning policy

* Fri Nov 30 2007 Shu KONNO <owa@bg.wakwak.com> 3.17.3-0vl2
- changed source url
- fixed python site-packages path (for lib64)

* Thu Sep 13 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.17.3-0vl1
- updated to 3.16
- rebuilt with new toolchain

* Sun Jun 11 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 3.16-0vl1
- updated to 3.16
- changed Group to Development/Languages
- rebuild with python-2.4.3, sip-4.4.5, qscinteilla-1.6

* Sun Apr 03 2005 Shu KONNO <owa@bg.wakwak.com> 3.13-0vl2
- rebuild with python-2.4.1

* Sat Jan 15 2005 Satoshi MACHINO <machino@vinelinux.org> 3.13-0vl1
- initial release for VineLinux