File python3-pyside-shiboken.spec of Package python-pyside-shiboken
#
# spec file for package python3-pyside-shiboken
#
# Copyright (c) 2015 SUSE LINUX 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/
#
%define tarname shiboken
Name: python3-pyside-%{tarname}
%define pyname Shiboken
Version: 1.2.2
Release: 0
%define majorver %(echo "%{version}" | sed 's/\\.[0-9]*$//')
%define libsoname %(echo "%{majorver}" | sed 's/\\./_/')
%define libprefix lib%{tarname}
%define pyver_mod2 %(python3 -c "import sys; sys.stdout.write(sys.version[:3].replace('.','')+sys.abiflags)")
%define libpyname %{libprefix}-%{majorver}.cpython-%{pyver_mod2}
%define libname %{libprefix}-%{libsoname}_cpython-%{pyver_mod2}%{libsoname}
Summary: Generate CPython 3 bindings from C++ code
License: GPL-2.0
Group: Development/Libraries/C and C++
Url: http://qt-project.org/wiki/PySide
Source0: http://download.qt-project.org/official_releases/pyside/%{tarname}-%{version}.tar.bz2
# PATCH-FIX shiboken-fix-include-with-suffix rpm@fthiessen.de -- fixes .pc so include directory with suffix will be found.
# Reported upstream: https://bugreports.qt.io/browse/PYSIDE-279
Patch0: shiboken-fix-include-with-suffix.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: libqt4-devel
BuildRequires: libxml2-devel
BuildRequires: libxslt-devel
BuildRequires: python3-Sphinx
BuildRequires: python3-devel
Requires: %{libname} = %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
%description
Shiboken generates C++ code for CPython extensions. It is similar to
BoostPythonGenerator from boost::python, but is designed to create smaller
code.
%package -n %{libname}
Summary: Generate CPython 3 bindings from C++ code
License: LGPL-2.1
Group: Development/Libraries/C and C++
%description -n %{libname}
Shiboken generates C++ code for CPython extensions. It is similar to
BoostPythonGenerator from boost::python, but is designed to create smaller
code.
%package doc
Summary: Documentation for %{name}
License: GPL-2.0
Group: Documentation/HTML
BuildArch: noarch
%description doc
Documentation and manuals for %{name}
%package -n %{libprefix}-python3-devel
Summary: Development files for %{name}
License: LGPL-2.1
Group: Development/Libraries/C and C++
Requires: %{libname} = %{version}
Requires: cmake
Requires: libqt4-devel
Requires: libxml2-devel
Requires: libxslt-devel
Requires: python3-Sphinx
Requires: python3-devel >= %{py3_ver}
# As cmake config files are not python version agnostic, python2 and 3 versions of developement
# package can't be installed at the same time
Conflicts: lib%{tarname}-devel
%description -n %{libprefix}-python3-devel
Development libraries and headers needed to build software using %{name}
%prep
%setup -q -n %{tarname}-%{version}
%patch0 -p1
%build
%cmake -DCMAKE_BUILD_TYPE=Debug \
-DBUILD_TESTS=False \
-DENABLE_VERSION_SUFFIX=True \
-DUSE_PYTHON3=True
make %{?_smp_mflags}
make doc
%install
cd build
%makeinstall DESTDIR=%{buildroot}
mv %{buildroot}%{_bindir}/%{tarname}-%{majorver} %{buildroot}%{_bindir}/%{tarname}-%{py3_ver}
mv %{buildroot}%{_mandir}/man1/%{tarname}.1 %{buildroot}%{_mandir}/man1/%{tarname}-%{py3_ver}.1
%fdupes %{buildroot}
# openSUSE 13.1 and lower have a bad bug with brp-symlink
%if 0%{?suse_version} >= 1315
ln -s %{_sysconfdir}/alternatives/%{tarname} %{buildroot}%{_bindir}/%{tarname}
ln -s %{_sysconfdir}/alternatives/%{tarname}.1 %{buildroot}%{_mandir}/man1/%{tarname}.1
ln -s %{_sysconfdir}/alternatives/%{tarname}.1.gz %{buildroot}%{_mandir}/man1/%{tarname}.1.gz
ln -s %{_sysconfdir}/alternatives/%{tarname} %{buildroot}%{_bindir}/%{tarname}-%{majorver}
%endif
%pre
[ -h %{_bindir}/%{tarname} ] || rm -f %{_bindir}/%{tarname}
[ -h %{_mandir}/man1/%{tarname}.1.gz ] || rm -f %{_mandir}/man1/%{tarname}.1.gz
%post
/sbin/ldconfig
update-alternatives --install %{_bindir}/%{tarname} %{tarname} %{_bindir}/%{tarname}-%{py3_ver} 20 \
--slave %{_mandir}/man1/%{tarname}.1.gz %{tarname}.1 %{_mandir}/man1/%{tarname}-%{py3_ver}.1.gz \
--slave %{_bindir}/%{tarname}-%{majorver} %{tarname}-%{majorver} %{_bindir}/%{tarname}-%{py3_ver}
%preun
if [ $1 -eq 0 ] ; then
update-alternatives --remove %{tarname} %{_bindir}/%{tarname}-%{py3_ver}
fi
%postun -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig
%post -n %{libname} -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc COPYING ChangeLog
%ghost %{_sysconfdir}/alternatives/%{tarname}
%ghost %{_sysconfdir}/alternatives/%{tarname}-%{majorver}
%ghost %{_sysconfdir}/alternatives/%{tarname}.1
%ghost %{_sysconfdir}/alternatives/%{tarname}.1.gz
%{_bindir}/%{tarname}*
%{_mandir}/man1/%{tarname}*.1.gz
%{python3_sitearch}/%{tarname}.so
%files -n %{libname}
%defattr(-,root,root)
%doc COPYING.%{libprefix}
%{_libdir}/%{libpyname}.so.*
%files doc
%defattr(-,root,root)
%doc COPYING
%doc build/doc/html/*
%files -n %{libprefix}-python3-devel
%defattr(-,root,root)
%{_includedir}/%{tarname}-%{majorver}/
%{_libdir}/%{libpyname}.so
%{_libdir}/cmake/%{pyname}-%{version}/
%{_libdir}/pkgconfig/%{tarname}-%{majorver}.pc
%changelog