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.

111 lines
2.9 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.33
  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:=08edeaba2757021aeec45c4eeec52566675e0e0f5d4f057284d729e04f2643d6
  14. PKG_MAINTAINER:=Paul Wassi <p.wassi@gmx.at>
  15. PKG_LICENSE:=GPL-2.0-only
  16. PKG_LICENSE_FILES:=License
  17. PKG_INSTALL:=1
  18. PKG_BUILD_PARALLEL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/kernel.mk
  21. define Package/libcap/Default
  22. TITLE:=Linux capabilities library
  23. SECTION:=libs
  24. CATEGORY:=Libraries
  25. URL:=https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/
  26. endef
  27. define Package/libcap/description/Default
  28. Linux capabilities
  29. endef
  30. define Package/libcap
  31. $(call Package/libcap/Default)
  32. TITLE += library
  33. endef
  34. define Package/libcap-bin
  35. $(call Package/libcap/Default)
  36. TITLE += binaries
  37. DEPENDS += libcap
  38. endef
  39. define Package/libcap-bin/description
  40. $(call Package/libcap/description/Default)
  41. .
  42. This package contains the libcap utilities.
  43. endef
  44. define Package/libcap-bin/config
  45. if PACKAGE_libcap-bin
  46. config PACKAGE_libcap-bin-capsh-shell
  47. string "capsh shell"
  48. help
  49. Set the capsh shell.
  50. default "/bin/sh"
  51. endif
  52. endef
  53. MAKE_FLAGS += \
  54. BUILD_CC="$(CC)" \
  55. BUILD_CFLAGS="$(FPIC) -I$(PKG_BUILD_DIR)/libcap/include" \
  56. CFLAGS="$(TARGET_CFLAGS)" \
  57. LD="$(TARGET_CC) -Wl,-x -shared" \
  58. LDFLAGS="$(TARGET_LDFLAGS)" \
  59. INDENT="| true" \
  60. GOLANG="no" \
  61. PAM_CAP="no" \
  62. RAISE_SETFCAP="no" \
  63. DYNAMIC="yes" \
  64. lib="lib"
  65. ifneq ($(CONFIG_PACKAGE_libcap-bin-capsh-shell),)
  66. TARGET_CFLAGS += -DSHELL='\"$(CONFIG_PACKAGE_libcap-bin-capsh-shell)\"'
  67. endif
  68. TARGET_CFLAGS += $(if $(CONFIG_USE_MUSL),-Dpthread_yield=sched_yield)
  69. define Build/InstallDev
  70. $(INSTALL_DIR) $(1)/usr/include/sys
  71. $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
  72. $(INSTALL_DIR) $(1)/usr/lib
  73. $(CP) $(PKG_INSTALL_DIR)/lib/* $(1)/usr/lib/
  74. $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
  75. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  76. $(SED) 's,exec_prefix=,exec_prefix=/usr,g' $(1)/usr/lib/pkgconfig/libcap.pc
  77. $(SED) 's,/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libcap.pc
  78. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libcap.pc
  79. endef
  80. define Package/libcap/install
  81. $(INSTALL_DIR) $(1)/usr/lib
  82. $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
  83. endef
  84. define Package/libcap-bin/install
  85. $(INSTALL_DIR) $(1)/usr/sbin
  86. $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
  87. $(CP) $(PKG_INSTALL_DIR)/sbin/getcap $(1)/usr/sbin/
  88. $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps $(1)/usr/sbin/
  89. $(CP) $(PKG_INSTALL_DIR)/sbin/setcap $(1)/usr/sbin/
  90. endef
  91. $(eval $(call BuildPackage,libcap))
  92. $(eval $(call BuildPackage,libcap-bin))