%define api		1
%define major		0
%define gmajor		1.0
%define libname		%mklibname %{name} %{api} %{major}
%define gtk3libname	%mklibname %{name}-gtk3_ %{api} %{major}
%define girname		%mklibname %{name}-gir %{gmajor}
%define gtk3girname	%mklibname %{name}gtk-gir %{gmajor}
%define develname	%mklibname %{name} -d

%define url_ver %(echo %{version} | cut -d. -f1,2)

Summary:	Xfce's freedesktop.org compliant menu library
Name:		garcon
Version:	4.19.0
Release:	%mkrel 1
License:	GPLv2+
Group:		Graphical desktop/Xfce
Url:		https://www.xfce.org
Source0:	https://archive.xfce.org/src/xfce/garcon/%{url_ver}/%{name}-%{version}.tar.bz2
BuildRequires:	intltool
BuildRequires:	xfce4-dev-tools
BuildRequires:	pkgconfig(glib-2.0)
BuildRequires:	pkgconfig(libxfce4util-1.0) >= 4.18.0
BuildRequires:	pkgconfig(gtk+-3.0)
BuildRequires:	pkgconfig(libxfce4ui-2) >= 4.18.0
BuildRequires:	pkgconfig(gobject-introspection-1.0)

#BuildRequires:	pkgconfig(gtk-doc)

%description
Garcon is an implementation of the freedesktop.org menu specification
replacing the former Xfce menu library libxfce4menu. It is based on
GLib/GIO only and aims at covering the entire specification except for
legacy menus.

%package data
Summary:	Locale and data files for %{name}
Group:		Graphical desktop/Xfce

%description data
This package contains the common data files and localizations for garcon,
Xfce's freedesktop.org menu implementation.

%package -n %{libname}
Summary:	Xfce's freedesktop.org menu implementation
Group:		System/Libraries
Requires:	%{name}-data >= %{version}-%{release}

%description -n %{libname}
Garcon is an implementation of the freedesktop.org menu specification
replacing the former Xfce menu library libxfce4menu. It is based on
GLib/GIO only and aims at covering the entire specification except for
legacy menus.

%package -n %{gtk3libname}
Summary:        Common GTK3 library for Xfce's freedesktop.org menu implementation
Group:          System/Libraries

%description -n %{gtk3libname}
Garcon is an implementation of the freedesktop.org menu specification
replacing the former Xfce menu library libxfce4menu. It is based on
GLib/GIO only and aims at covering the entire specification except for
legacy menus.

%package -n %{girname}
Summary:	GObject Introspection interface description for Garcon
Group:		System/Libraries
Requires:	%{libname} = %{version}-%{release}

%description -n %{girname}
GObject Introspection interface description for Garcon

%package -n %{gtk3girname}
Summary:	GObject Introspection interface description for GarconGtk
Group:		System/Libraries
Requires:	%{gtk3libname} = %{version}-%{release}

%description -n %{gtk3girname}
GObject Introspection interface description for GarconGtk.

%package -n %{develname}
Summary:	Development files for %{name}
Group:		Development/C
Requires:	%{libname} = %{version}-%{release}
Requires:	%{gtk3libname} = %{version}-%{release}
Requires:	%{girname} = %{version}-%{release}
Requires:	%{gtk3girname} = %{version}-%{release}
Provides:	%{name}-devel = %{version}-%{release}
Provides:	lib%{name}-devel = %{version}-%{release}

%description -n %{develname}
Development files and headers for %{name}.

%prep
%setup -q
%autopatch -p1

%build
%xdt_autogen
%configure \
	--disable-static \
	--enable-gtk-doc=no
%make_build

%install
%make_install

# this file is in %{_real_vendor}-xfce-config package
rm -rf %{buildroot}%{_sysconfdir}/xdg/menus/xfce-applications.menu

# don't ship .la
find %{buildroot} -name "*.la" -delete

%find_lang %{name}

%files data -f %{name}.lang
%{_datadir}/desktop-directories/xfce-*.directory
%{_iconsdir}/hicolor/*/apps/org.xfce.garcon.png

%files -n %{libname}
%{_libdir}/lib%{name}-%{api}.so.%{major}{,.*}

%files -n %{gtk3libname}
%{_libdir}/lib%{name}-gtk3-%{api}.so.%{major}{,.*}

%files -n %{girname}
%{_libdir}/girepository-1.0/Garcon-%{gmajor}.typelib

%files -n %{gtk3girname}
%{_libdir}/girepository-1.0/GarconGtk-%{gmajor}.typelib

%files -n %{develname}
%doc AUTHORS NEWS README*
%doc %{_datadir}/gtk-doc/html/%{name}/
%{_includedir}/%{name}*/
%{_libdir}/lib%{name}*-%{api}.so
%{_libdir}/pkgconfig/%{name}*-%{api}.pc
%{_datadir}/gir-1.0/Garcon-%{gmajor}.gir
%{_datadir}/gir-1.0/GarconGtk-%{gmajor}.gir