You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
2.2 KiB

  1. #
  2. # Copyright (C) 2011 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=libcap
  9. PKG_VERSION:=2.26
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
  13. PKG_HASH:=b630b7c484271b3ba867680d6a14b10a86cfa67247a14631b14c06731d5a458b
  14. PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at>
  15. PKG_LICENSE:=GPL-2.0
  16. PKG_LICENSE_FILES:=License
  17. PKG_INSTALL:=1
  18. include $(INCLUDE_DIR)/package.mk
  19. include $(INCLUDE_DIR)/kernel.mk
  20. define Package/libcap
  21. TITLE:=Linux capabilities library
  22. SECTION:=libs
  23. CATEGORY:=Libraries
  24. URL:=https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
  25. endef
  26. define Package/libcap/config
  27. if PACKAGE_libcap
  28. config PACKAGE_libcap-bin
  29. bool "install libcap executables"
  30. help
  31. Install capsh, getcap, getpcaps, setcap into the target image.
  32. default n
  33. config PACKAGE_libcap-bin-capsh-shell
  34. string "capsh shell"
  35. depends on PACKAGE_libcap-bin
  36. help
  37. Set the capsh shell.
  38. default "/bin/sh"
  39. endif
  40. endef
  41. MAKE_FLAGS += \
  42. BUILD_CC="$(CC)" \
  43. BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
  44. CFLAGS="$(TARGET_CFLAGS)" \
  45. LD="$(TARGET_CC) -Wl,-x -shared" \
  46. LDFLAGS="$(TARGET_LDFLAGS)" \
  47. INDENT="| true" \
  48. PAM_CAP="no" \
  49. RAISE_SETFCAP="no" \
  50. DYNAMIC="yes" \
  51. lib="lib"
  52. ifneq ($(CONFIG_PACKAGE_libcap-bin-capsh-shell),)
  53. TARGET_CFLAGS += -DSHELL='\"$(CONFIG_PACKAGE_libcap-bin-capsh-shell)\"'
  54. endif
  55. define Build/InstallDev
  56. $(INSTALL_DIR) $(1)/usr/include/sys
  57. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  58. $(INSTALL_DIR) $(1)/usr/lib/
  59. $(CP) $(PKG_INSTALL_DIR)/lib/* $(1)/usr/lib/
  60. endef
  61. define Package/libcap/install
  62. $(INSTALL_DIR) $(1)/usr/lib
  63. $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
  64. ifneq ($(CONFIG_PACKAGE_libcap-bin),)
  65. $(INSTALL_DIR) $(1)/usr/sbin
  66. $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
  67. $(CP) $(PKG_INSTALL_DIR)/sbin/getcap $(1)/usr/sbin/
  68. $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps $(1)/usr/sbin/
  69. $(CP) $(PKG_INSTALL_DIR)/sbin/setcap $(1)/usr/sbin/
  70. endif
  71. endef
  72. $(eval $(call BuildPackage,libcap))