1*4882a593Smuzhiyun################################################################################ 2*4882a593Smuzhiyun# 3*4882a593Smuzhiyun# setools 4*4882a593Smuzhiyun# 5*4882a593Smuzhiyun################################################################################ 6*4882a593Smuzhiyun 7*4882a593SmuzhiyunSETOOLS_VERSION = 4.4.0 8*4882a593SmuzhiyunSETOOLS_SITE = $(call github,SELinuxProject,setools,$(SETOOLS_VERSION)) 9*4882a593SmuzhiyunSETOOLS_DEPENDENCIES = libselinux libsepol python-setuptools host-bison host-flex host-python-cython host-swig 10*4882a593SmuzhiyunSETOOLS_INSTALL_STAGING = YES 11*4882a593SmuzhiyunSETOOLS_LICENSE = GPL-2.0+, LGPL-2.1+ 12*4882a593SmuzhiyunSETOOLS_LICENSE_FILES = COPYING COPYING.GPL COPYING.LGPL 13*4882a593SmuzhiyunSETOOLS_CPE_ID_VENDOR = selinuxproject 14*4882a593SmuzhiyunSETOOLS_SETUP_TYPE = setuptools 15*4882a593SmuzhiyunHOST_SETOOLS_DEPENDENCIES = host-python3-cython host-libselinux host-libsepol host-python-networkx 16*4882a593SmuzhiyunHOST_SETOOLS_NEEDS_HOST_PYTHON = python3 17*4882a593Smuzhiyun 18*4882a593Smuzhiyundefine SETOOLS_FIX_SETUP 19*4882a593Smuzhiyun # By default, setup.py will look for libsepol.a in the host machines 20*4882a593Smuzhiyun # /usr/lib directory. This needs to be changed to the staging directory. 21*4882a593Smuzhiyun $(SED) "s@lib_dirs =.*@lib_dirs = ['$(STAGING_DIR)/usr/lib']@g" \ 22*4882a593Smuzhiyun $(@D)/setup.py 23*4882a593Smuzhiyunendef 24*4882a593SmuzhiyunSETOOLS_POST_PATCH_HOOKS += SETOOLS_FIX_SETUP 25*4882a593Smuzhiyun 26*4882a593Smuzhiyundefine HOST_SETOOLS_FIX_SETUP 27*4882a593Smuzhiyun # By default, setup.py will look for libsepol.a in the host machines 28*4882a593Smuzhiyun # /usr/lib directory. This needs to be changed to the host directory. 29*4882a593Smuzhiyun $(SED) "s@lib_dirs =.*@lib_dirs = ['$(HOST_DIR)/lib']@g" \ 30*4882a593Smuzhiyun $(@D)/setup.py 31*4882a593Smuzhiyunendef 32*4882a593SmuzhiyunHOST_SETOOLS_POST_PATCH_HOOKS += HOST_SETOOLS_FIX_SETUP 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun# apol requires pyqt5. However, the setools installation 35*4882a593Smuzhiyun# process will install apol even if pyqt5 is missing. 36*4882a593Smuzhiyun# Remove these scripts from the target it pyqt5 is not selected. 37*4882a593Smuzhiyunifeq ($(BR2_PACKAGE_PYTHON_PYQT5),) 38*4882a593Smuzhiyundefine SETOOLS_REMOVE_QT_SCRIPTS 39*4882a593Smuzhiyun $(RM) $(TARGET_DIR)/usr/bin/apol 40*4882a593Smuzhiyun $(RM) -r $(TARGET_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/setoolsgui/ 41*4882a593Smuzhiyunendef 42*4882a593SmuzhiyunSETOOLS_POST_INSTALL_TARGET_HOOKS += SETOOLS_REMOVE_QT_SCRIPTS 43*4882a593Smuzhiyunendif 44*4882a593Smuzhiyun 45*4882a593Smuzhiyun# pyqt5 is not a host-package, remove apol from the host directory. 46*4882a593Smuzhiyundefine HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS 47*4882a593Smuzhiyun $(RM) $(HOST_DIR)/bin/apol 48*4882a593Smuzhiyunendef 49*4882a593SmuzhiyunHOST_SETOOLS_POST_INSTALL_HOOKS += HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS 50*4882a593Smuzhiyun 51*4882a593Smuzhiyun$(eval $(python-package)) 52*4882a593Smuzhiyun$(eval $(host-python-package)) 53