xref: /OK3568_Linux_fs/buildroot/package/restorecond/restorecond.mk (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1################################################################################
2#
3# restorecond
4#
5################################################################################
6
7RESTORECOND_VERSION = 3.2
8RESTORECOND_SITE = https://github.com/SELinuxProject/selinux/releases/download/$(RESTORECOND_VERSION)
9RESTORECOND_LICENSE = GPL-2.0
10RESTORECOND_LICENSE_FILES = COPYING
11
12RESTORECOND_DEPENDENCIES = libglib2 libsepol libselinux dbus-glib
13
14# Undefining _FILE_OFFSET_BITS here because of a "bug" with glibc fts.h
15# large file support.
16# See https://bugzilla.redhat.com/show_bug.cgi?id=574992 for more information
17RESTORECOND_MAKE_OPTS += \
18	$(TARGET_CONFIGURE_OPTS) \
19	CFLAGS="$(TARGET_CFLAGS) -U_FILE_OFFSET_BITS" \
20	CPPFLAGS="$(TARGET_CPPFLAGS) -U_FILE_OFFSET_BITS" \
21	ARCH="$(BR2_ARCH)"
22
23# We need to pass DESTDIR at build time because it's used by
24# restorecond build system to find headers and libraries.
25define RESTORECOND_BUILD_CMDS
26	$(MAKE) -C $(@D) $(RESTORECOND_MAKE_OPTS) DESTDIR=$(STAGING_DIR) all
27endef
28
29define RESTORECOND_INSTALL_INIT_SYSV
30	$(INSTALL) -m 0755 -D package/restorecond/S02restorecond \
31		$(TARGET_DIR)/etc/init.d/S02restorecond
32endef
33
34define RESTORECOND_INSTALL_INIT_SYSTEMD
35	$(INSTALL) -m 0644 -D $(@D)/restorecond.service \
36		$(TARGET_DIR)/usr/lib/systemd/system/restorecond.service
37
38	mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants
39	ln -fs ../../../../usr/lib/systemd/system/restorecond.service \
40		$(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/restorecond.service
41
42	$(INSTALL) -m 0600 -D $(@D)/org.selinux.Restorecond.service \
43		$(TARGET_DIR)/etc/systemd/system/org.selinux.Restorecond.service
44endef
45
46define RESTORECOND_INSTALL_TARGET_CMDS
47	$(INSTALL) -m 0644 -D $(@D)/restorecond.conf $(TARGET_DIR)/etc/selinux/restorecond.conf
48	$(INSTALL) -m 0644 -D $(@D)/restorecond_user.conf $(TARGET_DIR)/etc/selinux/restorecond_user.conf
49	$(INSTALL) -m 0755 -D $(@D)/restorecond $(TARGET_DIR)/usr/sbin/restorecond
50endef
51
52$(eval $(generic-package))
53