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
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_HASH
:=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00
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_DTLS \
39 CONFIG_OPENSSL_WITH_COMPRESSION \
40 CONFIG_OPENSSL_WITH_NPN \
41 CONFIG_OPENSSL_WITH_PSK \
42 CONFIG_OPENSSL_WITH_SRP
44 include $(INCLUDE_DIR
)/package.mk
46 ifneq ($(CONFIG_CCACHE
),)
47 HOSTCC
=$(HOSTCC_NOCACHE
)
48 HOSTCXX
=$(HOSTCXX_NOCACHE
)
51 define Package
/openssl
/Default
52 TITLE
:=Open source SSL toolkit
53 URL
:=http
://www.openssl.org
/
56 define Package
/libopenssl
/config
57 source
"$(SOURCE)/Config.in"
60 define Package
/openssl
/Default
/description
61 The OpenSSL Project is a collaborative effort to develop a robust
,
62 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
63 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
64 as a full-strength general purpose cryptography library.
67 define Package
/libopenssl
68 $(call Package
/openssl
/Default
)
72 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
74 ABI_VERSION
:=$(PKG_VERSION
)
78 define Package
/libopenssl
/description
79 $(call Package
/openssl
/Default
/description
)
80 This package contains the OpenSSL shared libraries
, needed by other programs.
83 define Package
/openssl-util
84 $(call Package
/openssl
/Default
)
91 define Package
/openssl-util
/conffiles
95 define Package
/openssl-util
/description
96 $(call Package
/openssl
/Default
/description
)
97 This package contains the OpenSSL command-line utility.
101 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
102 no-whrlpool no-whirlpool no-seed no-jpake
103 OPENSSL_OPTIONS
:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
105 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
106 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
107 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
108 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
111 OPENSSL_OPTIONS
+= no-engines
114 ifndef CONFIG_OPENSSL_WITH_EC
115 OPENSSL_OPTIONS
+= no-ec
118 ifndef CONFIG_OPENSSL_WITH_EC2M
119 OPENSSL_OPTIONS
+= no-ec2m
122 ifndef CONFIG_OPENSSL_WITH_SSL3
123 OPENSSL_OPTIONS
+= no-ssl3 no-ssl3-method
126 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
127 OPENSSL_OPTIONS
+= no-hw
130 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
131 OPENSSL_OPTIONS
+= no-deprecated
134 ifndef CONFIG_OPENSSL_WITH_DTLS
135 OPENSSL_OPTIONS
+= no-dtls
138 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
139 OPENSSL_OPTIONS
+= zlib-dynamic
141 OPENSSL_OPTIONS
+= no-comp
144 ifndef CONFIG_OPENSSL_WITH_NPN
145 OPENSSL_OPTIONS
+= no-nextprotoneg
148 ifndef CONFIG_OPENSSL_WITH_PSK
149 OPENSSL_OPTIONS
+= no-psk
152 ifndef CONFIG_OPENSSL_WITH_SRP
153 OPENSSL_OPTIONS
+= no-srp
156 ifeq ($(CONFIG_x86_64
),y
)
157 OPENSSL_TARGET
:=linux-x86_64-openwrt
158 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
160 OPENSSL_OPTIONS
+=no-sse2
161 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
162 OPENSSL_TARGET
:=linux-mips-openwrt
163 else ifeq ($(CONFIG_arm
)$(CONFIG_armeb
),y
)
164 OPENSSL_TARGET
:=linux-armv4-openwrt
166 OPENSSL_TARGET
:=linux-generic-openwrt
167 OPENSSL_OPTIONS
+=no-perlasm
171 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) | mkhash md5
)
173 define Build
/Configure
174 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
175 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
176 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
178 (cd
$(PKG_BUILD_DIR
); \
179 .
/Configure
$(OPENSSL_TARGET
) \
181 --openssldir
=/etc
/ssl \
183 $(TARGET_LDFLAGS
) -ldl \
184 -DOPENSSL_SMALL_FOOTPRINT \
185 $(OPENSSL_NO_CIPHERS
) \
188 # XXX: OpenSSL "make depend" will look for installed headers before its own,
189 # so remove installed stuff first
190 -$(SUBMAKE
) -j1 clean-staging
191 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
192 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
193 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
194 $(OPENSSL_MAKEFLAGS
) \
198 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
199 TARGET_LDFLAGS
+= -Wl
,--gc-sections
202 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
204 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
205 AR
="$(TARGET_CROSS)ar r" \
206 RANLIB
="$(TARGET_CROSS)ranlib" \
207 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
208 $(OPENSSL_MAKEFLAGS
) \
210 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
212 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
213 AR
="$(TARGET_CROSS)ar r" \
214 RANLIB
="$(TARGET_CROSS)ranlib" \
215 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
216 $(OPENSSL_MAKEFLAGS
) \
218 # Work around openssl build bug to link libssl.so with libcrypto.so.
219 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
220 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
222 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
223 $(OPENSSL_MAKEFLAGS
) \
225 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
227 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
228 $(OPENSSL_MAKEFLAGS
) \
232 define Build
/InstallDev
233 $(INSTALL_DIR
) $(1)/usr
/include
234 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
235 $(INSTALL_DIR
) $(1)/usr
/lib
/
236 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
237 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
238 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
239 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
242 define Package
/libopenssl
/install
243 $(INSTALL_DIR
) $(1)/usr
/lib
244 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
245 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
248 define Package
/openssl-util
/install
249 $(INSTALL_DIR
) $(1)/etc
/ssl
250 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
251 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
252 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
253 chmod
0700 $(1)/etc
/ssl
/private
254 $(INSTALL_DIR
) $(1)/usr
/bin
255 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
258 $(eval
$(call BuildPackage
,libopenssl
))
259 $(eval
$(call BuildPackage
,openssl-util
))