%global major   0
%global gmajor  0.1
%global libname %mklibname %{name} %{major}
%global girname %mklibname gtklayershell-gir %{gmajor}
%global devname %mklibname %{name} -d

Name:           gtk-layer-shell
Version:        0.8.0
Release:        %mkrel 1
Summary:        Library to create components for Wayland using the Layer Shell
License:        LGPLv3+ and MIT
Group:		System/Libraries
URL:            https://github.com/wmww/gtk-layer-shell
Source0:        https://github.com/wmww/gtk-layer-shell/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  meson
BuildRequires:  vala-devel
BuildRequires:  pkgconfig(gobject-introspection-1.0)

# https://github.com/wmww/gtk-layer-shell/blob/master/compatibility.md
BuildRequires:  pkgconfig(gtk+-wayland-3.0) >= 3.22.0

BuildRequires:  pkgconfig(wayland-client) >= 1.10.0
BuildRequires:  pkgconfig(wayland-scanner) >= 1.10.0

%description
A library to write GTK applications that use Layer Shell. Layer Shell is a
Wayland protocol for desktop shell components, such as panels, notifications
and wallpapers. You can use it to anchor your windows to a corner or edge of
the output, or stretch them across the entire output. This library only makes
sense on Wayland compositors that support Layer Shell, and will not work on
X11. It supports all Layer Shell features including popups and popovers
(GTK popups Just Workâ„¢). Please open issues for any bugs you come across.

%package -n %{libname}
Summary:        Library to create components for Wayland using the Layer Shell
Group:          System/Libraries

%description -n %{libname}
A library to write GTK applications that use Layer Shell. Layer Shell is a
Wayland protocol for desktop shell components, such as panels, notifications
and wallpapers. You can use it to anchor your windows to a corner or edge of
the output, or stretch them across the entire output. This library only makes
sense on Wayland compositors that support Layer Shell, and will not work on
X11. It supports all Layer Shell features including popups and popovers
(GTK popups Just Workâ„¢). Please open issues for any bugs you come across.

%package -n %{girname}
Summary:        GObject Introspection interface description for GtkLayerShell
Group:          System/Libraries

%description -n %{girname}
GObject Introspection interface description for GtkLayerShell.

%package -n %{devname}
Summary:        Development files for %{name}
Group:          Development/Other
Requires:       %{libname} = %{version}-%{release}
Requires:       %{girname} = %{version}-%{release}
Provides:       %{name}-devel = %{version}-%{release}

%description -n %{devname}
Development files for %{name}.


%prep
%autosetup

%build
%meson
%meson_build

%install
%meson_install

%files -n %{libname}
%license LICENSE_LGPL.txt LICENSE_MIT.txt
%doc README.md CHANGELOG.md
%{_libdir}/lib%{name}.so.%{major}{,.*}

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

%files -n %{devname}
%{_includedir}/%{name}/
%{_libdir}/pkgconfig/*.pc
%{_libdir}/lib%{name}.so
%{_datadir}/gir-1.0/GtkLayerShell-%{gmajor}.gir
%{_datadir}/vala/vapi/gtk-layer-shell-%{major}.{deps,vapi}