File libunity.spec of Package libunity

#
# spec file for package libunity
#
# Copyright (c) 2021 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define sover   9
%define typelib typelib-1_0-Unity-7_0
%define typelib_extras typelib-1_0-UnityExtras-7_0
%define _version 7.1.4+19.04.20190319
Name:           libunity
Version:        7.1.4+bzr20190319
Release:        0
Summary:        Library for the Unity shell
License:        LGPL-3.0-only
Group:          Development/Libraries/C and C++
URL:            https://launchpad.net/libunity
Source:         https://launchpad.net/ubuntu/+archive/primary/+files/%{name}_%{_version}.orig.tar.gz
Source1:        baselibs.conf
# PATCH-FIX-OPENSUSE libunity-protocol-private-install.patch i@marguerite.su -- Unity can't find /usr/lib(64)/libunity/.
Patch0:         libunity-protocol-private-install.patch
# PATCH-FIX-UPSTREAM 0001-Fix-FTB-with-recent-vala-requiring-non-public-abstra.patch vala 0.46.1+ doesn't allow creation method of abstract class to be public
Patch1:         0001-Fix-FTB-with-recent-vala-requiring-non-public-abstra.patch
# PATCH-FIX-OPENSUSE libunity-fix-optional-types.patch corentingirard.dev@gmail.com -- Fix optional types.
Patch2:         libunity-fix-optional-types.patch
BuildRequires:  fdupes
BuildRequires:  gnome-common
BuildRequires:  pkgconfig
BuildRequires:  python3
BuildRequires:  vala >= 0.22
BuildRequires:  pkgconfig(dbusmenu-glib-0.4) >= 0.3.93
BuildRequires:  pkgconfig(dee-1.0) >= 1.2.5
BuildRequires:  pkgconfig(gio-2.0) >= 2.32
BuildRequires:  pkgconfig(glib-2.0) >= 2.32
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.4.1
BuildRequires:  pkgconfig(lttng-ust)
%glib2_gsettings_schema_requires

%description
LibUnity is library for instrumenting and integrating with
all aspects of the Unity shell. This is not a library used
in the implementation of the Unity shell itself, but a
library to be consumed by clients that wants to do deep
integration with the Unity shell.

%package tools
Summary:        Unity tools
Group:          System/GUI/Other
Requires:       python3-%{name} = %{version}

%description tools
Tools for Unity instrumenting and integration library.

%package -n %{name}%{sover}
Summary:        Unity shared libraries
Group:          System/Libraries
Provides:       %{name} = %{version}

%description -n %{name}%{sover}
Shared libraries for Unity instrumenting and integration library.

%package -n %{typelib}
Summary:        Introspection bindings for the Unity shell library
Group:          System/Libraries

%description -n %{typelib}
This package provides the GObject Introspection bindings for libunity.

%package -n %{typelib_extras}
Summary:        Introspection bindings for the Unity shell library
Group:          System/Libraries

%description -n %{typelib_extras}
This package provides the GObject Introspection bindings for libunity.

%package -n python3-%{name}
Summary:        Python bindings for libunity
Group:          Development/Languages/Python

%description -n python3-%{name}
Python bindings for Unity instrumenting and integration library.

%package devel
Summary:        Development Headers for libunity
Group:          Development/Libraries/C and C++
Requires:       %{name}%{sover} = %{version}
Requires:       %{typelib_extras} = %{version}
Requires:       %{typelib} = %{version}

%description devel
This package provides development headers for libunity.

%prep
%autosetup -c -p1

%build
NOCONFIGURE=1 gnome-autogen.sh
export PYTHON='python3'
%configure \
  --disable-static         \
  --disable-headless-tests
%make_build

%install
%make_install

# Ask for one specific Python version in unity-scopes/.
pushd %{buildroot}%{_datadir}/unity-scopes/
rm -rf *.pyc *.pyo __pycache__/
chmod a+x *
sed -i '1s|^#!.*$|#!%{_bindir}/python3|' *.py
%py3_compile .
popd

find %{buildroot} -type f -name "*.la" -delete -print

%fdupes %{buildroot}%{_datadir}/
%fdupes %{buildroot}%{python3_sitearch}/

%post -n %{name}%{sover} -p /sbin/ldconfig

%postun -n %{name}%{sover} -p /sbin/ldconfig

%files tools
%license COPYING COPYING.GPL-3
%doc AUTHORS NEWS README
%{_bindir}/libunity-tool
%{_bindir}/unity-scope-loader
%{_datadir}/glib-2.0/schemas/com.canonical.Unity.Lenses.gschema.xml
%{_datadir}/unity-scopes/
%{_datadir}/unity/

%files -n %{name}%{sover}
%{_libdir}/%{name}.so.%{sover}*
%{_libdir}/%{name}?*.so.*

%files -n %{typelib}
%{_libdir}/girepository-1.0/Unity-7.0.typelib

%files -n %{typelib_extras}
%{_libdir}/girepository-1.0/UnityExtras-7.0.typelib

%files -n python3-%{name}
%dir %{python3_sitearch}/gi/
%dir %{python3_sitearch}/gi/overrides/
%{python3_sitearch}/gi/overrides/Unity.py*
%dir %{python3_sitearch}/gi/overrides/__pycache__/
%{python3_sitearch}/gi/overrides/__pycache__/Unity.*

%files devel
%{_includedir}/unity/
%{_libdir}/%{name}*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/gir-1.0/*.gir
%{_datadir}/vala/vapi/unity*

%changelog
openSUSE Build Service is sponsored by