setools.mk 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ################################################################################
  2. #
  3. # setools
  4. #
  5. ################################################################################
  6. SETOOLS_VERSION = 4.4.3
  7. SETOOLS_SITE = $(call github,SELinuxProject,setools,$(SETOOLS_VERSION))
  8. SETOOLS_DEPENDENCIES = libselinux libsepol python-setuptools host-bison host-flex host-python-cython 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_CPE_ID_VENDOR = selinuxproject
  13. SETOOLS_SETUP_TYPE = setuptools
  14. HOST_SETOOLS_DEPENDENCIES = host-python-cython host-libselinux host-libsepol host-python-networkx
  15. define SETOOLS_FIX_SETUP
  16. # By default, setup.py will look for libsepol.a in the host machines
  17. # /usr/lib directory. This needs to be changed to the staging directory.
  18. $(SED) "s@lib_dirs =.*@lib_dirs = ['$(STAGING_DIR)/usr/lib']@g" \
  19. $(@D)/setup.py
  20. endef
  21. SETOOLS_POST_PATCH_HOOKS += SETOOLS_FIX_SETUP
  22. define HOST_SETOOLS_FIX_SETUP
  23. # By default, setup.py will look for libsepol.a in the host machines
  24. # /usr/lib directory. This needs to be changed to the host directory.
  25. $(SED) "s@lib_dirs =.*@lib_dirs = ['$(HOST_DIR)/lib']@g" \
  26. $(@D)/setup.py
  27. endef
  28. HOST_SETOOLS_POST_PATCH_HOOKS += HOST_SETOOLS_FIX_SETUP
  29. # apol requires pyqt5. However, the setools installation
  30. # process will install apol even if pyqt5 is missing.
  31. # Remove these scripts from the target it pyqt5 is not selected.
  32. ifeq ($(BR2_PACKAGE_PYTHON_PYQT5),)
  33. define SETOOLS_REMOVE_QT_SCRIPTS
  34. $(RM) $(TARGET_DIR)/usr/bin/apol
  35. $(RM) -r $(TARGET_DIR)/lib/python$(PYTHON3_VERSION_MAJOR)/site-packages/setoolsgui/
  36. endef
  37. SETOOLS_POST_INSTALL_TARGET_HOOKS += SETOOLS_REMOVE_QT_SCRIPTS
  38. endif
  39. # pyqt5 is not a host-package, remove apol from the host directory.
  40. define HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS
  41. $(RM) $(HOST_DIR)/bin/apol
  42. endef
  43. HOST_SETOOLS_POST_INSTALL_HOOKS += HOST_SETOOLS_REMOVE_BROKEN_SCRIPTS
  44. $(eval $(python-package))
  45. $(eval $(host-python-package))