1
0

Makefile 3.3 KB

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