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.

116 lines
3.3 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.43
  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:=512a0e5fc4c1e06d472a20da26aa96a9b9bf2a26b23f094f77f1b8da56cc427f
  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/sys/*.h $(1)/usr/include/sys/
  72. $(INSTALL_DIR) $(1)/usr/lib
  73. $(CP) $(PKG_INSTALL_DIR)/lib/libcap.{so*,a} $(1)/usr/lib/
  74. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/libpsx.a $(1)/usr/lib/
  75. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  76. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/pkgconfig/libcap.pc $(1)/usr/lib/pkgconfig/
  77. $(SED) 's,exec_prefix=,exec_prefix=/usr,g' $(1)/usr/lib/pkgconfig/libcap.pc
  78. $(SED) 's,/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libcap.pc
  79. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libcap.pc
  80. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/lib/pkgconfig/libpsx.pc $(1)/usr/lib/pkgconfig/
  81. $(SED) 's,exec_prefix=,exec_prefix=/usr,g' $(1)/usr/lib/pkgconfig/libpsx.pc
  82. $(SED) 's,/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libpsx.pc
  83. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libpsx.pc
  84. endef
  85. define Package/libcap/install
  86. $(INSTALL_DIR) $(1)/usr/lib
  87. $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
  88. endef
  89. define Package/libcap-bin/install
  90. $(INSTALL_DIR) $(1)/usr/sbin
  91. $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
  92. $(CP) $(PKG_INSTALL_DIR)/sbin/getcap $(1)/usr/sbin/
  93. $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps $(1)/usr/sbin/
  94. $(CP) $(PKG_INSTALL_DIR)/sbin/setcap $(1)/usr/sbin/
  95. endef
  96. $(eval $(call BuildPackage,libcap))
  97. $(eval $(call BuildPackage,libcap-bin))