File libpeas2.spec of Package libpeas2

#
# spec file for package libpeas2
#
# Copyright (c) 2023 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 prj_version 2
%define so_version 0
%define glib_version 2.74
%bcond_with gtkdoc
%global debug_package %{nil}
%bcond_with gjs
%bcond_with lua51
%bcond_with python3
%bcond_with vapi

Name:           libpeas2
Version:        2.0.0
Release:        0
Summary:        GObject-based Plugin Engine version 2
License:        LGPL-2.1-or-later
URL:            https://wiki.gnome.org/Projects/Libpeas
Source0:        libpeas-%{version}.tar.xz

BuildRequires:  (c_compiler or gcc or clang)
BuildRequires:  (c++_compiler or gcc-c++ or clang)
BuildRequires:  fdupes
BuildRequires:  gettext
BuildRequires:  meson >= 0.62.0
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(gio-2.0) >= %{glib_version}
BuildRequires:  pkgconfig(gmodule-2.0) >= %{glib_version}
BuildRequires:  pkgconfig(glib-2.0) >= %{glib_version}
BuildRequires:  pkgconfig(gobject-2.0) >= %{glib_version}
BuildRequires:  pkgconfig(pygobject-3.0) >= 3.2.0
BuildRequires:  pkgconfig(gobject-introspection-1.0) >= 1.39.0
%if %{with gjs}
BuildRequires:  pkgconfig(gjs-1.0) >= 1.77.1
BuildRequires:  pkgconfig(mozjs-115)
%endif
%if %{with gtkdoc}
BuildRequires:  pkgconfig(gi-docgen) >= 2021.7
%endif
%if %{with python3}
BuildRequires:  pkgconfig(python3) >= 3.2.0
%endif
%if %{with lua51}
BuildRequires:  lua51-lgi >= 0.9.0
BuildRequires:  pkgconfig(lua5.1) >= 5.1.0
BuildRequires:  pkgconfig(luajit) >= 2.0
%endif
%if %{with python3}
# The vapigen binary is required
BuildRequires:  vala
%endif

%description
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

%if %{defined suse_version}
%define libprefix libpeas2
%define libname libpeas-%{prj_version}-%{so_version}
%else
%define libname libpeas
%define libprefix libpeas
%endif

%package -n %{libname}
Summary:        GObject-based Plugin Engine
Requires:       %{libprefix}-lang
%if %{with vapi}
Requires:       %{libprefix}-devel-vapi
%endif
%if %{with gjs}
Recommends:     %{libprefix}-loader-gjs
%endif
%if %{with lua51}
Recommends:     %{libprefix}-loader-lua51
%endif
%if %{with python3}
Recommends:     %{libprefix}-loader-python
%endif
# Provide "libpeas2" to make the lang package installable
Provides:       %{libprefix} = %{version}

%description -n  %{libname}
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

%package -n typelib-1_0-Peas-%{prj_version}
Summary:        Introspection bindings for libpeas, a GObject-based plugin engine

%description -n typelib-1_0-Peas-%{prj_version}
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

This package provides the GObject Introspection bindings for the libpeas
library.

%package -n %{libprefix}-devel
Summary:        Development files for libpeas, a GObject-based plugin engine
Requires:       %{libname}
Requires:       typelib-1_0-Peas-%{prj_version} = %{version}

%description -n %{libprefix}-devel
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

%if %{with lua51}
%package -n %{libprefix}-loader-lua51
Summary:        Lua 5.1 runtime loader for libpeas
Supplements:    (%{libname} and lua51)

%description -n %{libprefix}-loader-lua51
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

This package contains the LUA 5.1 loader.
%endif

%if %{with vapi}
%package -n %{libprefix}-devel-vapi
Summary:        vapi library

%description -n %{libprefix}-devel-vapi
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

This package contains the vapi bindings
%endif

%if %{with gjs}
%package -n %{libprefix}-loader-gjs
Summary:        GJS runtime loader for libpeas
Supplements:    (%{libname} and gjs)

%description -n %{libprefix}-loader-gjs
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

This package contains the GJS loader.
%endif

%if %{with python3}
%package -n %{libprefix}-loader-python
Summary:        Python3 runtime loader for libpeas
Supplements:    (%{libname} and python3-base)

%description -n %{libprefix}-loader-python
libpeas is a gobject-based plugin engine, and is targetted at giving
every application the chance to assume its own extensibility.

This package contains the Python loader.
%endif

%prep
%autosetup -p1 -n libpeas-%{version}

%build
%meson \
    -Dgjs=%{?with_gjs:true}%{!?with_gjs:false} \
    -Dgtk_doc=%{?with_gtkdoc:true}%{!?with_gtkdoc:false} \
    -Dintrospection=true \
    -Dlua51=%{?with_lua51:true}%{!?with_lua51:false} \
    -Dpython3=%{?with_python3:true}%{!?with_python3:false} \
    -Dvapi=%{?with_vapi:true}%{!?with_vapi:false}

%meson_build

%install
%meson_install
ln -s Peas-2.gir %{buildroot}%{_datadir}/gir-1.0/libpeas-%{prj_version}.gir
mkdir -pv %{buildroot}%{_libdir}/libpeas-%{prj_version}/loaders

%fdupes -s %{buildroot}%{_datadir}/doc/

%ldconfig_scriptlets -n %{libname}

%files -n  %{libname}
%license COPYING
%doc AUTHORS README.md
%{_libdir}/libpeas-%{prj_version}.so.*
%dir %{_libdir}/libpeas-%{prj_version}
%dir %{_libdir}/libpeas-%{prj_version}/loaders

%files -n typelib-1_0-Peas-%{prj_version}
%{_libdir}/girepository-1.0/Peas-%{prj_version}.typelib

%if %{with gjs}
%files -n %{libprefix}-loader-gjs
%{_libdir}/libpeas-%{prj_version}/loaders/libgjsloader.so
%endif

%if %{with lua51}
%files -n %{libprefix}-loader-lua51
%{_libdir}/libpeas-%{prj_version}/loaders/liblua51loader.so
%endif

%if %{with python3}
%files -n %{libprefix}-loader-python
%{_libdir}/libpeas-%{prj_version}/loaders/libpythonloader.so
%endif

%if %{with vapi}
%files -n %{libprefix}-devel-vapi
%{_datadir}/vala/vapi/*
%endif

%files -n %{libprefix}-devel
%if %{with gtkdoc}
%{_datadir}/doc/libpeas-%{prj_version}
%endif
%{_includedir}/libpeas-%{prj_version}/
%{_libdir}/libpeas-%{prj_version}.so
%{_libdir}/pkgconfig/libpeas-%{prj_version}.pc
%{_datadir}/gir-1.0/Peas-%{prj_version}.gir
%{_datadir}/gir-1.0/libpeas-%{prj_version}.gir


%package -n %{libprefix}-lang
Summary: Languages for libpeas
%description -n %{libprefix}-lang
%{summary}.

%files -n %{libprefix}-lang
%{_datadir}/locale/*

%changelog
openSUSE Build Service is sponsored by