kernel: properly condition EM919x patch
[openwrt/openwrt.git] / package / libs / wolfssl / Makefile
1 #
2 # Copyright (C) 2006-2017 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:=wolfssl
11 PKG_VERSION:=5.4.0-stable
12 PKG_RELEASE:=$(AUTORELEASE)
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=https://github.com/wolfSSL/wolfssl/archive/v$(PKG_VERSION)
16 PKG_HASH:=dc36cc19dad197253e5c2ecaa490c7eef579ad448706e55d73d79396e814098b
17
18 PKG_FIXUP:=libtool libtool-abiver
19 PKG_INSTALL:=1
20 PKG_USE_MIPS16:=0
21 PKG_BUILD_PARALLEL:=1
22 PKG_LICENSE:=GPL-2.0-or-later
23 PKG_LICENSE_FILES:=LICENSING COPYING
24 PKG_MAINTAINER:=Eneas U de Queiroz <cotequeiroz@gmail.com>
25 PKG_CPE_ID:=cpe:/a:wolfssl:wolfssl
26
27 PKG_CONFIG_DEPENDS:=\
28 CONFIG_WOLFSSL_HAS_AES_CCM \
29 CONFIG_WOLFSSL_HAS_ARC4 \
30 CONFIG_WOLFSSL_HAS_CERTGEN \
31 CONFIG_WOLFSSL_HAS_CHACHA_POLY \
32 CONFIG_WOLFSSL_HAS_DH \
33 CONFIG_WOLFSSL_HAS_DTLS \
34 CONFIG_WOLFSSL_HAS_ECC25519 \
35 CONFIG_WOLFSSL_HAS_ECC448 \
36 CONFIG_WOLFSSL_HAS_OCSP \
37 CONFIG_WOLFSSL_HAS_OPENVPN CONFIG_WOLFSSL_ALT_NAMES \
38 CONFIG_WOLFSSL_HAS_SESSION_TICKET \
39 CONFIG_WOLFSSL_HAS_TLSV10 \
40 CONFIG_WOLFSSL_HAS_TLSV13 \
41 CONFIG_WOLFSSL_HAS_WPAS
42
43 PKG_ABI_VERSION:=$(patsubst %-stable,%,$(PKG_VERSION)).$(call version_abbrev,$(call confvar,$(PKG_CONFIG_DEPENDS)))
44
45 PKG_CONFIG_DEPENDS+=\
46 CONFIG_WOLFSSL_HAS_AFALG \
47 CONFIG_WOLFSSL_HAS_CPU_CRYPTO \
48 CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES \
49 CONFIG_WOLFSSL_HAS_DEVCRYPTO_CBC \
50 CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL
51
52 include $(INCLUDE_DIR)/package.mk
53
54 define Package/libwolfssl/Default
55 SECTION:=libs
56 SUBMENU:=SSL
57 CATEGORY:=Libraries
58 URL:=http://www.wolfssl.com/
59 endef
60
61 define Package/libwolfssl
62 $(call Package/libwolfssl/Default)
63 TITLE:=wolfSSL library
64 MENU:=1
65 PROVIDES:=libcyassl
66 DEPENDS:=+WOLFSSL_HAS_DEVCRYPTO:kmod-cryptodev +WOLFSSL_HAS_AFALG:kmod-crypto-user
67 ABI_VERSION:=$(PKG_ABI_VERSION)
68 endef
69
70 define Package/libwolfssl/description
71 wolfSSL (formerly CyaSSL) is an SSL library optimized for small
72 footprint, both on disk and for memory use.
73 endef
74
75 define Package/libwolfssl/config
76 source "$(SOURCE)/Config.in"
77 endef
78
79 define Package/libwolfssl-benchmark
80 $(call Package/libwolfssl/Default)
81 TITLE:=wolfSSL Benchmark Utility
82 DEPENDS:=libwolfssl
83 endef
84
85 define Package/libwolfssl-benchmark/description
86 This is the wolfssl benchmark utility.
87 endef
88
89 TARGET_CFLAGS += \
90 $(FPIC) \
91 -fomit-frame-pointer \
92 -flto \
93 -DFP_MAX_BITS=8192 \
94 $(if $(CONFIG_WOLFSSL_ALT_NAMES),-DWOLFSSL_ALT_NAMES)
95
96 TARGET_LDFLAGS += -flto
97
98 # --enable-stunnel needed for OpenSSL API compatibility bits
99 CONFIGURE_ARGS += \
100 --enable-reproducible-build \
101 --enable-lighty \
102 --enable-opensslall \
103 --enable-opensslextra \
104 --enable-sni \
105 --enable-stunnel \
106 --enable-altcertchains \
107 --$(if $(CONFIG_PACKAGE_libwolfssl-benchmark),enable,disable)-crypttests \
108 --disable-examples \
109 --disable-jobserver \
110 --$(if $(CONFIG_IPV6),enable,disable)-ipv6 \
111 --$(if $(CONFIG_WOLFSSL_HAS_AES_CCM),enable,disable)-aesccm \
112 --$(if $(CONFIG_WOLFSSL_HAS_CERTGEN),enable,disable)-certgen \
113 --$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-chacha \
114 --$(if $(CONFIG_WOLFSSL_HAS_CHACHA_POLY),enable,disable)-poly1305 \
115 --$(if $(CONFIG_WOLFSSL_HAS_DH),enable,disable)-dh \
116 --$(if $(CONFIG_WOLFSSL_HAS_ARC4),enable,disable)-arc4 \
117 --$(if $(CONFIG_WOLFSSL_HAS_TLSV10),enable,disable)-tlsv10 \
118 --$(if $(CONFIG_WOLFSSL_HAS_TLSV13),enable,disable)-tls13 \
119 --$(if $(CONFIG_WOLFSSL_HAS_SESSION_TICKET),enable,disable)-session-ticket \
120 --$(if $(CONFIG_WOLFSSL_HAS_DTLS),enable,disable)-dtls \
121 --$(if $(CONFIG_WOLFSSL_HAS_ECC25519),enable,disable)-curve25519 \
122 --$(if $(CONFIG_WOLFSSL_HAS_ECC448),enable,disable)-curve448 \
123 --$(if $(CONFIG_WOLFSSL_HAS_AFALG),enable,disable)-afalg \
124 --$(if $(CONFIG_WOLFSSL_HAS_OPENVPN),enable,disable)-openvpn \
125 --enable-devcrypto=$(if $(CONFIG_WOLFSSL_HAS_DEVCRYPTO_CBC),cbc\
126 ,$(if $(CONFIG_WOLFSSL_HAS_DEVCRYPTO_AES),aes\
127 ,$(if $(CONFIG_WOLFSSL_HAS_DEVCRYPTO_FULL),yes,no)))
128
129 ifeq ($(CONFIG_WOLFSSL_HAS_OCSP),y)
130 CONFIGURE_ARGS += \
131 --enable-ocsp --enable-ocspstapling --enable-ocspstapling2
132 endif
133
134 ifeq ($(CONFIG_WOLFSSL_HAS_WPAS),y)
135 CONFIGURE_ARGS += \
136 --enable-wpas --enable-fortress --enable-fastmath
137 endif
138
139 ifdef CONFIG_WOLFSSL_HAS_CPU_CRYPTO
140 ifdef CONFIG_aarch64
141 CONFIGURE_ARGS += --enable-armasm
142 TARGET_CFLAGS:=$(TARGET_CFLAGS:-mcpu%=-mcpu%+crypto)
143 else ifdef CONFIG_TARGET_x86_64
144 CONFIGURE_ARGS += --enable-intelasm
145 endif
146 endif
147
148 define Build/InstallDev
149 $(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
150 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
151
152 $(INSTALL_DIR) $(1)/usr/lib
153 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwolfssl.{so*,la} $(1)/usr/lib/
154 ln -s libwolfssl.so $(1)/usr/lib/libcyassl.so
155 ln -s libwolfssl.la $(1)/usr/lib/libcyassl.la
156
157 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
158 endef
159
160 define Package/libwolfssl/install
161 $(INSTALL_DIR) $(1)/usr/lib
162 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwolfssl.so.* $(1)/usr/lib/
163 endef
164
165 define Package/libwolfssl-benchmark/install
166 $(INSTALL_DIR) $(1)/usr/bin
167 $(CP) $(PKG_BUILD_DIR)/wolfcrypt/benchmark/.libs/benchmark $(1)/usr/bin/wolfssl-benchmark
168 endef
169
170 $(eval $(call BuildPackage,libwolfssl))
171 $(eval $(call BuildPackage,libwolfssl-benchmark))