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_MD5SUM
:=9287487d11c9545b6efb287cdb70535d4e9b284dd10d51441d9b9963d000de6f
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
43 include $(INCLUDE_DIR
)/package.mk
45 ifneq ($(CONFIG_CCACHE
),)
46 HOSTCC
=$(HOSTCC_NOCACHE
)
47 HOSTCXX
=$(HOSTCXX_NOCACHE
)
50 define Package
/openssl
/Default
51 TITLE
:=Open source SSL toolkit
52 URL
:=http
://www.openssl.org
/
55 define Package
/libopenssl
/config
56 source
"$(SOURCE)/Config.in"
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.
66 define Package
/libopenssl
67 $(call Package
/openssl
/Default
)
71 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
73 ABI_VERSION
:=$(PKG_VERSION
)
77 define Package
/libopenssl
/description
78 $(call Package
/openssl
/Default
/description
)
79 This package contains the OpenSSL shared libraries
, needed by other programs.
82 define Package
/openssl-util
83 $(call Package
/openssl
/Default
)
90 define Package
/openssl-util
/conffiles
94 define Package
/openssl-util
/description
95 $(call Package
/openssl
/Default
/description
)
96 This package contains the OpenSSL command-line utility.
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
104 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
105 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
106 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
107 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
110 OPENSSL_OPTIONS
+= no-engines
113 ifndef CONFIG_OPENSSL_WITH_EC
114 OPENSSL_OPTIONS
+= no-ec
117 ifndef CONFIG_OPENSSL_WITH_EC2M
118 OPENSSL_OPTIONS
+= no-ec2m
121 ifndef CONFIG_OPENSSL_WITH_SSL3
122 OPENSSL_OPTIONS
+= no-ssl3 no-ssl3-method
125 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
126 OPENSSL_OPTIONS
+= no-hw
129 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
130 OPENSSL_OPTIONS
+= no-deprecated
133 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
134 OPENSSL_OPTIONS
+= zlib-dynamic
136 OPENSSL_OPTIONS
+= no-comp
139 ifndef CONFIG_OPENSSL_WITH_NPN
140 OPENSSL_OPTIONS
+= no-nextprotoneg
143 ifndef CONFIG_OPENSSL_WITH_PSK
144 OPENSSL_OPTIONS
+= no-psk
147 ifndef CONFIG_OPENSSL_WITH_SRP
148 OPENSSL_OPTIONS
+= no-srp
151 ifeq ($(CONFIG_x86_64
),y
)
152 OPENSSL_TARGET
:=linux-x86_64-openwrt
153 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
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
161 OPENSSL_TARGET
:=linux-generic-openwrt
162 OPENSSL_OPTIONS
+=no-perlasm
166 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(subst $(space
),_
,$(OPENSSL_OPTIONS
))
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
; \
173 (cd
$(PKG_BUILD_DIR
); \
174 .
/Configure
$(OPENSSL_TARGET
) \
176 --openssldir
=/etc
/ssl \
178 $(TARGET_LDFLAGS
) -ldl \
179 -DOPENSSL_SMALL_FOOTPRINT \
180 $(OPENSSL_NO_CIPHERS
) \
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
) \
193 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
194 TARGET_LDFLAGS
+= -Wl
,--gc-sections
197 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
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
) \
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 # 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
) \
217 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
218 $(OPENSSL_MAKEFLAGS
) \
220 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
222 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
223 $(OPENSSL_MAKEFLAGS
) \
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
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
/
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
/
253 $(eval
$(call BuildPackage
,libopenssl
))
254 $(eval
$(call BuildPackage
,openssl-util
))