board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / libselinux / libselinux.mk
blob44120c4d3ba1eca2e7b72a7daf12e6f636ac8f7b
1 ################################################################################
3 # libselinux
5 ################################################################################
7 LIBSELINUX_VERSION = 2.6
8 LIBSELINUX_SITE = https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/20161014
9 LIBSELINUX_LICENSE = Public Domain
10 LIBSELINUX_LICENSE_FILES = LICENSE
12 LIBSELINUX_DEPENDENCIES = libsepol pcre
14 LIBSELINUX_INSTALL_STAGING = YES
16 # Filter out D_FILE_OFFSET_BITS=64. This fixes errors caused by glibc 2.22.
17 LIBSELINUX_MAKE_OPTS = \
18 $(TARGET_CONFIGURE_OPTS) \
19 CFLAGS="$(filter-out -D_FILE_OFFSET_BITS=64,$(TARGET_CFLAGS))" \
20 LDFLAGS="$(TARGET_LDFLAGS) -lpcre -lpthread" \
21 ARCH=$(KERNEL_ARCH)
23 define LIBSELINUX_BUILD_CMDS
24 # DESTDIR is needed during the compile to compute library and
25 # header paths.
26 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
27 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) all
28 endef
30 define LIBSELINUX_INSTALL_STAGING_CMDS
31 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
32 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(STAGING_DIR) install
33 endef
35 define LIBSELINUX_INSTALL_TARGET_CMDS
36 $(TARGET_MAKE_ENV) $(MAKE) -C $(@D) \
37 $(LIBSELINUX_MAKE_OPTS) DESTDIR=$(TARGET_DIR) install
38 # Create the selinuxfs mount point
39 if [ ! -d "$(TARGET_DIR)/selinux" ]; then mkdir $(TARGET_DIR)/selinux; fi
40 if ! grep -q "selinuxfs" $(TARGET_DIR)/etc/fstab; then \
41 echo "none /selinux selinuxfs noauto 0 0" >> $(TARGET_DIR)/etc/fstab ; fi
42 endef
44 HOST_LIBSELINUX_DEPENDENCIES = \
45 host-libsepol host-pcre host-swig
47 ifeq ($(BR2_PACKAGE_PYTHON3),y)
48 HOST_LIBSELINUX_DEPENDENCIES += host-python3
49 HOST_LIBSELINUX_PYTHONLIBDIR = -L$(HOST_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/
50 HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON3_VERSION_MAJOR)m/
51 HOST_LIBSELINUX_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
52 else
53 HOST_LIBSELINUX_DEPENDENCIES += host-python
54 HOST_LIBSELINUX_PYTHONLIBDIR = -L$(HOST_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/
55 HOST_LIBSELINUX_PYINC = -I$(HOST_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR)/
56 HOST_LIBSELINUX_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
57 endif
59 HOST_LIBSELINUX_MAKE_OPTS = \
60 $(HOST_CONFIGURE_OPTS) \
61 LDFLAGS="$(HOST_LDFLAGS) -lpcre -lpthread" \
62 PYINC="$(HOST_LIBSELINUX_PYINC)" \
63 PYTHONLIBDIR="$(HOST_LIBSELINUX_PYTHONLIBDIR)" \
64 PYLIBVER="$(HOST_LIBSELINUX_PYLIBVER)" \
65 SWIG_LIB="$(HOST_DIR)/usr/share/swig/$(SWIG_VERSION)/"
67 define HOST_LIBSELINUX_BUILD_CMDS
68 # DESTDIR is needed during the compile to compute library and
69 # header paths.
70 $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
71 $(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) \
72 SHLIBDIR=$(HOST_DIR)/usr/lib all
73 # Generate python interface wrapper
74 $(HOST_MAKE_ENV) $(MAKE1) -C $(@D) \
75 $(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) swigify pywrap
76 endef
78 define HOST_LIBSELINUX_INSTALL_CMDS
79 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
80 $(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) \
81 SHLIBDIR=$(HOST_DIR)/usr/lib SBINDIR=$(HOST_DIR)/usr/sbin install
82 (cd $(HOST_DIR)/usr/lib; $(HOSTLN) -sf libselinux.so.1 libselinux.so)
83 # Install python interface wrapper
84 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) \
85 $(HOST_LIBSELINUX_MAKE_OPTS) DESTDIR=$(HOST_DIR) install-pywrap
86 endef
88 $(eval $(generic-package))
89 $(eval $(host-generic-package))