package/mbedtls: fix zlib support
[buildroot-gz.git] / package / mbedtls / mbedtls.mk
blob7171af9f9830a4dc394e5ca932ac4fd3ee3bea48
1 ################################################################################
3 # mbedtls
5 ################################################################################
7 MBEDTLS_SITE = https://tls.mbed.org/code/releases
8 MBEDTLS_VERSION = 2.4.0
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
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
26 ifeq ($(BR2_STATIC_LIBS),y)
27 MBEDTLS_CONF_OPTS += -DLINK_WITH_PTHREAD=ON
28 endif
29 endif
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
42 ifeq ($(BR2_PACKAGE_ZLIB),y)
43 MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=ON
44 MBEDTLS_DEPENDENCIES += zlib
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
50 else
51 MBEDTLS_CONF_OPTS += -DENABLE_ZLIB_SUPPORT=OFF
52 endif
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
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
68 else ifeq ($(BR2_microblaze)$(BR2_MIPS_CPU_MIPS32R6)$(BR2_MIPS_CPU_MIPS64R6),y)
69 MBEDTLS_POST_CONFIGURE_HOOKS += MBEDTLS_DISABLE_ASM
70 endif
72 $(eval $(cmake-package))