dev-util/umockdev: avoid automagic SELinux

Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2026-05-19 03:06:18 +01:00
parent 05203eb854
commit 453d21ba29
3 changed files with 110 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
--- a/meson.build
+++ b/meson.build
@@ -84,11 +84,10 @@ meson.add_dist_script(srcdir / 'getversion.sh')
optional_defines = []
dl = cc.find_library('dl')
-selinux = cc.find_library('libselinux', required: false)
-if selinux.found()
- if cc.check_header('selinux/selinux.h')
- optional_defines += ['--define=HAVE_SELINUX']
- endif
+selinux = cc.find_library('libselinux', required: get_option('selinux'))
+selinux_header = cc.check_header('selinux/selinux.h', required: get_option('selinux'))
+if get_option('selinux').enabled()
+ optional_defines += ['--define=HAVE_SELINUX']
endif
glib = dependency('glib-2.0', version: '>= 2.32.0')
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -2,3 +2,8 @@ option('gtk_doc',
type : 'boolean',
value : false,
description : 'use gtk-doc to build documentation')
+
+option('selinux',
+ type : 'feature',
+ value : 'auto',
+ description : 'SELinux support')

View File

@@ -0,0 +1,71 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..14} )
inherit flag-o-matic meson-multilib python-any-r1 vala
if [[ ${PV} = 9999* ]]; then
EGIT_REPO_URI="https://github.com/martinpitt/${PN}.git"
inherit git-r3
else
SRC_URI="https://github.com/martinpitt/umockdev/releases/download/${PV}/${P}.tar.xz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
fi
DESCRIPTION="Mock hardware devices for creating unit tests"
HOMEPAGE="https://github.com/martinpitt/umockdev/"
LICENSE="LGPL-2.1+"
SLOT="0"
IUSE="selinux test"
RESTRICT="!test? ( test )"
RDEPEND="
net-libs/libpcap[${MULTILIB_USEDEP}]
virtual/libudev:=[${MULTILIB_USEDEP}]
>=dev-libs/glib-2.32:2[${MULTILIB_USEDEP}]
>=dev-libs/gobject-introspection-1.82.0-r2:=
selinux? ( sys-libs/libselinux )
"
DEPEND="${RDEPEND}
test? (
${PYTHON_DEPS}
dev-libs/libgudev:=[introspection,${MULTILIB_USEDEP}]
)
"
BDEPEND="
$(vala_depend)
app-arch/xz-utils
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-0.19.7-selinux-automagic.patch
)
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_prepare() {
default
vala_setup
}
multilib_src_configure() {
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270
filter-flags -fno-semantic-interposition
local emesonargs=(
$(meson_feature selinux)
)
meson_src_configure
}
multilib_src_test() {
export SLOW_TESTBED_FACTOR=100
meson_src_test --num-processes=1 --timeout-multiplier=10
}

View File

@@ -19,7 +19,7 @@ HOMEPAGE="https://github.com/martinpitt/umockdev/"
LICENSE="LGPL-2.1+"
SLOT="0"
IUSE="test"
IUSE="selinux test"
RESTRICT="!test? ( test )"
RDEPEND="
@@ -27,6 +27,7 @@ RDEPEND="
virtual/libudev:=[${MULTILIB_USEDEP}]
>=dev-libs/glib-2.32:2[${MULTILIB_USEDEP}]
>=dev-libs/gobject-introspection-1.82.0-r2:=
selinux? ( sys-libs/libselinux )
"
DEPEND="${RDEPEND}
test? (
@@ -40,6 +41,10 @@ BDEPEND="
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}"/${PN}-0.19.7-selinux-automagic.patch
)
pkg_setup() {
use test && python-any-r1_pkg_setup
}
@@ -53,6 +58,10 @@ multilib_src_configure() {
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101270
filter-flags -fno-semantic-interposition
local emesonargs=(
$(meson_feature selinux)
)
meson_src_configure
}