aports/community/polkit/APKBUILD
Sertonix 6bd45b53fb */*: remove --no-rebuild from meson test
meson 1.7.0 and later don't include test build targets in the default
build target. With --no-rebuild the test targets aren't build at all.
Removing --no-rebuild shouldn't cause any false rebuilds since the files
aren't changed between the build() and check() step.

Fixes https://gitlab.alpinelinux.org/alpine/aports/-/issues/16891
Ref https://github.com/mesonbuild/meson/pull/10413
2025-05-09 20:48:14 +00:00

198 lines
5.1 KiB
Text

# Contributor: Carlo Landmeter
# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=polkit
pkgver=126
pkgrel=0
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://github.com/polkit-org/polkit"
arch="all"
license="GPL-2.0-or-later"
options="suid !check" # Needs a functioning dbus daemon
makedepends="
duktape-dev
elogind-dev
expat-dev
glib-dev
gobject-introspection-dev
linux-pam-dev
meson
perl
"
pkgusers="polkitd"
pkggroups="polkitd"
install="$pkgname-common.pre-install $pkgname-common.pre-upgrade"
subpackages="
$pkgname-dev
$pkgname-noelogind-libs:libs
$pkgname-doc
$pkgname-lang
$pkgname-openrc
$pkgname-common
$pkgname-elogind
$pkgname-elogind-dev:_elogind_dev
$pkgname-elogind-libs:_elogind_libs
"
source="https://github.com/polkit-org/polkit/archive/refs/tags/$pkgver/polkit-$pkgver.tar.gz
alpine-polkit.pam
polkit.initd
"
# secfixes:
# 0.120-r2:
# - CVE-2021-4034
# 0.119-r0:
# - CVE-2021-3560
build() {
msg 'Building without elogind'
_build no-elogind -Dsession_tracking="ConsoleKit"
msg 'Building with elogind'
_build elogind -Dsession_tracking="elogind"
}
_build() {
local outdir="$1"
shift
abuild-meson \
-Db_lto=true \
-Dtests="$(want_check && echo true || echo false)" \
-Dman=true \
-Dsystemdsystemunitdir=/trash \
-Dpam_prefix=/etc/pam.d \
"$@" \
. "$outdir"
meson compile -C "$outdir"
}
check() {
meson test --print-errorlogs -C elogind
}
package() {
provider_priority=100 # highest
depends="
$pkgname-common=$pkgver-r$pkgrel
$pkgname-noelogind-libs=$pkgver-r$pkgrel
"
DESTDIR="$pkgdir" meson install --no-rebuild -C no-elogind
DESTDIR="$builddir/elogind/dest" meson install --no-rebuild -C elogind
cd "$pkgdir"
# systemd files
rm -rf ./trash
# Use our own polkit rules, upstream may change them
install -m644 "$srcdir"/alpine-polkit.pam etc/pam.d/polkit-1
# See polkit's configure script which tells us what permissions to set
chown -R polkitd:polkitd etc/polkit-1/rules.d usr/share/polkit-1/rules.d
chmod -R 700 etc/polkit-1/rules.d usr/share/polkit-1/rules.d
chmod 4755 usr/lib/polkit-1/polkit-agent-helper-1
chmod 4755 usr/bin/pkexec
install -Dm755 "$srcdir"/polkit.initd etc/init.d/polkit
}
libs() {
provides="$pkgname-libs"
provider_priority=100 # highest
replaces="$pkgname-elogind-libs"
depends=""
default_libs
}
dev() {
default_dev
# XXX: We have to disable tracedeps to avoid abuild adding both
# polkit-libs and polkit-elogind-libs to depends - they are autodetected
# via symlinks in /usr/lib.
options="!tracedeps"
# XXX: Since we disabled tracedeps, all depends and provides must be
# specified. This sucks, but I don't know of a better solution (@jirutka).
depends="$depends_dev
$pkgname-common=$pkgver-r$pkgrel
$pkgname-libs
pc:gio-2.0>=2.18
pc:glib-2.0>=2.18
pkgconfig
"
provides="pc:polkit-agent-1=$pkgver pc:polkit-gobject-1=$pkgver"
}
elogind() {
pkgdesc="Polkit with elogind session tracking"
depends="$pkgname-elogind-libs=$pkgver-r$pkgrel $pkgname-common=$pkgver-r$pkgrel"
provides="$pkgname=$pkgver-r$pkgrel"
provider_priority=10 # lowest
replaces="$pkgname" # for backward compatibility
cd "$builddir"/elogind/dest
mkdir -p "$subpkgdir"/usr/lib/polkit-1
mv usr/lib/polkit-1/polkitd "$subpkgdir"/usr/lib/polkit-1/
}
_elogind_dev() {
pkgdesc="Polkit with elogind session tracking (development files)"
depends="$pkgname-dev=$pkgver-r$pkgrel $pkgname-elogind-libs=$pkgver-r$pkgrel"
replaces="$pkgname-dev"
cd "$builddir"/elogind/dest
# *.gir files for the default and the elogind variant differ, the rest
# is the same.
mkdir -p "$subpkgdir"/usr/share
mv usr/share/gir-1.0 "$subpkgdir"/usr/share/
}
_elogind_libs() {
pkgdesc="Polkit with elogind session tracking (libraries)"
depends=""
provides="$pkgname-libs"
provider_priority=10 # lowest
# for backward compatibility/overwrite order
replaces="$pkgname-libs $pkgname-noelogind-libs $pkgname-elogind<=0.118"
cd "$builddir"/elogind/dest
mkdir -p "$subpkgdir"/usr/lib
mv usr/lib/lib*.so.* "$subpkgdir"/usr/lib/
}
common() {
pkgdesc="Common files for polkit and polkit-elogind"
depends=""
replaces="$pkgname $pkgname-elogind" # for backward compatibility
# Move all that left to subpackage.
amove etc/*
amove usr/*
# Move polkitd back to the base package (that's the only file from the
# polkit package that differs between default and elogind variant).
mkdir -p "$pkgdir"/usr/lib/polkit-1
mv "$subpkgdir"/usr/lib/polkit-1/polkitd "$pkgdir"/usr/lib/polkit-1/
}
openrc() {
default_openrc
# polkit-elogind won't pull it otherwise
install_if="$pkgname-common=$pkgver-r$pkgrel openrc"
}
sha512sums="
dbdbc31b7a231c963788b37cf1a138e30336466fb662225a812faaf58e45439925d9d39346cc8f07e54f22040c2f142435acb9fded315d33e24930e0abc736c7 polkit-126.tar.gz
f5102dc00d390b3a3c957b62e1712db778c7ffb7378f3d8e816c0757c11a308c5d5303e42595b0d6add9839247c773880cd34e56afacc89eb6efaadf9aae7826 alpine-polkit.pam
f6e5ac0ed41feb392dfd104979ec577c5936f3db2bd252b12b7b9b2609a0901dae38bebec1ea65ccf4f427860b520383ae4d2c66fb74ab986c715f6b0ad50473 polkit.initd
"