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