setools.mk 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. ################################################################################
  2. #
  3. # setools
  4. #
  5. ################################################################################
  6. SETOOLS_VERSION = 4.1.1
  7. SETOOLS_SITE = $(call github,TresysTechnology,setools,$(SETOOLS_VERSION))
  8. SETOOLS_DEPENDENCIES = libselinux libsepol python-setuptools host-bison host-flex host-swig
  9. SETOOLS_INSTALL_STAGING = YES
  10. SETOOLS_LICENSE = GPL-2.0+, LGPL-2.1+
  11. SETOOLS_LICENSE_FILES = COPYING COPYING.GPL COPYING.LGPL
  12. SETOOLS_SETUP_TYPE = setuptools
  13. HOST_SETOOLS_DEPENDENCIES = host-libselinux host-libsepol host-python-networkx
  14. ifeq ($(BR2_PACKAGE_PYTHON3),y)
  15. SETOOLS_PYLIBVER = python$(PYTHON3_VERSION_MAJOR)
  16. else
  17. SETOOLS_PYLIBVER = python$(PYTHON_VERSION_MAJOR)
  18. SETOOLS_DEPENDENCIES += python-enum34
  19. endif
  20. define SETOOLS_FIX_SETUP
  21. # By default, setup.py will look for libsepol.a in the host machines
  22. # /usr/lib directory. This needs to be changed to the staging directory.
  23. $(SED) "s@base_lib_dirs =.*@base_lib_dirs = ['$(STAGING_DIR)/usr/lib']@g" \
  24. $(@D)/setup.py
  25. endef
  26. SETOOLS_POST_PATCH_HOOKS += SETOOLS_FIX_SETUP
  27. define HOST_SETOOLS_FIX_SETUP
  28. # By default, setup.py will look for libsepol.a in the host machines
  29. # /usr/lib directory. This needs to be changed to the host directory.
  30. $(SED) "s@base_lib_dirs =.*@base_lib_dirs = ['$(HOST_DIR)/lib']@g" \
  31. $(@D)/setup.py
  32. endef
  33. HOST_SETOOLS_POST_PATCH_HOOKS += HOST_SETOOLS_FIX_SETUP
  34. # apol requires pyqt5. However, the setools installation
  35. # process will install apol even if pyqt5 is missing.
  36. # Remove these scripts from the target it pyqt5 is not selected.
  37. ifeq ($(BR2_PACKAGE_PYTHON_PYQT5),)
  38. define SETOOLS_REMOVE_QT_SCRIPTS
  39. $(RM) $(TARGET_DIR)/usr/bin/apol
  40. $(RM) -r $(TARGET_DIR)/lib/$(SETOOLS_PYLIBVER)/site-packages/setoolsgui/
  41. endef
  42. SETOOLS_POST_INSTALL_TARGET_HOOKS += SETOOLS_REMOVE_QT_SCRIPTS
  43. endif
  44. # pyqt5 is not a host-package, remove apol from the host directory.
  45. define HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS
  46. $(RM) $(HOST_DIR)/bin/apol
  47. endef
  48. HOST_SETOOLS_POST_INSTALL_HOOKS += HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS
  49. $(eval $(python-package))
  50. $(eval $(host-python-package))