1
0

Makefile 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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.28.7
  10. PKG_RELEASE:=2
  11. PKG_BUILD_FLAGS:=no-mips16 gc-sections no-lto
  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:=1df6073f0cf6a4e1953890bf5e0de2a8c7e6be50d6d6c69fa9fefcb1d14e981a
  15. PKG_LICENSE:=GPL-2.0-or-later
  16. PKG_LICENSE_FILES:=gpl-2.0.txt
  17. PKG_CPE_ID:=cpe:/a:arm:mbed_tls
  18. MBEDTLS_BUILD_OPTS_CURVES= \
  19. CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED \
  20. CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED \
  21. CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED \
  22. CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED \
  23. CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED \
  24. CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED \
  25. CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED \
  26. CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED \
  27. CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED \
  28. CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED \
  29. CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED \
  30. CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED \
  31. CONFIG_MBEDTLS_ECP_DP_CURVE448_ENABLED
  32. MBEDTLS_BUILD_OPTS_CIPHERS= \
  33. CONFIG_MBEDTLS_AES_C \
  34. CONFIG_MBEDTLS_CAMELLIA_C \
  35. CONFIG_MBEDTLS_CCM_C \
  36. CONFIG_MBEDTLS_CMAC_C \
  37. CONFIG_MBEDTLS_DES_C \
  38. CONFIG_MBEDTLS_GCM_C \
  39. CONFIG_MBEDTLS_KEY_EXCHANGE_PSK_ENABLED \
  40. CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED \
  41. CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED \
  42. CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED \
  43. CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_ENABLED \
  44. CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED \
  45. CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED \
  46. CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED \
  47. CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED \
  48. CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED \
  49. CONFIG_MBEDTLS_NIST_KW_C \
  50. CONFIG_MBEDTLS_RIPEMD160_C \
  51. CONFIG_MBEDTLS_RSA_NO_CRT \
  52. CONFIG_MBEDTLS_XTEA_C
  53. MBEDTLS_BUILD_OPTS= \
  54. $(MBEDTLS_BUILD_OPTS_CURVES) \
  55. $(MBEDTLS_BUILD_OPTS_CIPHERS) \
  56. CONFIG_MBEDTLS_CERTS_C \
  57. CONFIG_MBEDTLS_CIPHER_MODE_OFB \
  58. CONFIG_MBEDTLS_CIPHER_MODE_XTS \
  59. CONFIG_MBEDTLS_DEBUG_C \
  60. CONFIG_MBEDTLS_ENTROPY_FORCE_SHA256 \
  61. CONFIG_MBEDTLS_HKDF_C \
  62. CONFIG_MBEDTLS_PLATFORM_C \
  63. CONFIG_MBEDTLS_SELF_TEST \
  64. CONFIG_MBEDTLS_SSL_RENEGOTIATION \
  65. CONFIG_MBEDTLS_SSL_TRUNCATED_HMAC \
  66. CONFIG_MBEDTLS_VERSION_C \
  67. CONFIG_MBEDTLS_VERSION_FEATURES
  68. PKG_CONFIG_DEPENDS := $(MBEDTLS_BUILD_OPTS)
  69. include $(INCLUDE_DIR)/package.mk
  70. include $(INCLUDE_DIR)/cmake.mk
  71. define Package/mbedtls/Default
  72. TITLE:=Embedded SSL
  73. URL:=https://tls.mbed.org
  74. endef
  75. define Package/mbedtls/Default/description
  76. The aim of the mbedtls project is to provide a quality, open-source
  77. cryptographic library written in C and targeted at embedded systems.
  78. endef
  79. define Package/libmbedtls
  80. $(call Package/mbedtls/Default)
  81. SECTION:=libs
  82. CATEGORY:=Libraries
  83. SUBMENU:=SSL
  84. TITLE+= (library)
  85. ABI_VERSION:=12
  86. MENU:=1
  87. endef
  88. define Package/libmbedtls/config
  89. source "$(SOURCE)/Config.in"
  90. endef
  91. define Package/mbedtls-util
  92. $(call Package/mbedtls/Default)
  93. SECTION:=utils
  94. CATEGORY:=Utilities
  95. TITLE+= (utilities)
  96. DEPENDS:=+libmbedtls
  97. endef
  98. define Package/libmbedtls/description
  99. $(call Package/mbedtls/Default/description)
  100. This package contains the mbedtls library.
  101. endef
  102. define Package/mbedtls-util/description
  103. $(call Package/mbedtls/Default/description)
  104. This package contains mbedtls helper programs for private key and
  105. CSR generation (gen_key, cert_req)
  106. endef
  107. TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
  108. CMAKE_OPTIONS += \
  109. -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
  110. -DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \
  111. -DENABLE_TESTING:Bool=OFF \
  112. -DENABLE_PROGRAMS:Bool=ON
  113. define Build/Prepare
  114. $(call Build/Prepare/Default)
  115. $(if $(strip $(foreach opt,$(MBEDTLS_BUILD_OPTS),$($(opt)))),
  116. $(foreach opt,$(MBEDTLS_BUILD_OPTS),
  117. $(PKG_BUILD_DIR)/scripts/config.py \
  118. -f $(PKG_BUILD_DIR)/include/mbedtls/config.h \
  119. $(if $($(opt)),set,unset) $(patsubst CONFIG_%,%,$(opt))),)
  120. endef
  121. define Build/InstallDev
  122. $(INSTALL_DIR) $(1)/usr/include
  123. $(CP) $(PKG_INSTALL_DIR)/usr/include/mbedtls $(1)/usr/include/
  124. $(INSTALL_DIR) $(1)/usr/lib
  125. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/
  126. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.a $(1)/usr/lib/
  127. endef
  128. define Package/libmbedtls/install
  129. $(INSTALL_DIR) $(1)/usr/lib
  130. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
  131. endef
  132. define Package/mbedtls-util/install
  133. $(INSTALL_DIR) $(1)/usr/bin
  134. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gen_key $(1)/usr/bin/
  135. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cert_req $(1)/usr/bin/
  136. endef
  137. $(eval $(call BuildPackage,libmbedtls))
  138. $(eval $(call BuildPackage,mbedtls-util))