2 # Copyright (C) 2011-2015 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
15 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
)-gpl.tgz
16 PKG_SOURCE_URL
:=https
://tls.mbed.org
/download
/
17 PKG_HASH
:=6ebdea6565c714f1315b9af6a802afb4b4e89976f7d5d2b15aa8028eb52e7d09
20 PKG_LICENSE
:=GPL-2.0
-or-later
21 PKG_LICENSE_FILES
:=gpl-2.0.txt
22 PKG_CPE_ID
:=cpe
:/a
:arm
:mbed_tls
24 PKG_CONFIG_DEPENDS
:=CONFIG_LIBMBEDTLS_DEBUG_C
26 include $(INCLUDE_DIR
)/package.mk
27 include $(INCLUDE_DIR
)/cmake.mk
29 define Package
/mbedtls
/Default
31 URL
:=https
://tls.mbed.org
34 define Package
/mbedtls
/Default
/description
35 The aim of the mbedtls project is to provide a quality
, open-source
36 cryptographic library written in C and targeted at embedded systems.
39 define Package
/libmbedtls
40 $(call Package
/mbedtls
/Default
)
48 define Package
/libmbedtls
/config
49 config LIBMBEDTLS_DEBUG_C
50 depends on PACKAGE_libmbedtls
51 bool
"Enable debug functions"
54 This option enables mbedtls library
's debug functions.
56 It increases the uncompressed libmbedtls binary size
57 by around 60 KiB (for an ARMv5 platform).
59 Usually, you don't need this
, so don
't select this if you're unsure.
62 define Package
/mbedtls-util
63 $(call Package
/mbedtls
/Default
)
70 define Package
/libmbedtls
/description
71 $(call Package
/mbedtls
/Default
/description
)
72 This package contains the mbedtls library.
75 define Package
/mbedtls-util
/description
76 $(call Package
/mbedtls
/Default
/description
)
77 This package contains mbedtls helper programs for private key and
78 CSR generation
(gen_key
, cert_req
)
83 TARGET_CFLAGS
+= -ffunction-sections
-fdata-sections
84 TARGET_CFLAGS
:= $(filter-out -O
%,$(TARGET_CFLAGS
))
87 -DUSE_SHARED_MBEDTLS_LIBRARY
:Bool
=ON \
88 -DENABLE_TESTING
:Bool
=OFF \
89 -DENABLE_PROGRAMS
:Bool
=ON
91 define Build
/Configure
92 $(Build
/Configure
/Default
)
94 awk
'BEGIN { rc = 1 } \
95 /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
97 END { exit(rc) }' $(PKG_BUILD_DIR
)/include/mbedtls
/config.h \
98 >$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
&& \
99 mv
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h
102 define Build
/InstallDev
103 $(INSTALL_DIR
) $(1)/usr
/include
104 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/mbedtls
$(1)/usr
/include/
105 $(INSTALL_DIR
) $(1)/usr
/lib
106 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so
* $(1)/usr
/lib
/
107 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.a
$(1)/usr
/lib
/
110 define Package
/libmbedtls
/install
111 $(INSTALL_DIR
) $(1)/usr
/lib
112 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so.
* $(1)/usr
/lib
/
115 define Package
/mbedtls-util
/install
116 $(INSTALL_DIR
) $(1)/usr
/bin
117 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/gen_key
$(1)/usr
/bin
/
118 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/cert_req
$(1)/usr
/bin
/
121 $(eval
$(call BuildPackage
,libmbedtls
))
122 $(eval
$(call BuildPackage
,mbedtls-util
))