python3-pyside2/python3-pyside2.spec

184 lines
6.1 KiB
RPMSpec

#
# spec file for package python3-pyside2
#
# Copyright (c) 2018 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/
#
%bcond_with tests
%define mypython python3
BuildRequires: python3-devel
BuildRequires: python3-setuptools
Name: python3-pyside2
Version: 2.0~pre.1526654735.3f8c8702
Release: 0
Summary: PySide - python bindings for Qt
License: LGPL-2.1-or-later
Group: Development/Languages/Python
Url: http://wiki.qt.io/Qt_for_Python
Source0: pyside-setup-%{version}.tar.xz
Patch1: fix-cmake.patch
Patch2: lib64.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: gcc-c++
BuildRequires: git
BuildRequires: libqt5-qtdeclarative-private-headers-devel
##### essential modules
BuildRequires: pkgconfig(Qt5Concurrent)
BuildRequires: pkgconfig(Qt5Concurrent)
BuildRequires: pkgconfig(Qt5Core) < 5.12
BuildRequires: pkgconfig(Qt5Core) >= 5.11
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5PrintSupport)
BuildRequires: pkgconfig(Qt5Sql)
BuildRequires: pkgconfig(Qt5Test)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5X11Extras)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(Qt5XmlPatterns)
##### optional modules
BuildRequires: libQt53DQuickScene2D5
BuildRequires: pkgconfig(Qt53DAnimation)
BuildRequires: pkgconfig(Qt53DCore)
BuildRequires: pkgconfig(Qt53DExtras)
BuildRequires: pkgconfig(Qt53DInput)
BuildRequires: pkgconfig(Qt53DLogic)
BuildRequires: pkgconfig(Qt53DRender)
BuildRequires: pkgconfig(Qt5Charts)
BuildRequires: pkgconfig(Qt5DataVisualization)
BuildRequires: pkgconfig(Qt5Designer)
BuildRequires: pkgconfig(Qt5Multimedia)
BuildRequires: pkgconfig(Qt5MultimediaWidgets)
BuildRequires: pkgconfig(Qt5OpenGL)
BuildRequires: pkgconfig(Qt5QuickWidgets)
BuildRequires: pkgconfig(Qt5Script)
BuildRequires: pkgconfig(Qt5ScriptTools)
BuildRequires: pkgconfig(Qt5Svg)
BuildRequires: pkgconfig(Qt5TextToSpeech)
BuildRequires: pkgconfig(Qt5TextToSpeech)
BuildRequires: pkgconfig(Qt5WebChannel)
BuildRequires: pkgconfig(Qt5WebEngineWidgets)
BuildRequires: pkgconfig(Qt5WebKit)
BuildRequires: pkgconfig(Qt5WebSockets)
BuildRequires: pkgconfig(Qt5WebSockets)
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(Qt5Xml)
BuildRequires: pkgconfig(Qt5XmlPatterns)
#BuildRequires: pkgconfig(Qt5Vector3D)
#breaks with llvm 5?
#BuildRequires: pkgconfig(Qt5WebKitWidgets)
BuildRequires: libxslt-devel
BuildRequires: clang-devel >= 3.9
#BuildRequires: llvm-devel >= 3.9
BuildRequires: python-devel >= 2.6
BuildRequires: python-setuptools
%description
The PySide2 project provides Python bindings for the Qt
application and UI framework.
%package devel
Summary: Header Files for PySide2
Group: Development/Languages/Python
Requires: %name = %{version}
%description devel
Files needed for development with the PySide2 bindings
for Qt.
%prep
%setup -q -n pyside-setup-%{version}
%patch1 -p1
%if "%{_libdir}" == "/usr/lib64"
%patch2 -p1
%endif
%build
export LLVM_INSTALL_DIR=/usr
export CFLAGS=-I/usr/include/linux
%mypython setup.py build --reuse-build --ignore-git \
%if %{with tests}
--build-tests
%endif
%install
%mypython setup.py install --reuse-build --ignore-git --prefix=%{_prefix} --root=%{buildroot} \
%if %{with tests}
--build-tests
%endif
# and hack re-installation, since setup is doing it wrong
rm -rf %{buildroot}/*
mkdir -p %{buildroot}/%{_libdir}
cp -a ./pyside?_install/py*-release/* %{buildroot}%{_prefix}/
sed -i 's,=.*/pyside._install/[^\/]*,=/usr,' %{buildroot}%{_prefix}/lib/pkgconfig/*.pc
sed -i 's,^libdir=.*,libdir=%{_libdir},' %{buildroot}%{_prefix}/lib/pkgconfig/*.pc
sed -i 's,"[^"]*/include/shiboken2","/usr/include/shiboken2",' %{buildroot}%{_prefix}/lib/cmake/Shiboken*/*.cmake
sed -i 's,"[^"]*/lib/libshiboken2.\(.*\)","%{_libdir}/libshiboken2.\1",' %{buildroot}%{_prefix}/lib/cmake/Shiboken*/*.cmake
sed -i 's,"[^"]*/bin/shiboken2","%{_prefix}/bin/shiboken2",' %{buildroot}%{_prefix}/lib/cmake/Shiboken*/*.cmake
sed -i 's,^include("[^"]*-release/lib/,include("%{_libdir}/,' %{buildroot}%{_prefix}/lib/cmake/Shiboken*/*.cmake
sed -i 's,"[^"]*/include/PySide2","/usr/include/PySide2",' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
sed -i 's,"[^"]*/lib/cmake/\(.*\)","%{_libdir}/cmake/\1",' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
sed -i 's,"[^"]*/lib/libpyside2\.\(.*\)","%{_libdir}/libpyside2.\1",' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
sed -i 's,"[^"]*/\(python.*/site-packages\)","%{_libdir}/\1",' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
sed -i 's,"[^"]*/share/PySide2/typesystems","%{_prefix}/share/PySide2/typesystems",' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
sed -i 's,^include("[^"]*-release/lib/,include("%{_libdir}/,' %{buildroot}%{_prefix}/lib/cmake/PySide2*/*.cmake
%if "%{_libdir}" == "/usr/lib64"
mv %{buildroot}%{_prefix}/lib/lib* %{buildroot}/%{_libdir}/
mv %{buildroot}%{_prefix}/lib/pkgconfig %{buildroot}/%{_libdir}/
mv %{buildroot}%{_prefix}/lib/cmake %{buildroot}/%{_libdir}/
rmdir %{buildroot}%{_prefix}/lib
%endif
%check
%if %{with tests}
%mypython testrunner.py test
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%license LICENSE.*
%{_prefix}/bin/*
%{_libdir}/*.so.*
%if "@BUILD_FLAVOR@" == "python3-pyside2"
%{python3_sitearch}/*
%else
%{py_sitedir}/*
%endif
%files devel
%defattr(-,root,root)
%{_mandir}/man*/*
%{_prefix}/include/*
%{_libdir}/*.so
%{_libdir}/cmake
%{_libdir}/pkgconfig
%{_datadir}/PySide2
%changelog