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
)
19 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
20 PKG_SOURCE_URL
:=http
://www.openssl.org
/source
/ \
21 ftp
://ftp.openssl.org
/source
/ \
22 http
://www.openssl.org
/source
/old
/$(PKG_BASE
)/ \
23 ftp
://ftp.funet.fi
/pub
/crypt
/mirrors
/ftp.openssl.org
/source \
24 ftp
://ftp.sunet.se
/pub
/security
/tools
/net
/openssl
/source
/
25 PKG_MD5SUM
:=9392e65072ce4b614c1392eefc1f23d0
28 PKG_LICENSE_FILES
:=LICENSE
29 PKG_CONFIG_DEPENDS
:= \
30 CONFIG_OPENSSL_ENGINE_CRYPTO \
31 CONFIG_OPENSSL_ENGINE_DIGEST \
32 CONFIG_OPENSSL_WITH_EC \
33 CONFIG_OPENSSL_WITH_EC2M \
34 CONFIG_OPENSSL_WITH_SSL3 \
35 CONFIG_OPENSSL_HARDWARE_SUPPORT \
36 CONFIG_OPENSSL_WITH_DEPRECATED \
37 CONFIG_OPENSSL_WITH_COMPRESSION \
38 CONFIG_OPENSSL_WITH_NPN \
39 CONFIG_OPENSSL_WITH_PSK \
40 CONFIG_OPENSSL_WITH_SRP
42 include $(INCLUDE_DIR
)/package.mk
44 ifneq ($(CONFIG_CCACHE
),)
45 HOSTCC
=$(HOSTCC_NOCACHE
)
46 HOSTCXX
=$(HOSTCXX_NOCACHE
)
49 define Package
/openssl
/Default
50 TITLE
:=Open source SSL toolkit
51 URL
:=http
://www.openssl.org
/
54 define Package
/libopenssl
/config
55 source
"$(SOURCE)/Config.in"
58 define Package
/openssl
/Default
/description
59 The OpenSSL Project is a collaborative effort to develop a robust
,
60 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
61 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
62 as a full-strength general purpose cryptography library.
65 define Package
/libopenssl
66 $(call Package
/openssl
/Default
)
70 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
72 ABI_VERSION
:=$(PKG_VERSION
)
76 define Package
/libopenssl
/description
77 $(call Package
/openssl
/Default
/description
)
78 This package contains the OpenSSL shared libraries
, needed by other programs.
81 define Package
/openssl-util
82 $(call Package
/openssl
/Default
)
89 define Package
/openssl-util
/conffiles
93 define Package
/openssl-util
/description
94 $(call Package
/openssl
/Default
/description
)
95 This package contains the OpenSSL command-line utility.
99 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
100 no-whrlpool no-whirlpool no-seed
101 OPENSSL_OPTIONS
:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
103 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
104 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
105 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
106 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
109 OPENSSL_OPTIONS
+= no-engines
112 ifndef CONFIG_OPENSSL_WITH_EC
113 OPENSSL_OPTIONS
+= no-ec
116 ifndef CONFIG_OPENSSL_WITH_EC2M
117 OPENSSL_OPTIONS
+= no-ec2m
120 ifndef CONFIG_OPENSSL_WITH_SSL3
121 OPENSSL_OPTIONS
+= no-ssl3 no-ssl3-method
124 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
125 OPENSSL_OPTIONS
+= no-hw
128 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
129 OPENSSL_OPTIONS
+= no-deprecated
132 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
133 OPENSSL_OPTIONS
+= zlib-dynamic
135 OPENSSL_OPTIONS
+= no-comp
138 ifndef CONFIG_OPENSSL_WITH_NPN
139 OPENSSL_OPTIONS
+= no-nextprotoneg
142 ifndef CONFIG_OPENSSL_WITH_PSK
143 OPENSSL_OPTIONS
+= no-psk
146 ifndef CONFIG_OPENSSL_WITH_SRP
147 OPENSSL_OPTIONS
+= no-srp
150 ifeq ($(CONFIG_x86_64
),y
)
151 OPENSSL_TARGET
:=linux-x86_64-openwrt
152 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
154 OPENSSL_OPTIONS
+=no-sse2
155 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
156 OPENSSL_TARGET
:=linux-mips-openwrt
157 else ifeq ($(CONFIG_arm
)$(CONFIG_armeb
),y
)
158 OPENSSL_TARGET
:=linux-armv4-openwrt
160 OPENSSL_TARGET
:=linux-generic-openwrt
161 OPENSSL_OPTIONS
+=no-perlasm
165 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(subst $(space
),_
,$(OPENSSL_OPTIONS
))
167 define Build
/Configure
168 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
169 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
170 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
172 (cd
$(PKG_BUILD_DIR
); \
173 .
/Configure
$(OPENSSL_TARGET
) \
175 --openssldir
=/etc
/ssl \
177 $(TARGET_LDFLAGS
) -ldl \
178 -DOPENSSL_SMALL_FOOTPRINT \
179 $(OPENSSL_NO_CIPHERS
) \
182 # XXX: OpenSSL "make depend" will look for installed headers before its own,
183 # so remove installed stuff first
184 -$(SUBMAKE
) -j1 clean-staging
185 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
186 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
187 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
188 $(OPENSSL_MAKEFLAGS
) \
192 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
193 TARGET_LDFLAGS
+= -Wl
,--gc-sections
196 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
198 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
199 AR
="$(TARGET_CROSS)ar r" \
200 RANLIB
="$(TARGET_CROSS)ranlib" \
201 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
202 $(OPENSSL_MAKEFLAGS
) \
204 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
206 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
207 AR
="$(TARGET_CROSS)ar r" \
208 RANLIB
="$(TARGET_CROSS)ranlib" \
209 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
210 $(OPENSSL_MAKEFLAGS
) \
212 # Work around openssl build bug to link libssl.so with libcrypto.so.
213 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
214 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
216 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
217 $(OPENSSL_MAKEFLAGS
) \
219 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
221 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
222 $(OPENSSL_MAKEFLAGS
) \
226 define Build
/InstallDev
227 $(INSTALL_DIR
) $(1)/usr
/include
228 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
229 $(INSTALL_DIR
) $(1)/usr
/lib
/
230 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
231 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
232 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
233 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
236 define Package
/libopenssl
/install
237 $(INSTALL_DIR
) $(1)/usr
/lib
238 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
239 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
242 define Package
/openssl-util
/install
243 $(INSTALL_DIR
) $(1)/etc
/ssl
244 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
245 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
246 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
247 chmod
0700 $(1)/etc
/ssl
/private
248 $(INSTALL_DIR
) $(1)/usr
/bin
249 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
252 $(eval
$(call BuildPackage
,libopenssl
))
253 $(eval
$(call BuildPackage
,openssl-util
))