# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: team/gnome <ablocorrea@hotmail.com>
pkgname=yelp
pkgver=42.2
pkgrel=3
pkgdesc="Help browser for GNOME desktop"
url="https://wiki.gnome.org/Apps/Yelp"
arch="all"
license="GPL-2.0-or-later"
depends="dconf desktop-file-utils hicolor-icon-theme yelp-xsl"
makedepends="
	bzip2-dev
	glib-dev
	gtk+3.0-dev
	itstool
	libgcrypt-dev
	libhandy1-dev
	libxml2-dev
	libxslt-dev
	sqlite-dev
	webkit2gtk-4.1-dev
	xz-dev
	"
subpackages="$pkgname-static $pkgname-dev $pkgname-lang"
source="https://download.gnome.org/sources/yelp/${pkgver%.*}/yelp-$pkgver.tar.xz"

prepare() {
	default_prepare

	# update config.sub to recognize loongarch64-alpine-linux-musl
	update_config_sub

	sed 's|/usr/bin/sh|/bin/sh|' \
		-i build-aux/compile \
		-i build-aux/missing \
		-i build-aux/install-sh \
		-i build-aux/depcomp \
		-i build-aux/config.sub \
		-i build-aux/config.guess
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-webkit2gtk-4-1
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
7fd8da347b3cdb9b24a31eebe14c4964c5e41956caa2b79e70d6ea0c829d94f8428bbd96a2472c02d56673ca0ed1c75f7c6f874a59c4eea0b1440918a99969f4  yelp-42.2.tar.xz
"
