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
41 include $(INCLUDE_DIR
)/package.mk
43 ifneq ($(CONFIG_CCACHE
),)
44 HOSTCC
=$(HOSTCC_NOCACHE
)
45 HOSTCXX
=$(HOSTCXX_NOCACHE
)
48 define Package
/openssl
/Default
49 TITLE
:=Open source SSL toolkit
50 URL
:=http
://www.openssl.org
/
53 define Package
/libopenssl
/config
54 source
"$(SOURCE)/Config.in"
57 define Package
/openssl
/Default
/description
58 The OpenSSL Project is a collaborative effort to develop a robust
,
59 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
60 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
61 as a full-strength general purpose cryptography library.
64 define Package
/libopenssl
65 $(call Package
/openssl
/Default
)
69 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
71 ABI_VERSION
:=$(PKG_VERSION
)
75 define Package
/libopenssl
/description
76 $(call Package
/openssl
/Default
/description
)
77 This package contains the OpenSSL shared libraries
, needed by other programs.
80 define Package
/openssl-util
81 $(call Package
/openssl
/Default
)
88 define Package
/openssl-util
/conffiles
92 define Package
/openssl-util
/description
93 $(call Package
/openssl
/Default
/description
)
94 This package contains the OpenSSL command-line utility.
98 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
99 no-whrlpool no-whirlpool no-ripemd no-seed no-cast no-cmac
100 OPENSSL_OPTIONS
:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
102 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
103 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
104 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
105 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
108 OPENSSL_OPTIONS
+= no-engines
111 ifndef CONFIG_OPENSSL_WITH_EC
112 OPENSSL_OPTIONS
+= no-ec
115 ifndef CONFIG_OPENSSL_WITH_EC2M
116 OPENSSL_OPTIONS
+= no-ec2m
119 ifndef CONFIG_OPENSSL_WITH_SSL3
120 OPENSSL_OPTIONS
+= no-ssl3 no-ssl3-method
123 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
124 OPENSSL_OPTIONS
+= no-hw
127 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
128 OPENSSL_OPTIONS
+= no-deprecated
131 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
132 OPENSSL_OPTIONS
+= zlib-dynamic
134 OPENSSL_OPTIONS
+= no-comp
137 ifndef CONFIG_OPENSSL_WITH_NPN
138 OPENSSL_OPTIONS
+= no-nextprotoneg
141 ifndef CONFIG_OPENSSL_WITH_PSK
142 OPENSSL_OPTIONS
+= no-psk
145 ifeq ($(CONFIG_x86_64
),y
)
146 OPENSSL_TARGET
:=linux-x86_64-openwrt
147 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
149 OPENSSL_OPTIONS
+=no-sse2
150 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
151 OPENSSL_TARGET
:=linux-mips-openwrt
152 # else ifeq ($(CONFIG_arm)$(CONFIG_armeb),y)
153 # OPENSSL_TARGET:=linux-armv4-openwrt
155 OPENSSL_TARGET
:=linux-generic-openwrt
156 OPENSSL_OPTIONS
+=no-perlasm
160 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(subst $(space
),_
,$(OPENSSL_OPTIONS
))
162 define Build
/Configure
163 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
164 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
165 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
167 (cd
$(PKG_BUILD_DIR
); \
168 .
/Configure
$(OPENSSL_TARGET
) \
170 --openssldir
=/etc
/ssl \
172 $(TARGET_LDFLAGS
) -ldl \
173 -DOPENSSL_SMALL_FOOTPRINT \
174 $(OPENSSL_NO_CIPHERS
) \
177 # XXX: OpenSSL "make depend" will look for installed headers before its own,
178 # so remove installed stuff first
179 -$(SUBMAKE
) -j1 clean-staging
180 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
181 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
182 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
183 $(OPENSSL_MAKEFLAGS
) \
187 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
188 TARGET_LDFLAGS
+= -Wl
,--gc-sections
191 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
193 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
194 AR
="$(TARGET_CROSS)ar r" \
195 RANLIB
="$(TARGET_CROSS)ranlib" \
196 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
197 $(OPENSSL_MAKEFLAGS
) \
199 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
201 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
202 AR
="$(TARGET_CROSS)ar r" \
203 RANLIB
="$(TARGET_CROSS)ranlib" \
204 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
205 $(OPENSSL_MAKEFLAGS
) \
207 # Work around openssl build bug to link libssl.so with libcrypto.so.
208 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
209 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
211 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
212 $(OPENSSL_MAKEFLAGS
) \
214 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
216 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
217 $(OPENSSL_MAKEFLAGS
) \
221 define Build
/InstallDev
222 $(INSTALL_DIR
) $(1)/usr
/include
223 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
224 $(INSTALL_DIR
) $(1)/usr
/lib
/
225 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
226 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
227 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
228 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
231 define Package
/libopenssl
/install
232 $(INSTALL_DIR
) $(1)/usr
/lib
233 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
234 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
237 define Package
/openssl-util
/install
238 $(INSTALL_DIR
) $(1)/etc
/ssl
239 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
240 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
241 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
242 chmod
0700 $(1)/etc
/ssl
/private
243 $(INSTALL_DIR
) $(1)/usr
/bin
244 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
247 $(eval
$(call BuildPackage
,libopenssl
))
248 $(eval
$(call BuildPackage
,openssl-util
))