File python-horizon.spec of Package horizon

#
# spec file for package horizon
#
# Copyright (c) 2020 Frank Kunz
#
# 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.

%define appname horizon
Name:           python-%{appname}
Version:        2.7.1
Release:        0
Summary:        Python module for %{appname}
Group:          Development/Libraries/Python
License:        GPL-3.0-only
Url:            https://horizon-eda.org
Source0:        https://github.com/horizon-eda/horizon/archive/v%{version}.tar.gz#/%{appname}-%{version}.tar.gz
Patch0:         0001-replace-osmesa-with-EGL_PLATFORM_SURFACELESS_MESA.patch
Patch1:         0002-enable-python-module-build.patch
BuildRequires:  binutils-gold
BuildRequires:  cppzmq-devel
%if 0%{?suse_version} >= 1600
BuildRequires:  gcc-c++
BuildRequires:  libpodofo-0_10-devel
BuildRequires:  %{python_module cairo-common-devel}
%else
BuildRequires:  gcc11-c++
BuildRequires:  libpodofo-devel
BuildRequires:  %{python_module cairo-devel}
%endif
BuildRequires:  git
BuildRequires:  glm-devel
BuildRequires:  gtkmm3-devel
BuildRequires:  libcurl-devel
BuildRequires:  libepoxy-devel
BuildRequires:  libgit2-devel
BuildRequires:  librsvg-devel
BuildRequires:  libzmq5
BuildRequires:  occt-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(cairo)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(libarchive)
BuildRequires:  boost-devel
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module PyYAML}
BuildRequires:  %{python_module pycairo}
BuildRequires:  sqlite3-devel
BuildRequires:  meson
%python_subpackages

%description
Python support module for %{appname}.

%prep
%setup -q -n %{appname}-%{version}
%patch 0 -p1
%patch 1 -p1

%build
%if 0%{?suse_version} < 1600
export CC=gcc-11
export CXX=g++-11
# patching legacy libpodofo mess
cp -r /usr/lib64/pkgconfig /tmp
export PKG_CONFIG_PATH=/tmp/pkgconfig
sed -i 's/-lpodofo-0/-lpodofo/g' /tmp/pkgconfig/libpodofo-0.pc
sed -i "s/podofo = dependency('libpodofo')/podofo = dependency('libpodofo-0')/g" meson.build
%endif
%{python_expand %meson
%meson_build horizon
}

%install
%python_expand install -D -t %{buildroot}/%{$python_sitelib} %{_target_cpu}-suse-linux/horizon.so

%check

%files %{python_files}
%license LICENSE
%{python_sitelib}/horizon.so

%changelog
openSUSE Build Service is sponsored by