File libindicate.spec of Package libindicate

#
# spec file for package libindicate
#
# 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 _version 12.10
%global flavor @BUILD_FLAVOR@%{nil}
%define sover 5
%define sover_gtk 3
%if "%{flavor}" == "gtk2"
%global gtkver 2
%endif
%if "%{flavor}" == "gtk3"
%global psuffix 3
%global gtkver 3
%endif
Name:           libindicate
Version:        12.10.1
Release:        0
Summary:        Library to raise flags on D-Bus
License:        LGPL-3.0-only
Group:          System/Libraries
URL:            https://launchpad.net/libindicate
Source:         https://launchpad.net/libindicate/%{_version}/%{version}/+download/libindicate-%{version}.tar.gz
# PATCH-FIX-OPENSUSE 0001_disable-werror.patch sor.alexei@meowr.ru -- Disable -Werror.
Patch0:         0001_disable-werror.patch
# PATCH_FIX_UPSTREAM 0002_missing_documentation.patch -- Adds some missing documentation.
Patch1:         0002_missing_documentation.patch
# PATCH-FIX-UPSTREAM 0003_libpyglib-linking.patch lp#690555 nmo.marques@gmail.com -- Fixes Python static version.
Patch2:         0003_libpyglib-linking.patch
# PATCH-FIX-UPSTREAM 0004_Fix_documentation.patch
Patch3:         0004_Fix_documentation.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gnome-doc-utils-devel
BuildRequires:  gtk-doc
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  vala
BuildRequires:  pkgconfig(dbus-glib-1)
BuildRequires:  pkgconfig(dbusmenu-glib-0.4)
BuildRequires:  pkgconfig(gobject-introspection-1.0)
%if "%{flavor}" == "gtk2"
BuildRequires:  pkgconfig(gtk+-2.0)
%endif
%if "%{flavor}" == "gtk3"
BuildRequires:  pkgconfig(gtk+-3.0)
%endif

%description
A small library for applications to raise "flags" on D-Bus for other
components of the desktop to pick up and visualise.

%package -n %{name}%{sover}
Summary:        Library to raise flags on D-Bus
Group:          System/Libraries

%description -n %{name}%{sover}
A small library for applications to raise "flags" on D-Bus for other
components of the desktop to pick up and visualise.

%package -n typelib-1_0-Indicate-0_7
Summary:        Library to raise flags on D-Bus -- Introspection Bindings
Group:          System/Libraries

%description -n typelib-1_0-Indicate-0_7
This package contains the GObject Introspection bindings for the
indicate library.

%package devel
Summary:        Development files for libindicate
Group:          Development/Libraries/C and C++
Requires:       %{name}%{sover} = %{version}
Requires:       pkgconfig(dbus-glib-1)
Requires:       pkgconfig(dbusmenu-glib-0.4)

%description devel
This package contains the development files for the indicate library.

%package gtk%{?psuffix:%{psuffix}-}%{sover_gtk}
Summary:        Library to raise flags on D-Bus
Group:          System/Libraries

%description gtk%{?psuffix:%{psuffix}-}%{sover_gtk}
A small library for applications to raise "flags" on D-Bus for other
components of the desktop to pick up and visualise.

This package contains the GTK %{gtkver} bindings for this library.

%package -n typelib-1_0-IndicateGtk%{?psuffix}-0_7
Summary:        Library to raise flags on D-Bus -- Introspection Bindings
Group:          System/Libraries

%description -n typelib-1_0-IndicateGtk%{?psuffix}-0_7
This package contains the GObject Introspection bindings for the
indicate-gtk%{?psuffix} library.

%package gtk%{?psuffix}-devel
Summary:        Development files for libindicate-gtk%{?psuffix}
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}
Requires:       %{name}-gtk%{?psuffix:%{psuffix}-}%{sover_gtk} = %{version}
Requires:       pkgconfig(dbus-glib-1)
%if "%{flavor}" == "gtk2"
Requires:       pkgconfig(gtk+-2.0)
%else
Requires:       pkgconfig(gtk+-3.0)
%endif

%description gtk%{?psuffix}-devel
This package contains the development files for the indicate-gtk3
library.

%package doc
Summary:        Documentation for libindicate
Group:          Documentation/HTML
BuildArch:      noarch

%description doc
This package contains the documentation for the indicate library.

%prep
%autosetup -p1

# Build fix (thanks to Damian!).
sed -i '/#include "glib\/gmessages.h"/d' libindicate/indicator.c

%build
autoreconf -vfi
%configure \
%if "%{flavor}" == ""
  --disable-gtk          \
  --with-gtk=3           \
%else
  --with-gtk=%{gtkver}   \
  --disable-doc          \
%endif
  --disable-scrollkeeper \
  --enable-introspection \
  --disable-python       \
  --disable-static
%make_build

%install
%make_install

%if "%{flavor}" == ""
# Put documentation into the correct directory.
mkdir -p %{buildroot}%{_docdir}/%{name}-doc/examples/
mv -f %{buildroot}%{_datadir}/doc/libindicate/examples/* \
  %{buildroot}%{_docdir}/%{name}-doc/examples/
%else
# Only install the GTK libraries.
rm %{buildroot}%{_libdir}/libindicate.so*
rm -r %{buildroot}%{_includedir}/libindicate-0.7/
rm %{buildroot}%{_libdir}/pkgconfig/indicate-0.7.pc
rm %{buildroot}%{_libdir}/girepository-1.0/Indicate-0.7.typelib
rm %{buildroot}%{_datadir}/gir-1.0/Indicate-0.7.gir
rm %{buildroot}%{_datadir}/vala/vapi/Indicate-0.7.vapi
rm -r %{buildroot}%{_datadir}/doc/libindicate/examples/
%endif

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

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

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

%post gtk%{?psuffix:%{psuffix}-}%{sover_gtk} -p /sbin/ldconfig

%postun gtk%{?psuffix:%{psuffix}-}%{sover_gtk} -p /sbin/ldconfig

%if "%{flavor}" == ""
%files -n %{name}%{sover}
%license COPYING*
%doc AUTHORS
%{_libdir}/libindicate.so.%{sover}*

%files -n typelib-1_0-Indicate-0_7
%{_libdir}/girepository-1.0/Indicate-0.7.typelib

%files devel
%{_includedir}/libindicate-0.7/
%{_libdir}/libindicate.so
%{_libdir}/pkgconfig/indicate-0.7.pc
%{_datadir}/gir-1.0/Indicate-0.7.gir
%{_datadir}/vala/vapi/Indicate-0.7.vapi

%files doc
%doc %{_datadir}/gtk-doc/html/libindicate/
%doc %{_docdir}/%{name}-doc/

%else

%files gtk%{?psuffix:%{psuffix}-}%{sover_gtk}
%{_libdir}/libindicate-gtk%{?psuffix}.so.%{sover_gtk}*

%files -n typelib-1_0-IndicateGtk%{?psuffix}-0_7
%{_libdir}/girepository-1.0/IndicateGtk%{?psuffix}-0.7.typelib

%files gtk%{?psuffix}-devel
%{_includedir}/libindicate-gtk%{?psuffix}-0.7/
%{_libdir}/libindicate-gtk%{?psuffix}.so
%{_libdir}/pkgconfig/indicate-gtk%{?psuffix}-0.7.pc
%{_datadir}/gir-1.0/IndicateGtk%{?psuffix}-0.7.gir
%{_datadir}/vala/vapi/IndicateGtk%{?psuffix}-0.7.vapi
%endif

%changelog
openSUSE Build Service is sponsored by