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
:=8c6ff15ec6b319b50788f42c7abc2890c08ba5a1cdcd3810eb9092deada37b0f
30 PKG_LICENSE_FILES
:=LICENSE
31 PKG_CPE_ID
:=cpe
:/a
:openssl
:openssl
32 PKG_CONFIG_DEPENDS
:= \
33 CONFIG_OPENSSL_ENGINE_CRYPTO \
34 CONFIG_OPENSSL_ENGINE_DIGEST \
35 CONFIG_OPENSSL_WITH_EC \
36 CONFIG_OPENSSL_WITH_EC2M \
37 CONFIG_OPENSSL_WITH_SSL3 \
38 CONFIG_OPENSSL_HARDWARE_SUPPORT \
39 CONFIG_OPENSSL_WITH_DEPRECATED \
40 CONFIG_OPENSSL_WITH_DTLS \
41 CONFIG_OPENSSL_WITH_COMPRESSION \
42 CONFIG_OPENSSL_WITH_NPN \
43 CONFIG_OPENSSL_WITH_PSK \
44 CONFIG_OPENSSL_WITH_SRP \
45 CONFIG_OPENSSL_OPTIMIZE_SPEED
47 include $(INCLUDE_DIR
)/package.mk
49 ifneq ($(CONFIG_CCACHE
),)
50 HOSTCC
=$(HOSTCC_NOCACHE
)
51 HOSTCXX
=$(HOSTCXX_NOCACHE
)
54 define Package
/openssl
/Default
55 TITLE
:=Open source SSL toolkit
56 URL
:=http
://www.openssl.org
/
59 define Package
/libopenssl
/config
60 source
"$(SOURCE)/Config.in"
63 define Package
/openssl
/Default
/description
64 The OpenSSL Project is a collaborative effort to develop a robust
,
65 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
66 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
67 as a full-strength general purpose cryptography library.
70 define Package
/libopenssl
71 $(call Package
/openssl
/Default
)
75 DEPENDS
:=+OPENSSL_WITH_COMPRESSION
:zlib
77 ABI_VERSION
:=$(PKG_VERSION
)
81 define Package
/libopenssl
/description
82 $(call Package
/openssl
/Default
/description
)
83 This package contains the OpenSSL shared libraries
, needed by other programs.
86 define Package
/openssl-util
87 $(call Package
/openssl
/Default
)
94 define Package
/openssl-util
/conffiles
98 define Package
/openssl-util
/description
99 $(call Package
/openssl
/Default
/description
)
100 This package contains the OpenSSL command-line utility.
104 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-camellia no-krb5 \
105 no-whrlpool no-whirlpool no-seed no-jpake
106 OPENSSL_OPTIONS
:= shared no-err no-sse2 no-ssl2 no-ssl2-method no-heartbeats
108 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
109 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
110 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
111 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
114 OPENSSL_OPTIONS
+= no-engines
117 ifndef CONFIG_OPENSSL_WITH_EC
118 OPENSSL_OPTIONS
+= no-ec
121 ifndef CONFIG_OPENSSL_WITH_EC2M
122 OPENSSL_OPTIONS
+= no-ec2m
125 ifndef CONFIG_OPENSSL_WITH_SSL3
126 OPENSSL_OPTIONS
+= no-ssl3
129 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
130 OPENSSL_OPTIONS
+= no-hw
133 ifndef CONFIG_OPENSSL_WITH_DEPRECATED
134 OPENSSL_OPTIONS
+= no-deprecated
137 ifndef CONFIG_OPENSSL_WITH_DTLS
138 OPENSSL_OPTIONS
+= no-dtls
141 ifdef CONFIG_OPENSSL_WITH_COMPRESSION
142 OPENSSL_OPTIONS
+= zlib-dynamic
144 OPENSSL_OPTIONS
+= no-comp
147 ifndef CONFIG_OPENSSL_WITH_NPN
148 OPENSSL_OPTIONS
+= no-nextprotoneg
151 ifndef CONFIG_OPENSSL_WITH_PSK
152 OPENSSL_OPTIONS
+= no-psk
155 ifndef CONFIG_OPENSSL_WITH_SRP
156 OPENSSL_OPTIONS
+= no-srp
159 ifeq ($(CONFIG_OPENSSL_OPTIMIZE_SPEED
),y
)
160 TARGET_CFLAGS
:= $(filter-out -Os
,$(TARGET_CFLAGS
)) -O3
163 ifeq ($(CONFIG_x86_64
),y
)
164 OPENSSL_TARGET
:=linux-x86_64-openwrt
165 OPENSSL_MAKEFLAGS
+= LIBDIR
=lib
167 OPENSSL_OPTIONS
+=no-sse2
168 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
169 OPENSSL_TARGET
:=linux-mips-openwrt
170 else ifeq ($(CONFIG_aarch64
),y
)
171 OPENSSL_TARGET
:=linux-aarch64-openwrt
172 else ifeq ($(CONFIG_arm
)$(CONFIG_armeb
),y
)
173 OPENSSL_TARGET
:=linux-armv4-openwrt
175 OPENSSL_TARGET
:=linux-generic-openwrt
176 OPENSSL_OPTIONS
+=no-perlasm
180 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(shell echo
$(OPENSSL_OPTIONS
) | mkhash md5
)
182 define Build
/Configure
183 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
184 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
185 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
187 (cd
$(PKG_BUILD_DIR
); \
188 .
/Configure
$(OPENSSL_TARGET
) \
190 --openssldir
=/etc
/ssl \
192 $(TARGET_LDFLAGS
) -ldl \
193 $(if
$(CONFIG_OPENSSL_OPTIMIZE_SPEED
),,-DOPENSSL_SMALL_FOOTPRINT
) \
194 $(OPENSSL_NO_CIPHERS
) \
197 # XXX: OpenSSL "make depend" will look for installed headers before its own,
198 # so remove installed stuff first
199 -$(SUBMAKE
) -j1 clean-staging
200 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
201 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
202 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
203 $(OPENSSL_MAKEFLAGS
) \
207 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
208 TARGET_LDFLAGS
+= -Wl
,--gc-sections
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 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
221 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
222 AR
="$(TARGET_CROSS)ar r" \
223 RANLIB
="$(TARGET_CROSS)ranlib" \
224 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
225 $(OPENSSL_MAKEFLAGS
) \
227 # Work around openssl build bug to link libssl.so with libcrypto.so.
228 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
229 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
231 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
232 $(OPENSSL_MAKEFLAGS
) \
234 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
236 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
237 $(OPENSSL_MAKEFLAGS
) \
241 define Build
/InstallDev
242 $(INSTALL_DIR
) $(1)/usr
/include
243 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
244 $(INSTALL_DIR
) $(1)/usr
/lib
/
245 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
246 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
247 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
248 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
251 define Package
/libopenssl
/install
252 $(INSTALL_DIR
) $(1)/usr
/lib
253 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
254 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
257 define Package
/openssl-util
/install
258 $(INSTALL_DIR
) $(1)/etc
/ssl
259 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
260 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
261 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
262 chmod
0700 $(1)/etc
/ssl
/private
263 $(INSTALL_DIR
) $(1)/usr
/bin
264 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
267 $(eval
$(call BuildPackage
,libopenssl
))
268 $(eval
$(call BuildPackage
,openssl-util
))