package/policycoreutils: bump to version 3.9

Changes:
https://github.com/SELinuxProject/selinux/releases/download/3.9/RELEASE-3.9.txt

Notable changes related to policycoreutils: none.

However, in terms of packaging, there's a change: the top-level
Makefile of policycoreutils now uses pkg-config to find libselinux and
libsemanage. So building directly the subdirs no longer works because
the variables defined by the top-level Makefile are no longer set. So
we simplify the whole packaging by building from the top-level
Makefile. In order for this pkg-config to work for the host variant,
we need to pass $(HOST_MAKE_ENV) in the environment of make, so we
also did the same for consistency with $(TARGET_MAKE_ENV).

In terms of dependencies: policycoreutils directly links with
libselinux, libsemanage and libsepol, so all three are needed for both
the target and host variants. And host-pkgconf is now needed for the
host variant, as it's used to detect the dependent libraries.

The patches also need to be refreshed, except 0003 that is dropped
since it was a backport from upstream.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>

merge policycoreutils

Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Thomas Petazzoni
2025-09-09 14:08:13 +02:00
committed by Julien Olivain
parent 5bed5470a4
commit 8de4aadda7
6 changed files with 15 additions and 70 deletions

View File

@@ -32,7 +32,7 @@ index a3bbbe1..df675cf 100644
+AUDITH ?= $(shell test -f $(DESTDIR)$(PREFIX)/include/libaudit.h && echo y)
CFLAGS ?= -g -Werror -Wall -W
override LDLIBS += -lselinux -lsepol -lpthread
override CFLAGS += -I../../libselinux/include
--
2.13.6

View File

@@ -48,7 +48,7 @@ index e86364a..20a64d4 100644
+AUDITH ?= $(shell test -f $(DESTDIR)$(PREFIX)/include/libaudit.h && echo y)
CFLAGS ?= -Werror -Wall -W
override CFLAGS += -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
override CFLAGS += -I../../libselinux/include -DUSE_NLS -DLOCALEDIR="\"$(LOCALEDIR)\"" -DPACKAGE="\"policycoreutils\""
--
2.31.1

View File

@@ -1,37 +0,0 @@
From f338b2e7d2bbf70cb811eb1331162e33deb4ce6c Mon Sep 17 00:00:00 2001
From: Robert Marko <robimarko@gmail.com>
Date: Thu, 1 May 2025 21:59:13 +0200
Subject: [PATCH] policycoreutils: run_init: define _GNU_SOURCE
Trying to compile run_init with musl will fail with:
run_init.c: In function 'authenticate_via_shadow_passwd':
run_init.c:206:40: error: implicit declaration of function 'getpass' [-Wimplicit-function-declaration]
206 | if (!(unencrypted_password_s = getpass(PASSWORD_PROMPT))) {
This is because getpass in musl is guarded only for _GNU_SOURCE, so
define _GNU_SOURCE for run_init.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Acked-by: James Carter <jwcart2@gmail.com>
Upstream: 50bafc3d9c08cf26c3b0f61e29157a0ea8efbf4a
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
---
policycoreutils/run_init/run_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/policycoreutils/run_init/run_init.c b/policycoreutils/run_init/run_init.c
index ce499781..4531a8ba 100644
--- a/policycoreutils/run_init/run_init.c
+++ b/policycoreutils/run_init/run_init.c
@@ -37,6 +37,8 @@
*
*************************************************************************/
+#define _GNU_SOURCE
+
#include <stdio.h>
#include <stdlib.h> /* for malloc(), realloc(), free() */
#include <pwd.h> /* for getpwuid() */
--
2.51.0

View File

@@ -6,9 +6,10 @@ comment "policycoreutils needs a toolchain w/ threads, dynamic library, gcc >= 5
config BR2_PACKAGE_POLICYCOREUTILS
bool "policycoreutils"
depends on BR2_PACKAGE_AUDIT_ARCH_SUPPORTS # libsemanage
depends on BR2_TOOLCHAIN_HAS_THREADS # libsemanage, libsepol
depends on !BR2_STATIC_LIBS # libsemanage, libsepol
depends on BR2_TOOLCHAIN_HAS_THREADS # libselinux, libsemanage, libsepol
depends on !BR2_STATIC_LIBS # libselinux, libsemanage, libsepol
depends on BR2_TOOLCHAIN_GCC_AT_LEAST_5 # libsemanage -> libselinux -> libsepol
select BR2_PACKAGE_LIBSELINUX
select BR2_PACKAGE_LIBSEMANAGE
select BR2_PACKAGE_LIBSEPOL
select BR2_PACKAGE_LIBCAP_NG

View File

@@ -1,3 +1,3 @@
# https://github.com/SELinuxProject/selinux/wiki/Releases
sha256 eef23196b501d141cb95f5fc52ef1a7289f459b65e4415ea0fe9aeedc5d80ef2 policycoreutils-3.8.1.tar.gz
sha256 44a294139876cf4c7969cb6a75d1932cb42543d74a7661760ded44a20bf7ebe8 policycoreutils-3.9.tar.gz
sha256 204d8eff92f95aac4df6c8122bc1505f468f3a901e5a4cc08940e0ede1938994 LICENSE

View File

@@ -4,13 +4,13 @@
#
################################################################################
POLICYCOREUTILS_VERSION = 3.8.1
POLICYCOREUTILS_VERSION = 3.9
POLICYCOREUTILS_SITE = https://github.com/SELinuxProject/selinux/releases/download/$(POLICYCOREUTILS_VERSION)
POLICYCOREUTILS_LICENSE = GPL-2.0
POLICYCOREUTILS_LICENSE_FILES = LICENSE
POLICYCOREUTILS_CPE_ID_VENDOR = selinuxproject
POLICYCOREUTILS_DEPENDENCIES = libsemanage libsepol libcap-ng $(TARGET_NLS_DEPENDENCIES)
POLICYCOREUTILS_DEPENDENCIES = libselinux libsemanage libsepol libcap-ng host-pkgconf $(TARGET_NLS_DEPENDENCIES)
POLICYCOREUTILS_MAKE_OPTS = $(TARGET_CONFIGURE_OPTS) LDLIBS=$(TARGET_NLS_LIBS)
ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
@@ -32,28 +32,19 @@ ifeq ($(BR2_PACKAGE_LINUX_PAM)$(BR2_PACKAGE_AUDIT),yy)
POLICYCOREUTILS_MAKE_OPTS += LSPP_PRIV=y
endif
POLICYCOREUTILS_MAKE_DIRS = \
load_policy newrole run_init \
secon semodule sestatus setfiles \
setsebool scripts
# We need to pass DESTDIR at build time because it's used by
# policycoreutils build system to find headers and libraries.
define POLICYCOREUTILS_BUILD_CMDS
$(foreach d,$(POLICYCOREUTILS_MAKE_DIRS),
$(MAKE) -C $(@D)/$(d) $(POLICYCOREUTILS_MAKE_OPTS) \
DESTDIR=$(STAGING_DIR) all
)
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(POLICYCOREUTILS_MAKE_OPTS) \
DESTDIR=$(STAGING_DIR) all
endef
define POLICYCOREUTILS_INSTALL_TARGET_CMDS
$(foreach d,$(POLICYCOREUTILS_MAKE_DIRS),
$(MAKE) -C $(@D)/$(d) $(POLICYCOREUTILS_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) install
)
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(POLICYCOREUTILS_MAKE_OPTS) \
DESTDIR=$(TARGET_DIR) install
endef
HOST_POLICYCOREUTILS_DEPENDENCIES = host-libsemanage
HOST_POLICYCOREUTILS_DEPENDENCIES = host-libselinux host-libsemanage host-libsepol host-pkgconf
# We need to pass PREFIX because it defaults to $(DESTDIR)/usr
HOST_POLICYCOREUTILS_MAKE_OPTS = \
@@ -62,22 +53,12 @@ HOST_POLICYCOREUTILS_MAKE_OPTS = \
ETCDIR=$(HOST_DIR)/etc \
SBINDIR=$(HOST_DIR)/sbin
# Note: We are only building the programs required by the refpolicy build
HOST_POLICYCOREUTILS_MAKE_DIRS = \
load_policy newrole run_init \
secon semodule sestatus setfiles \
setsebool
define HOST_POLICYCOREUTILS_BUILD_CMDS
$(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) all
)
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_POLICYCOREUTILS_MAKE_OPTS) all
endef
define HOST_POLICYCOREUTILS_INSTALL_CMDS
$(foreach d,$(HOST_POLICYCOREUTILS_MAKE_DIRS),
$(MAKE) -C $(@D)/$(d) $(HOST_POLICYCOREUTILS_MAKE_OPTS) install
)
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) $(HOST_POLICYCOREUTILS_MAKE_OPTS) install
endef
$(eval $(generic-package))