File python3-pyside-shiboken.spec of Package python-pyside-shiboken

#
# spec file for package python3-pyside-shiboken
#
# Copyright (c) 2017 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/
#


Name:           python3-pyside-shiboken
Version:        1.2.4
Release:        0
%define majorver   %(echo "%{version}" | sed 's/\\.[0-9]*$//')
%define libsoname  %(echo "%{majorver}" | sed 's/\\./_/')
%define libname   libshiboken-%{libsoname}_%{py3_soflags}%{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:        https://github.com/PySide/Shiboken/archive/%{version}/shiboken-%{version}.tar.gz
# 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
# PATCH-FIX-UPSTREAM shiboken-enable-python35 toddrme2178@gmail.com -- enables building with python 3.5
# Reported upstream: https://github.com/PySide/Shiboken/issues/77
Patch1:         shiboken-enable-python35.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 libshiboken-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:      libshiboken-devel

%description -n libshiboken-python3-devel
Development libraries and headers needed to build software using %{name}

%prep
%setup -q -n Shiboken-%{version}
%patch0 -p1
%patch1 -p1

%build
%cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
       -DBUILD_TESTS=False \
       -DENABLE_VERSION_SUFFIX=True \
       -DUSE_PYTHON3=True
make %{?_smp_mflags}
make doc

%install
cd build
%makeinstall DESTDIR=%{buildroot}
mv %{buildroot}%{_bindir}/shiboken-%{majorver} %{buildroot}%{_bindir}/shiboken-%{py3_ver}
mv %{buildroot}%{_mandir}/man1/shiboken.1 %{buildroot}%{_mandir}/man1/shiboken-%{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/shiboken      %{buildroot}%{_bindir}/shiboken
  ln -s %{_sysconfdir}/alternatives/shiboken.1    %{buildroot}%{_mandir}/man1/shiboken.1
  ln -s %{_sysconfdir}/alternatives/shiboken.1.gz %{buildroot}%{_mandir}/man1/shiboken.1.gz
  ln -s %{_sysconfdir}/alternatives/shiboken      %{buildroot}%{_bindir}/shiboken-%{majorver}
%endif

%pre
[ -h %{_bindir}/shiboken ] || rm -f %{_bindir}/shiboken
[ -h %{_mandir}/man1/shiboken.1.gz ] || rm -f %{_mandir}/man1/shiboken.1.gz

%post
/sbin/ldconfig
update-alternatives --install %{_bindir}/shiboken shiboken %{_bindir}/shiboken-%{py3_ver} 20 \
                    --slave %{_mandir}/man1/shiboken.1.gz shiboken.1 %{_mandir}/man1/shiboken-%{py3_ver}.1.gz \
                    --slave %{_bindir}/shiboken-%{majorver} shiboken-%{majorver} %{_bindir}/shiboken-%{py3_ver}

%preun
if [ $1 -eq 0 ] ; then
    update-alternatives --remove shiboken %{_bindir}/shiboken-%{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 AUTHORS
%ghost %{_sysconfdir}/alternatives/shiboken
%ghost %{_sysconfdir}/alternatives/shiboken-%{majorver}
%ghost %{_sysconfdir}/alternatives/shiboken.1
%ghost %{_sysconfdir}/alternatives/shiboken.1.gz
%{_bindir}/shiboken*
%{_mandir}/man1/shiboken*.1.gz
%{python3_sitearch}/shiboken.so

%files -n %{libname}
%defattr(-,root,root)
%doc COPYING.libshiboken AUTHORS
%{_libdir}/libshiboken-%{majorver}.%{py3_soflags}.so.*

%files doc
%defattr(-,root,root)
%doc COPYING
%doc build/doc/html/*

%files -n libshiboken-python3-devel
%defattr(-,root,root)
%{_includedir}/shiboken-%{majorver}/
%{_libdir}/libshiboken-%{majorver}.%{py3_soflags}.so
%{_libdir}/cmake/Shiboken-%{version}/
%{_libdir}/pkgconfig/shiboken-%{majorver}.pc

%changelog
openSUSE Build Service is sponsored by