Makefile 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #
  2. # Copyright (C) 2011-2015 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:=mbedtls
  9. PKG_VERSION:=2.16.1
  10. PKG_RELEASE:=1
  11. PKG_USE_MIPS16:=0
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz
  13. PKG_SOURCE_URL:=https://tls.mbed.org/download/
  14. PKG_HASH:=7ab76eaefab0b02f26ca889230d553facb2598f3a8f077886c41ec1801d2131a
  15. PKG_BUILD_PARALLEL:=1
  16. PKG_LICENSE:=GPL-2.0+
  17. PKG_CPE_ID:=cpe:/a:arm:mbed_tls
  18. PKG_CONFIG_DEPENDS:=CONFIG_LIBMBEDTLS_DEBUG_C
  19. include $(INCLUDE_DIR)/package.mk
  20. include $(INCLUDE_DIR)/cmake.mk
  21. define Package/mbedtls/Default
  22. TITLE:=Embedded SSL
  23. URL:=https://tls.mbed.org
  24. endef
  25. define Package/mbedtls/Default/description
  26. The aim of the mbedtls project is to provide a quality, open-source
  27. cryptographic library written in C and targeted at embedded systems.
  28. endef
  29. define Package/libmbedtls
  30. $(call Package/mbedtls/Default)
  31. SECTION:=libs
  32. CATEGORY:=Libraries
  33. SUBMENU:=SSL
  34. TITLE+= (library)
  35. ABI_VERSION:=12
  36. endef
  37. define Package/libmbedtls/config
  38. config LIBMBEDTLS_DEBUG_C
  39. depends on PACKAGE_libmbedtls
  40. bool "Enable debug functions"
  41. default n
  42. help
  43. This option enables mbedtls library's debug functions.
  44. It increases the uncompressed libmbedtls binary size
  45. by around 60 KiB (for an ARMv5 platform).
  46. Usually, you don't need this, so don't select this if you're unsure.
  47. endef
  48. define Package/mbedtls-util
  49. $(call Package/mbedtls/Default)
  50. SECTION:=utils
  51. CATEGORY:=Utilities
  52. TITLE+= (utilities)
  53. DEPENDS:=+libmbedtls
  54. endef
  55. define Package/libmbedtls/description
  56. $(call Package/mbedtls/Default/description)
  57. This package contains the mbedtls library.
  58. endef
  59. define Package/mbedtls-util/description
  60. $(call Package/mbedtls/Default/description)
  61. This package contains mbedtls helper programs for private key and
  62. CSR generation (gen_key, cert_req)
  63. endef
  64. PKG_INSTALL:=1
  65. TARGET_CFLAGS += -ffunction-sections -fdata-sections
  66. TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
  67. CMAKE_OPTIONS += \
  68. -DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \
  69. -DENABLE_TESTING:Bool=OFF \
  70. -DENABLE_PROGRAMS:Bool=ON
  71. define Build/Configure
  72. $(Build/Configure/Default)
  73. awk 'BEGIN { rc = 1 } \
  74. /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
  75. { print } \
  76. END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \
  77. >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \
  78. mv $(PKG_BUILD_DIR)/include/mbedtls/config.h.new $(PKG_BUILD_DIR)/include/mbedtls/config.h
  79. endef
  80. define Build/InstallDev
  81. $(INSTALL_DIR) $(1)/usr/include
  82. $(CP) $(PKG_INSTALL_DIR)/usr/include/mbedtls $(1)/usr/include/
  83. $(INSTALL_DIR) $(1)/usr/lib
  84. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
  85. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.a $(1)/usr/lib/
  86. endef
  87. define Package/libmbedtls/install
  88. $(INSTALL_DIR) $(1)/usr/lib
  89. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
  90. endef
  91. define Package/mbedtls-util/install
  92. $(INSTALL_DIR) $(1)/usr/bin
  93. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gen_key $(1)/usr/bin/
  94. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cert_req $(1)/usr/bin/
  95. endef
  96. $(eval $(call BuildPackage,libmbedtls))
  97. $(eval $(call BuildPackage,mbedtls-util))