2 # Copyright (C) 2006-2016 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR
)/rules.mk
13 PKG_VERSION
:=$(PKG_BASE
)$(PKG_BUGFIX
)
20 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
22 http
://ftp.fi.muni.cz
/pub
/openssl
/source
/ \
23 http
://ftp.linux.hr
/pub
/openssl
/source
/ \
24 http
://gd.tuwien.ac.at
/infosys
/security
/openssl
/source
/ \
25 http
://www.openssl.org
/source
/ \
26 http
://www.openssl.org
/source
/old
/$(PKG_BASE
)/
27 PKG_HASH
:=8c6ff15ec6b319b50788f42c7abc2890c08ba5a1cdcd3810eb9092deada37b0f
30 PKG_LICENSE_FILES
:=LICENSE
31 PKG_CONFIG_DEPENDS
:= \
32 CONFIG_OPENSSL_ENGINE_CRYPTO \
33 CONFIG_OPENSSL_ENGINE_DIGEST \
34 CONFIG_OPENSSL_WITH_EC \
35 CONFIG_OPENSSL_WITH_EC2M \
36 CONFIG_OPENSSL_WITH_SSL3 \
37 CONFIG_OPENSSL_HARDWARE_SUPPORT \
38 CONFIG_OPENSSL_WITH_DEPRECATED \
39 CONFIG_OPENSSL_WITH_DTLS \
40 CONFIG_OPENSSL_WITH_COMPRESSION \
41 CONFIG_OPENSSL_WITH_NPN \
42 CONFIG_OPENSSL_WITH_PSK \
43 CONFIG_OPENSSL_WITH_SRP
45 include $(INCLUDE_DIR
)/package.mk
47 ifneq ($(CONFIG_CCACHE
),)
48 HOSTCC
=$(HOSTCC_NOCACHE
)
49 HOSTCXX
=$(HOSTCXX_NOCACHE
)
52 define Package
/openssl
/Default
53 TITLE
:=Open source SSL toolkit
54 URL
:=http
://www.openssl.org
/
57 define Package
/libopenssl
/config
58 source
"$(SOURCE)/Config.in"
61 define Package
/openssl
/Default
/description
62 The OpenSSL Project is a collaborative effort to develop a robust
,
63 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
64 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
65 as a full-strength general purpose cryptography library.
68 define Package
/libopenssl
69 $(call Package
/openssl
/Default
)
73 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
75 ABI_VERSION
:=$(PKG_VERSION
)
79 define Package
/libopenssl
/description
80 $(call Package
/openssl
/Default
/description
)
81 This package contains the OpenSSL shared libraries
, needed by other programs.
84 define Package
/openssl-util
85 $(call Package
/openssl
/Default
)
92 define Package
/openssl-util
/conffiles
96 define Package
/openssl-util
/description
97 $(call Package
/openssl
/Default
/description
)
98 This package contains the OpenSSL command-line utility.
102 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
103 no-whrlpool no-whirlpool no-seed no-jpake
104 OPENSSL_OPTIONS
:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
106 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
107 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
108 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
109 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
112 OPENSSL_OPTIONS
+= no-engines
115 ifndef CONFIG_OPENSSL_WITH_EC
116 OPENSSL_OPTIONS
+= no-ec
119 ifndef CONFIG_OPENSSL_WITH_EC2M
120 OPENSSL_OPTIONS
+= no-ec2m
123 ifndef CONFIG_OPENSSL_WITH_SSL3
124 OPENSSL_OPTIONS
+= no-ssl3
127 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
128 OPENSSL_OPTIONS
+= no-hw
131 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
132 OPENSSL_OPTIONS
+= no-deprecated
135 ifndef CONFIG_OPENSSL_WITH_DTLS
136 OPENSSL_OPTIONS
+= no-dtls
139 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
140 OPENSSL_OPTIONS
+= zlib-dynamic
142 OPENSSL_OPTIONS
+= no-comp
145 ifndef CONFIG_OPENSSL_WITH_NPN
146 OPENSSL_OPTIONS
+= no-nextprotoneg
149 ifndef CONFIG_OPENSSL_WITH_PSK
150 OPENSSL_OPTIONS
+= no-psk
153 ifndef CONFIG_OPENSSL_WITH_SRP
154 OPENSSL_OPTIONS
+= no-srp
157 ifeq ($(CONFIG_x86_64
),y
)
158 OPENSSL_TARGET
:=linux-x86_64-openwrt
159 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
161 OPENSSL_OPTIONS
+=no-sse2
162 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
163 OPENSSL_TARGET
:=linux-mips-openwrt
164 else ifeq ($(CONFIG_aarch64
),y
)
165 OPENSSL_TARGET
:=linux-aarch64-openwrt
166 else ifeq ($(CONFIG_arm
)$(CONFIG_armeb
),y
)
167 OPENSSL_TARGET
:=linux-armv4-openwrt
169 OPENSSL_TARGET
:=linux-generic-openwrt
170 OPENSSL_OPTIONS
+=no-perlasm
174 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) | mkhash md5
)
176 define Build
/Configure
177 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
178 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
179 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
181 (cd
$(PKG_BUILD_DIR
); \
182 .
/Configure
$(OPENSSL_TARGET
) \
184 --openssldir
=/etc
/ssl \
186 $(TARGET_LDFLAGS
) -ldl \
187 -DOPENSSL_SMALL_FOOTPRINT \
188 $(OPENSSL_NO_CIPHERS
) \
191 # XXX: OpenSSL "make depend" will look for installed headers before its own,
192 # so remove installed stuff first
193 -$(SUBMAKE
) -j1 clean-staging
194 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
195 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
196 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
197 $(OPENSSL_MAKEFLAGS
) \
201 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
202 TARGET_LDFLAGS
+= -Wl
,--gc-sections
205 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
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
) \
213 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
215 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
216 AR
="$(TARGET_CROSS)ar r" \
217 RANLIB
="$(TARGET_CROSS)ranlib" \
218 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
219 $(OPENSSL_MAKEFLAGS
) \
221 # Work around openssl build bug to link libssl.so with libcrypto.so.
222 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
223 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
225 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
226 $(OPENSSL_MAKEFLAGS
) \
228 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
230 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
231 $(OPENSSL_MAKEFLAGS
) \
235 define Build
/InstallDev
236 $(INSTALL_DIR
) $(1)/usr
/include
237 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
238 $(INSTALL_DIR
) $(1)/usr
/lib
/
239 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
240 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
241 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
242 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
245 define Package
/libopenssl
/install
246 $(INSTALL_DIR
) $(1)/usr
/lib
247 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
248 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
251 define Package
/openssl-util
/install
252 $(INSTALL_DIR
) $(1)/etc
/ssl
253 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
254 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
255 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
256 chmod
0700 $(1)/etc
/ssl
/private
257 $(INSTALL_DIR
) $(1)/usr
/bin
258 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
261 $(eval
$(call BuildPackage
,libopenssl
))
262 $(eval
$(call BuildPackage
,openssl-util
))