# SliTaz package receipt.

PACKED_SIZE="92.0K"
UNPACKED_SIZE="528.0K"
PACKAGE="polkit"
VERSION="0.104"
CATEGORY="base-system"
SHORT_DESC="Application development toolkit for controlling system-wide privileges."
MAINTAINER="slaxemulator@gmail.com"
LICENSE="LGPL2"
TARBALL="$PACKAGE-$VERSION.tar.gz"
WEB_SITE="https://www.freedesktop.org/wiki/Software/PolicyKit"
WGET_URL="https://hal.freedesktop.org/releases/$TARBALL"
CROSS="error: cannot check for file existence when cross compiling"

DEPENDS="glib libgio dbus dbus-glib expat util-linux-eject"
BUILD_DEPENDS="glib-dev libgio-dev gobject-introspection-dev dbus-dev \
dbus-glib-dev expat-dev"

current_version()
{
	wget -O - $(dirname $WGET_URL) 2>/dev/null | \
	sed "/$PACKAGE-[0-9]/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
}

# Rules to configure and make the package.
compile_rules()
{
	patch -p0 < $stuff/CVE-2021-4034.u
	./configure \
		--prefix=/usr \
		--sysconfdir=/etc \
		--localstatedir=/var \
		--libexecdir=/usr/lib/polkit-1 \
		--disable-man-pages \
		--disable-gtk-doc \
		--with-authfw=shadow \
		$CONFIGURE_ARGS &&
	make && make install
}

# Rules to gen a SliTaz package suitable for Tazpkg.
genpkg_rules()
{
	mkdir -p $fs/usr/lib $fs/usr/share
	cp -a $install/usr/bin $fs/usr
	cp -a $install/etc $fs
	cp -a $install/usr/lib/*.so* $fs/usr/lib
	cp -a $install/usr/lib/polkit-1 $fs/usr/lib
	rm $fs/usr/lib/polkit-1/extensions/*.*a
	cp -a $install/usr/share/dbus-1 $fs/usr/share
	cp -a $install/usr/share/polkit-1 $fs/usr/share
	cp -a $install/var $fs
}
