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
:=6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0
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 no-ssl3-method
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_arm
)$(CONFIG_armeb
),y
)
165 OPENSSL_TARGET
:=linux-armv4-openwrt
167 OPENSSL_TARGET
:=linux-generic-openwrt
168 OPENSSL_OPTIONS
+=no-perlasm
172 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) | mkhash md5
)
174 define Build
/Configure
175 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
176 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
177 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
179 (cd
$(PKG_BUILD_DIR
); \
180 .
/Configure
$(OPENSSL_TARGET
) \
182 --openssldir
=/etc
/ssl \
184 $(TARGET_LDFLAGS
) -ldl \
185 -DOPENSSL_SMALL_FOOTPRINT \
186 $(OPENSSL_NO_CIPHERS
) \
189 # XXX: OpenSSL "make depend" will look for installed headers before its own,
190 # so remove installed stuff first
191 -$(SUBMAKE
) -j1 clean-staging
192 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
193 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
194 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
195 $(OPENSSL_MAKEFLAGS
) \
199 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
200 TARGET_LDFLAGS
+= -Wl
,--gc-sections
203 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
205 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
206 AR
="$(TARGET_CROSS)ar r" \
207 RANLIB
="$(TARGET_CROSS)ranlib" \
208 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
209 $(OPENSSL_MAKEFLAGS
) \
211 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
213 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
214 AR
="$(TARGET_CROSS)ar r" \
215 RANLIB
="$(TARGET_CROSS)ranlib" \
216 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
217 $(OPENSSL_MAKEFLAGS
) \
219 # Work around openssl build bug to link libssl.so with libcrypto.so.
220 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
221 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
223 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
224 $(OPENSSL_MAKEFLAGS
) \
226 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
228 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
229 $(OPENSSL_MAKEFLAGS
) \
233 define Build
/InstallDev
234 $(INSTALL_DIR
) $(1)/usr
/include
235 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
236 $(INSTALL_DIR
) $(1)/usr
/lib
/
237 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
238 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
239 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
240 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
243 define Package
/libopenssl
/install
244 $(INSTALL_DIR
) $(1)/usr
/lib
245 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
246 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
249 define Package
/openssl-util
/install
250 $(INSTALL_DIR
) $(1)/etc
/ssl
251 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
252 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
253 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
254 chmod
0700 $(1)/etc
/ssl
/private
255 $(INSTALL_DIR
) $(1)/usr
/bin
256 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
259 $(eval
$(call BuildPackage
,libopenssl
))
260 $(eval
$(call BuildPackage
,openssl-util
))