# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7
inherit gnome.org gnome2-utils meson xdg

DESCRIPTION="Collection of GSettings schemas for GNOME desktop"
HOMEPAGE="https://gitlab.gnome.org/GNOME/${PN}/"

LICENSE="LGPL-2.1+"
SLOT="0"
IUSE="+introspection vanilla-fonts"
NUM="1e58ab07356c4c44b814768fca56e2ce951617d0"
SRC_URI="${HOMEPAGE}-/archive/${NUM}/${PN}-${NUM}.tar.bz2 -> ${P}.tar.bz2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-macos ~sparc-solaris ~x86-solaris"

DEPEND="!<gnome-base/gdm-3.8"
RDEPEND="${DEPEND}"
BDEPEND="
	introspection? ( >=dev-libs/gobject-introspection-1.54:= )
	vanilla-fonts? (
		media-fonts/cantarell
		media-fonts/source-pro
	)
	dev-util/glib-utils
	>=sys-devel/gettext-0.19.8
	virtual/pkgconfig
"

S="${WORKDIR}/${PN}-${NUM}"

src_prepare() {
	# Revert change to 'Source Code Pro 10' and 'Cantarell 11' fonts back to generic sans and monospace aliases
	if use vanilla-fonts; then
		eapply -R "${FILESDIR}"/3.32.0-default-fonts.patch
	fi

	gnome2_src_prepare
	default
}

src_configure() {
	meson_src_configure $(meson_use introspection)
}

pkg_postinst() {
	xdg_pkg_postinst
	gnome2_schemas_update
}

pkg_postrm() {
	xdg_pkg_postrm
	gnome2_schemas_update
}