blob: 4a5a731d42eac8634bab7ddebd4d0a81b2cba4d4 [file] [log] [blame]
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -03001################################################################################
2#
3# mbedtls
4#
5################################################################################
6
7MBEDTLS_SITE = https://tls.mbed.org/code/releases
Fabrice Fontaine848221b2019-01-29 21:27:35 +01008MBEDTLS_VERSION = 2.7.9
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -03009MBEDTLS_SOURCE = mbedtls-$(MBEDTLS_VERSION)-apache.tgz
10MBEDTLS_CONF_OPTS = \
11 -DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_MBEDTLS_PROGRAMS),ON,OFF) \
12 -DENABLE_TESTING=OFF
13MBEDTLS_INSTALL_STAGING = YES
14MBEDTLS_LICENSE = Apache-2.0
15MBEDTLS_LICENSE_FILES = apache-2.0.txt
16
17# This is mandatory for hiawatha
18ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
19define MBEDTLS_ENABLE_THREADING
20 $(SED) "s://#define MBEDTLS_THREADING_C:#define MBEDTLS_THREADING_C:" \
21 $(@D)/include/mbedtls/config.h
22 $(SED) "s://#define MBEDTLS_THREADING_PTHREAD:#define MBEDTLS_THREADING_PTHREAD:" \
23 $(@D)/include/mbedtls/config.h
24endef
25MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_THREADING
Baruch Siach115e5ae2016-04-12 21:46:00 +030026ifeq ($(BR2_STATIC_LIBS),y)
27MBEDTLS_CONF_OPTS += -DLINK_WITH_PTHREAD=ON
28endif
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -030029endif
30
31ifeq ($(BR2_STATIC_LIBS),y)
32MBEDTLS_CONF_OPTS += \
33 -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON
34else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
35MBEDTLS_CONF_OPTS += \
36 -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=ON
37else ifeq ($(BR2_SHARED_LIBS),y)
38MBEDTLS_CONF_OPTS += \
39 -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF
40endif
41
Jörg Krause896ae3f2017-02-06 21:01:23 +010042ifeq ($(BR2_PACKAGE_MBEDTLS_COMPRESSION),y)
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -030043MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=ON
44MBEDTLS_DEPENDENCIES += zlib
Jörg Krausec1a77962017-01-29 22:15:11 +010045define MBEDTLS_ENABLE_ZLIB
46 $(SED) "s://#define MBEDTLS_ZLIB_SUPPORT:#define MBEDTLS_ZLIB_SUPPORT:" \
47 $(@D)/include/mbedtls/config.h
48endef
49MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_ZLIB
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -030050else
51MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=OFF
52endif
53
Gustavo Zacariasa794e7f2015-12-30 09:07:03 -030054define MBEDTLS_DISABLE_ASM
55 $(SED) '/^#define MBEDTLS_AESNI_C/d' \
56 $(@D)/include/mbedtls/config.h
57 $(SED) '/^#define MBEDTLS_HAVE_ASM/d' \
58 $(@D)/include/mbedtls/config.h
59 $(SED) '/^#define MBEDTLS_PADLOCK_C/d' \
60 $(@D)/include/mbedtls/config.h
61endef
62
63# ARM in thumb mode breaks debugging with asm optimizations
64# Microblaze asm optimizations are broken in general
65# MIPS R6 asm is not yet supported
66ifeq ($(BR2_ENABLE_DEBUG)$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),yy)
67MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
Vicente Olivert Riera45c92c62016-09-30 10:36:49 +010068else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
Gustavo Zacariasa794e7f2015-12-30 09:07:03 -030069MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
70endif
71
Gustavo Zacarias6b2df7e2015-12-29 12:03:07 -030072$(eval $(cmake-package))