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.

93 lines
2.5 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.27
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  12. PKG_SOURCE_URL:=@KERNEL/linux/libs/security/linux-privs/libcap2
  13. PKG_HASH:=dac1792d0118bee6aae6ba7fb93ff1602c6a9bda812fd63916eee1435b9c486a
  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. $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
  61. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  62. $(SED) 's,exec_prefix=,exec_prefix=/usr,g' $(1)/usr/lib/pkgconfig/libcap.pc
  63. $(SED) 's,/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libcap.pc
  64. $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libcap.pc
  65. endef
  66. define Package/libcap/install
  67. $(INSTALL_DIR) $(1)/usr/lib
  68. $(CP) $(PKG_INSTALL_DIR)/lib/libcap.so* $(1)/usr/lib/
  69. ifneq ($(CONFIG_PACKAGE_libcap-bin),)
  70. $(INSTALL_DIR) $(1)/usr/sbin
  71. $(CP) $(PKG_INSTALL_DIR)/sbin/capsh $(1)/usr/sbin/
  72. $(CP) $(PKG_INSTALL_DIR)/sbin/getcap $(1)/usr/sbin/
  73. $(CP) $(PKG_INSTALL_DIR)/sbin/getpcaps $(1)/usr/sbin/
  74. $(CP) $(PKG_INSTALL_DIR)/sbin/setcap $(1)/usr/sbin/
  75. endif
  76. endef
  77. $(eval $(call BuildPackage,libcap))