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
).
tar.gz
16 PKG_SOURCE_URL
:=https
://codeload.github.com
/ARMmbed
/mbedtls
/tar.gz
/v
$(PKG_VERSION
)?
17 PKG_HASH
:=c18e7e9abf95e69e425260493720470021384a1728417042060a35d0b7b18b41
21 PKG_CPE_ID
:=cpe
:/a
:arm
:mbed_tls
23 PKG_CONFIG_DEPENDS
:=CONFIG_LIBMBEDTLS_DEBUG_C
25 include $(INCLUDE_DIR
)/package.mk
26 include $(INCLUDE_DIR
)/cmake.mk
28 define Package
/mbedtls
/Default
30 URL
:=https
://tls.mbed.org
33 define Package
/mbedtls
/Default
/description
34 The aim of the mbedtls project is to provide a quality
, open-source
35 cryptographic library written in C and targeted at embedded systems.
38 define Package
/libmbedtls
39 $(call Package
/mbedtls
/Default
)
47 define Package
/libmbedtls
/config
48 config LIBMBEDTLS_DEBUG_C
49 depends on PACKAGE_libmbedtls
50 bool
"Enable debug functions"
53 This option enables mbedtls library
's debug functions.
55 It increases the uncompressed libmbedtls binary size
56 by around 60 KiB (for an ARMv5 platform).
58 Usually, you don't need this
, so don
't select this if you're unsure.
61 define Package
/mbedtls-util
62 $(call Package
/mbedtls
/Default
)
69 define Package
/libmbedtls
/description
70 $(call Package
/mbedtls
/Default
/description
)
71 This package contains the mbedtls library.
74 define Package
/mbedtls-util
/description
75 $(call Package
/mbedtls
/Default
/description
)
76 This package contains mbedtls helper programs for private key and
77 CSR generation
(gen_key
, cert_req
)
82 TARGET_CFLAGS
+= -ffunction-sections
-fdata-sections
83 TARGET_CFLAGS
:= $(filter-out -O
%,$(TARGET_CFLAGS
))
86 -DUSE_SHARED_MBEDTLS_LIBRARY
:Bool
=ON \
87 -DENABLE_TESTING
:Bool
=OFF \
88 -DENABLE_PROGRAMS
:Bool
=ON
90 define Build
/Configure
91 $(Build
/Configure
/Default
)
93 awk
'BEGIN { rc = 1 } \
94 /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
96 END { exit(rc) }' $(PKG_BUILD_DIR
)/include/mbedtls
/config.h \
97 >$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
&& \
98 mv
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h.new
$(PKG_BUILD_DIR
)/include/mbedtls
/config.h
101 define Build
/InstallDev
102 $(INSTALL_DIR
) $(1)/usr
/include
103 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/mbedtls
$(1)/usr
/include/
104 $(INSTALL_DIR
) $(1)/usr
/lib
105 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so
* $(1)/usr
/lib
/
106 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.a
$(1)/usr
/lib
/
109 define Package
/libmbedtls
/install
110 $(INSTALL_DIR
) $(1)/usr
/lib
111 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
*.so.
* $(1)/usr
/lib
/
114 define Package
/mbedtls-util
/install
115 $(INSTALL_DIR
) $(1)/usr
/bin
116 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/gen_key
$(1)/usr
/bin
/
117 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/cert_req
$(1)/usr
/bin
/
120 $(eval
$(call BuildPackage
,libmbedtls
))
121 $(eval
$(call BuildPackage
,mbedtls-util
))