openssl: Remove J-PAKE. Nothing uses it.
[openwrt/staging/chunkeey.git] / package / libs / openssl / Makefile
1 #
2 # Copyright (C) 2006-2016 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:=openssl
11 PKG_BASE:=1.0.2
12 PKG_BUGFIX:=i
13 PKG_VERSION:=$(PKG_BASE)$(PKG_BUGFIX)
14 PKG_RELEASE:=1
15 PKG_USE_MIPS16:=0
16
17 PKG_BUILD_PARALLEL:=0
18
19
20 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
21 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
22 ftp://ftp.openssl.org/source/ \
23 http://www.openssl.org/source/old/$(PKG_BASE)/ \
24 ftp://ftp.funet.fi/pub/crypt/mirrors/ftp.openssl.org/source \
25 ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
26 PKG_MD5SUM:=9287487d11c9545b6efb287cdb70535d4e9b284dd10d51441d9b9963d000de6f
27
28 PKG_LICENSE:=OpenSSL
29 PKG_LICENSE_FILES:=LICENSE
30 PKG_CONFIG_DEPENDS:= \
31 CONFIG_OPENSSL_ENGINE_CRYPTO \
32 CONFIG_OPENSSL_ENGINE_DIGEST \
33 CONFIG_OPENSSL_WITH_EC \
34 CONFIG_OPENSSL_WITH_EC2M \
35 CONFIG_OPENSSL_WITH_SSL3 \
36 CONFIG_OPENSSL_HARDWARE_SUPPORT \
37 CONFIG_OPENSSL_WITH_DEPRECATED \
38 CONFIG_OPENSSL_WITH_COMPRESSION \
39 CONFIG_OPENSSL_WITH_NPN \
40 CONFIG_OPENSSL_WITH_PSK \
41 CONFIG_OPENSSL_WITH_SRP
42
43 include $(INCLUDE_DIR)/package.mk
44
45 ifneq ($(CONFIG_CCACHE),)
46 HOSTCC=$(HOSTCC_NOCACHE)
47 HOSTCXX=$(HOSTCXX_NOCACHE)
48 endif
49
50 define Package/openssl/Default
51 TITLE:=Open source SSL toolkit
52 URL:=http://www.openssl.org/
53 endef
54
55 define Package/libopenssl/config
56 source "$(SOURCE)/Config.in"
57 endef
58
59 define Package/openssl/Default/description
60 The OpenSSL Project is a collaborative effort to develop a robust,
61 commercial-grade, full-featured, and Open Source toolkit implementing the Secure
62 Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well
63 as a full-strength general purpose cryptography library.
64 endef
65
66 define Package/libopenssl
67 $(call Package/openssl/Default)
68 SECTION:=libs
69 SUBMENU:=SSL
70 CATEGORY:=Libraries
71 DEPENDS:=+OPENSSL_WITH_COMPRESSION:zlib
72 TITLE+= (libraries)
73 ABI_VERSION:=$(PKG_VERSION)
74 MENU:=1
75 endef
76
77 define Package/libopenssl/description
78 $(call Package/openssl/Default/description)
79 This package contains the OpenSSL shared libraries, needed by other programs.
80 endef
81
82 define Package/openssl-util
83 $(call Package/openssl/Default)
84 SECTION:=utils
85 CATEGORY:=Utilities
86 DEPENDS:=+libopenssl
87 TITLE+= (utility)
88 endef
89
90 define Package/openssl-util/conffiles
91 /etc/ssl/openssl.cnf
92 endef
93
94 define Package/openssl-util/description
95 $(call Package/openssl/Default/description)
96 This package contains the OpenSSL command-line utility.
97 endef
98
99
100 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
101 no-whrlpool no-whirlpool no-seed no-jpake
102 OPENSSL_OPTIONS:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
103
104 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
105 OPENSSL_OPTIONS += -DHAVE_CRYPTODEV
106 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
107 OPENSSL_OPTIONS += -DUSE_CRYPTODEV_DIGESTS
108 endif
109 else
110 OPENSSL_OPTIONS += no-engines
111 endif
112
113 ifndef CONFIG_OPENSSL_WITH_EC
114 OPENSSL_OPTIONS += no-ec
115 endif
116
117 ifndef CONFIG_OPENSSL_WITH_EC2M
118 OPENSSL_OPTIONS += no-ec2m
119 endif
120
121 ifndef CONFIG_OPENSSL_WITH_SSL3
122 OPENSSL_OPTIONS += no-ssl3 no-ssl3-method
123 endif
124
125 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
126 OPENSSL_OPTIONS += no-hw
127 endif
128
129 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
130 OPENSSL_OPTIONS += no-deprecated
131 endif
132
133 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
134 OPENSSL_OPTIONS += zlib-dynamic
135 else
136 OPENSSL_OPTIONS += no-comp
137 endif
138
139 ifndef CONFIG_OPENSSL_WITH_NPN
140 OPENSSL_OPTIONS += no-nextprotoneg
141 endif
142
143 ifndef CONFIG_OPENSSL_WITH_PSK
144 OPENSSL_OPTIONS += no-psk
145 endif
146
147 ifndef CONFIG_OPENSSL_WITH_SRP
148 OPENSSL_OPTIONS += no-srp
149 endif
150
151 ifeq ($(CONFIG_x86_64),y)
152 OPENSSL_TARGET:=linux-x86_64-openwrt
153 OPENSSL_MAKEFLAGS += LIBDIR=lib
154 else
155 OPENSSL_OPTIONS+=no-sse2
156 ifeq ($(CONFIG_mips)$(CONFIG_mipsel),y)
157 OPENSSL_TARGET:=linux-mips-openwrt
158 else ifeq ($(CONFIG_arm)$(CONFIG_armeb),y)
159 OPENSSL_TARGET:=linux-armv4-openwrt
160 else
161 OPENSSL_TARGET:=linux-generic-openwrt
162 OPENSSL_OPTIONS+=no-perlasm
163 endif
164 endif
165
166 STAMP_CONFIGURED := $(STAMP_CONFIGURED)_$(subst $(space),_,$(OPENSSL_OPTIONS))
167
168 define Build/Configure
169 [ -f $(STAMP_CONFIGURED) ] || { \
170 rm -f $(PKG_BUILD_DIR)/*.so.* $(PKG_BUILD_DIR)/*.a; \
171 find $(PKG_BUILD_DIR) -name \*.o | xargs rm -f; \
172 }
173 (cd $(PKG_BUILD_DIR); \
174 ./Configure $(OPENSSL_TARGET) \
175 --prefix=/usr \
176 --openssldir=/etc/ssl \
177 $(TARGET_CPPFLAGS) \
178 $(TARGET_LDFLAGS) -ldl \
179 -DOPENSSL_SMALL_FOOTPRINT \
180 $(OPENSSL_NO_CIPHERS) \
181 $(OPENSSL_OPTIONS) \
182 )
183 # XXX: OpenSSL "make depend" will look for installed headers before its own,
184 # so remove installed stuff first
185 -$(SUBMAKE) -j1 clean-staging
186 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
187 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
188 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
189 $(OPENSSL_MAKEFLAGS) \
190 depend
191 endef
192
193 TARGET_CFLAGS += $(FPIC) -I$(CURDIR)/include -ffunction-sections -fdata-sections
194 TARGET_LDFLAGS += -Wl,--gc-sections
195
196 define Build/Compile
197 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
198 CC="$(TARGET_CC)" \
199 ASFLAGS="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
200 AR="$(TARGET_CROSS)ar r" \
201 RANLIB="$(TARGET_CROSS)ranlib" \
202 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
203 $(OPENSSL_MAKEFLAGS) \
204 all
205 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
206 CC="$(TARGET_CC)" \
207 ASFLAGS="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
208 AR="$(TARGET_CROSS)ar r" \
209 RANLIB="$(TARGET_CROSS)ranlib" \
210 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
211 $(OPENSSL_MAKEFLAGS) \
212 build-shared
213 # Work around openssl build bug to link libssl.so with libcrypto.so.
214 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
215 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
216 CC="$(TARGET_CC)" \
217 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
218 $(OPENSSL_MAKEFLAGS) \
219 do_linux-shared
220 $(MAKE) -C $(PKG_BUILD_DIR) \
221 CC="$(TARGET_CC)" \
222 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
223 $(OPENSSL_MAKEFLAGS) \
224 install
225 endef
226
227 define Build/InstallDev
228 $(INSTALL_DIR) $(1)/usr/include
229 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
230 $(INSTALL_DIR) $(1)/usr/lib/
231 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
232 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
233 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
234 [ -n "$(TARGET_LDFLAGS)" ] && $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc || true
235 endef
236
237 define Package/libopenssl/install
238 $(INSTALL_DIR) $(1)/usr/lib
239 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
240 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
241 endef
242
243 define Package/openssl-util/install
244 $(INSTALL_DIR) $(1)/etc/ssl
245 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
246 $(INSTALL_DIR) $(1)/etc/ssl/certs
247 $(INSTALL_DIR) $(1)/etc/ssl/private
248 chmod 0700 $(1)/etc/ssl/private
249 $(INSTALL_DIR) $(1)/usr/bin
250 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
251 endef
252
253 $(eval $(call BuildPackage,libopenssl))
254 $(eval $(call BuildPackage,openssl-util))