2014-12-16 04:53:53 +01:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# libselinux
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
2019-04-08 20:50:06 +02:00
|
|
|
LIBSELINUX_VERSION = 2.9
|
|
|
|
LIBSELINUX_SITE = https://github.com/SELinuxProject/selinux/releases/download/20190315
|
2014-12-16 04:53:53 +01:00
|
|
|
LIBSELINUX_LICENSE = Public Domain
|
|
|
|
LIBSELINUX_LICENSE_FILES = LICENSE
|
|
|
|
|
|
|
|
LIBSELINUX_DEPENDENCIES = libsepol pcre
|
|
|
|
|
|
|
|
LIBSELINUX_INSTALL_STAGING = YES
|
|
|
|
|
2016-06-27 00:39:11 +02:00
|
|
|
# Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22.
|
2018-10-11 21:37:00 +02:00
|
|
|
# Set SHLIBDIR to /usr/lib so it has the same value than LIBDIR, as a result
|
|
|
|
# we won't have to use a relative path in 0002-revert-ln-relative.patch
|
2014-12-16 04:53:53 +01:00
|
|
|
LIBSELINUX_MAKE_OPTS = \
|
|
|
|
$(TARGET_CONFIGURE_OPTS) \
|
2016-06-27 00:39:11 +02:00
|
|
|
CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
|
2015-09-16 12:10:03 +02:00
|
|
|
LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
|
2018-10-11 21:37:00 +02:00
|
|
|
ARCH=$(KERNEL_ARCH) \
|
|
|
|
SHLIBDIR=/usr/lib
|
2014-12-16 04:53:53 +01:00
|
|
|
|
2017-02-02 23:45:04 +01:00
|
|
|
LIBSELINUX_MAKE_INSTALL_TARGETS = install
|
|
|
|
|
2019-09-22 11:06:26 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_USES_GLIBC),)
|
|
|
|
LIBSELINUX_DEPENDENCIES += musl-fts
|
|
|
|
LIBSELINUX_MAKE_OPTS += FTS_LDLIBS=-lfts
|
|
|
|
endif
|
|
|
|
|
2017-02-02 23:45:04 +01:00
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON)$(BR2_PACKAGE_PYTHON3),y)
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
|
|
|
LIBSELINUX_DEPENDENCIES += python3 host-swig
|
|
|
|
LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m
|
|
|
|
LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
|
|
|
|
else ifeq ($(BR2_PACKAGE_PYTHON),y)
|
|
|
|
LIBSELINUX_DEPENDENCIES += python host-swig
|
|
|
|
LIBSELINUX_PYINC = -I$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)
|
|
|
|
LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
LIBSELINUX_MAKE_OPTS += \
|
2019-04-08 20:50:06 +02:00
|
|
|
PYTHON=$(LIBSELINUX_PYLIBVER) \
|
2017-02-02 23:45:04 +01:00
|
|
|
PYINC="$(LIBSELINUX_PYINC)" \
|
|
|
|
PYSITEDIR=$(TARGET_DIR)/usr/lib/$(LIBSELINUX_PYLIBVER)/site-packages \
|
2017-07-05 13:14:23 +02:00
|
|
|
SWIG_LIB="$(HOST_DIR)/share/swig/$(SWIG_VERSION)/"
|
2017-02-02 23:45:04 +01:00
|
|
|
|
|
|
|
LIBSELINUX_MAKE_INSTALL_TARGETS += install-pywrap
|
2017-04-13 06:16:12 +02:00
|
|
|
|
|
|
|
# dependencies are broken and result in file truncation errors at link
|
|
|
|
# time if the Python bindings are built through the same make
|
|
|
|
# invocation as the rest of the library.
|
|
|
|
define LIBSELINUX_BUILD_PYTHON_BINDINGS
|
|
|
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
2018-01-16 09:21:53 +01:00
|
|
|
$(LIBSELINUX_MAKE_OPTS) swigify pywrap
|
2017-04-13 06:16:12 +02:00
|
|
|
endef
|
2017-02-02 23:45:04 +01:00
|
|
|
endif # python || python3
|
|
|
|
|
2014-12-16 04:53:53 +01:00
|
|
|
define LIBSELINUX_BUILD_CMDS
|
2016-10-28 15:18:22 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
2018-01-16 09:21:53 +01:00
|
|
|
$(LIBSELINUX_MAKE_OPTS) all
|
2017-04-13 06:16:12 +02:00
|
|
|
$(LIBSELINUX_BUILD_PYTHON_BINDINGS)
|
2014-12-16 04:53:53 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define LIBSELINUX_INSTALL_STAGING_CMDS
|
2016-10-28 15:18:22 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
2017-02-02 23:45:04 +01:00
|
|
|
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) \
|
|
|
|
$(LIBSELINUX_MAKE_INSTALL_TARGETS)
|
2014-12-16 04:53:53 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define LIBSELINUX_INSTALL_TARGET_CMDS
|
2016-10-28 15:18:22 +02:00
|
|
|
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
|
|
|
|
$(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
|
2014-12-16 04:53:53 +01:00
|
|
|
# Create the selinuxfs mount point
|
|
|
|
if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
|
|
|
|
if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
|
|
|
|
echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
|
|
|
|
endef
|
|
|
|
|
|
|
|
HOST_LIBSELINUX_DEPENDENCIES = \
|
|
|
|
host-libsepol host-pcre host-swig
|
|
|
|
|
|
|
|
ifeq ($(BR2_PACKAGE_PYTHON3),y)
|
|
|
|
HOST_LIBSELINUX_DEPENDENCIES += host-python3
|
2017-07-05 13:14:22 +02:00
|
|
|
HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/include/python$(PYTHON3_VERSION_MAJOR)m/
|
2014-12-16 04:53:53 +01:00
|
|
|
HOST_LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
|
|
|
|
else
|
|
|
|
HOST_LIBSELINUX_DEPENDENCIES += host-python
|
2017-07-05 13:14:22 +02:00
|
|
|
HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/include/python$(PYTHON_VERSION_MAJOR)/
|
2014-12-16 04:53:53 +01:00
|
|
|
HOST_LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
|
|
|
|
endif
|
|
|
|
|
|
|
|
HOST_LIBSELINUX_MAKE_OPTS = \
|
|
|
|
$(HOST_CONFIGURE_OPTS) \
|
2019-04-08 20:50:06 +02:00
|
|
|
PYTHON=$(HOST_LIBSELINUX_PYLIBVER) \
|
2017-07-05 13:14:50 +02:00
|
|
|
PREFIX=$(HOST_DIR) \
|
2018-10-11 21:37:00 +02:00
|
|
|
SHLIBDIR=$(HOST_DIR)/lib \
|
2014-12-16 04:53:53 +01:00
|
|
|
LDFLAGS="$(HOST_LDFLAGS) -lpcre -lpthread" \
|
|
|
|
PYINC="$(HOST_LIBSELINUX_PYINC)" \
|
2017-07-05 13:14:21 +02:00
|
|
|
PYSITEDIR="$(HOST_DIR)/lib/$(HOST_LIBSELINUX_PYLIBVER)/site-packages" \
|
2017-07-05 13:14:23 +02:00
|
|
|
SWIG_LIB="$(HOST_DIR)/share/swig/$(SWIG_VERSION)/"
|
2014-12-16 04:53:53 +01:00
|
|
|
|
|
|
|
define HOST_LIBSELINUX_BUILD_CMDS
|
2016-10-28 15:18:23 +02:00
|
|
|
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
2017-07-05 13:14:50 +02:00
|
|
|
$(HOST_LIBSELINUX_MAKE_OPTS) all
|
2014-12-16 04:53:53 +01:00
|
|
|
# Generate python interface wrapper
|
2016-10-28 15:18:23 +02:00
|
|
|
$(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
|
2017-07-05 13:14:50 +02:00
|
|
|
$(HOST_LIBSELINUX_MAKE_OPTS) swigify pywrap
|
2014-12-16 04:53:53 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
define HOST_LIBSELINUX_INSTALL_CMDS
|
2016-10-28 15:18:23 +02:00
|
|
|
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
2017-07-05 13:14:50 +02:00
|
|
|
$(HOST_LIBSELINUX_MAKE_OPTS) install
|
2014-12-16 04:53:53 +01:00
|
|
|
# Install python interface wrapper
|
2016-10-28 15:18:23 +02:00
|
|
|
$(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
|
2017-07-05 13:14:50 +02:00
|
|
|
$(HOST_LIBSELINUX_MAKE_OPTS) install-pywrap
|
2014-12-16 04:53:53 +01:00
|
|
|
endef
|
|
|
|
|
|
|
|
$(eval $(generic-package))
|
|
|
|
$(eval $(host-generic-package))
|