kernel: bump 5.4 to 5.4.33
[openwrt/openwrt.git] / package / libs / mbedtls / Makefile
1 #
2 # Copyright (C) 2011-2015 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=mbedtls
11 PKG_VERSION:=2.16.5
12 PKG_RELEASE:=1
13 PKG_USE_MIPS16:=0
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-gpl.tgz
16 PKG_SOURCE_URL:=https://tls.mbed.org/download/
17 PKG_HASH:=6ebdea6565c714f1315b9af6a802afb4b4e89976f7d5d2b15aa8028eb52e7d09
18
19 PKG_BUILD_PARALLEL:=1
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
23
24 PKG_CONFIG_DEPENDS:=CONFIG_LIBMBEDTLS_DEBUG_C
25
26 include $(INCLUDE_DIR)/package.mk
27 include $(INCLUDE_DIR)/cmake.mk
28
29 define Package/mbedtls/Default
30 TITLE:=Embedded SSL
31 URL:=https://tls.mbed.org
32 endef
33
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.
37 endef
38
39 define Package/libmbedtls
40 $(call Package/mbedtls/Default)
41 SECTION:=libs
42 CATEGORY:=Libraries
43 SUBMENU:=SSL
44 TITLE+= (library)
45 ABI_VERSION:=12
46 endef
47
48 define Package/libmbedtls/config
49 config LIBMBEDTLS_DEBUG_C
50 depends on PACKAGE_libmbedtls
51 bool "Enable debug functions"
52 default n
53 help
54 This option enables mbedtls library's debug functions.
55
56 It increases the uncompressed libmbedtls binary size
57 by around 60 KiB (for an ARMv5 platform).
58
59 Usually, you don't need this, so don't select this if you're unsure.
60 endef
61
62 define Package/mbedtls-util
63 $(call Package/mbedtls/Default)
64 SECTION:=utils
65 CATEGORY:=Utilities
66 TITLE+= (utilities)
67 DEPENDS:=+libmbedtls
68 endef
69
70 define Package/libmbedtls/description
71 $(call Package/mbedtls/Default/description)
72 This package contains the mbedtls library.
73 endef
74
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)
79 endef
80
81 PKG_INSTALL:=1
82
83 TARGET_CFLAGS += -ffunction-sections -fdata-sections
84 TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS))
85
86 CMAKE_OPTIONS += \
87 -DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \
88 -DENABLE_TESTING:Bool=OFF \
89 -DENABLE_PROGRAMS:Bool=ON
90
91 define Build/Configure
92 $(Build/Configure/Default)
93
94 awk 'BEGIN { rc = 1 } \
95 /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \
96 { print } \
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
100 endef
101
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/
108 endef
109
110 define Package/libmbedtls/install
111 $(INSTALL_DIR) $(1)/usr/lib
112 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/
113 endef
114
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/
119 endef
120
121 $(eval $(call BuildPackage,libmbedtls))
122 $(eval $(call BuildPackage,mbedtls-util))