Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 1 | ################################################################################ |
| 2 | # |
| 3 | # mbedtls |
| 4 | # |
| 5 | ################################################################################ |
| 6 | |
| 7 | MBEDTLS_SITE = https://tls.mbed.org/code/releases |
Fabrice Fontaine | 848221b | 2019-01-29 21:27:35 +0100 | [diff] [blame] | 8 | MBEDTLS_VERSION = 2.7.9 |
Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 9 | MBEDTLS_SOURCE = mbedtls-$(MBEDTLS_VERSION)-apache.tgz |
| 10 | MBEDTLS_CONF_OPTS = \ |
| 11 | -DENABLE_PROGRAMS=$(if $(BR2_PACKAGE_MBEDTLS_PROGRAMS),ON,OFF) \ |
| 12 | -DENABLE_TESTING=OFF |
| 13 | MBEDTLS_INSTALL_STAGING = YES |
| 14 | MBEDTLS_LICENSE = Apache-2.0 |
| 15 | MBEDTLS_LICENSE_FILES = apache-2.0.txt |
| 16 | |
| 17 | # This is mandatory for hiawatha |
| 18 | ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) |
| 19 | define 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 |
| 24 | endef |
| 25 | MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_THREADING |
Baruch Siach | 115e5ae | 2016-04-12 21:46:00 +0300 | [diff] [blame] | 26 | ifeq ($(BR2_STATIC_LIBS),y) |
| 27 | MBEDTLS_CONF_OPTS += -DLINK_WITH_PTHREAD=ON |
| 28 | endif |
Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 29 | endif |
| 30 | |
| 31 | ifeq ($(BR2_STATIC_LIBS),y) |
| 32 | MBEDTLS_CONF_OPTS += \ |
| 33 | -DUSE_SHARED_MBEDTLS_LIBRARY=OFF -DUSE_STATIC_MBEDTLS_LIBRARY=ON |
| 34 | else ifeq ($(BR2_SHARED_STATIC_LIBS),y) |
| 35 | MBEDTLS_CONF_OPTS += \ |
| 36 | -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=ON |
| 37 | else ifeq ($(BR2_SHARED_LIBS),y) |
| 38 | MBEDTLS_CONF_OPTS += \ |
| 39 | -DUSE_SHARED_MBEDTLS_LIBRARY=ON -DUSE_STATIC_MBEDTLS_LIBRARY=OFF |
| 40 | endif |
| 41 | |
Jörg Krause | 896ae3f | 2017-02-06 21:01:23 +0100 | [diff] [blame] | 42 | ifeq ($(BR2_PACKAGE_MBEDTLS_COMPRESSION),y) |
Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 43 | MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=ON |
| 44 | MBEDTLS_DEPENDENCIES += zlib |
Jörg Krause | c1a7796 | 2017-01-29 22:15:11 +0100 | [diff] [blame] | 45 | define MBEDTLS_ENABLE_ZLIB |
| 46 | $(SED) "s://#define MBEDTLS_ZLIB_SUPPORT:#define MBEDTLS_ZLIB_SUPPORT:" \ |
| 47 | $(@D)/include/mbedtls/config.h |
| 48 | endef |
| 49 | MBEDTLS_POST_PATCH_HOOKS += MBEDTLS_ENABLE_ZLIB |
Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 50 | else |
| 51 | MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=OFF |
| 52 | endif |
| 53 | |
Gustavo Zacarias | a794e7f | 2015-12-30 09:07:03 -0300 | [diff] [blame] | 54 | define 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 |
| 61 | endef |
| 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 |
| 66 | ifeq ($(BR2_ENABLE_DEBUG)$(BR2_ARM_INSTRUCTIONS_THUMB)$(BR2_ARM_INSTRUCTIONS_THUMB2),yy) |
| 67 | MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM |
Vicente Olivert Riera | 45c92c6 | 2016-09-30 10:36:49 +0100 | [diff] [blame] | 68 | else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y) |
Gustavo Zacarias | a794e7f | 2015-12-30 09:07:03 -0300 | [diff] [blame] | 69 | MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM |
| 70 | endif |
| 71 | |
Gustavo Zacarias | 6b2df7e | 2015-12-29 12:03:07 -0300 | [diff] [blame] | 72 | $(eval $(cmake-package)) |