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
:=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00
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_NO_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
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 no-ssl3-method
129 ifndef CONFIG_OPENSSL_HARDWARE_SUPPORT
130 OPENSSL_OPTIONS
+= no-hw
133 ifdef CONFIG_OPENSSL_NO_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 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
198 CROSS_COMPILE
="$(TARGET_CROSS)" \
199 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
200 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
201 $(OPENSSL_MAKEFLAGS
) \
205 TARGET_CFLAGS
+= $(FPIC
) -I
$(CURDIR
)/include -ffunction-sections
-fdata-sections
206 TARGET_LDFLAGS
+= -Wl
,--gc-sections
209 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
210 CROSS_COMPILE
="$(TARGET_CROSS)" \
212 ASFLAGS
="$(TARGET_ASFLAGS) -I$(PKG_BUILD_DIR)/crypto -c" \
213 AR
="$(TARGET_CROSS)ar r" \
214 RANLIB
="$(TARGET_CROSS)ranlib" \
215 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
216 $(OPENSSL_MAKEFLAGS
) \
218 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
219 CROSS_COMPILE
="$(TARGET_CROSS)" \
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
) \
230 CROSS_COMPILE
="$(TARGET_CROSS)" \
232 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
233 $(OPENSSL_MAKEFLAGS
) \
235 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
236 CROSS_COMPILE
="$(TARGET_CROSS)" \
238 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
239 $(OPENSSL_MAKEFLAGS
) \
243 define Build
/InstallDev
244 $(INSTALL_DIR
) $(1)/usr
/include
245 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
246 $(INSTALL_DIR
) $(1)/usr
/lib
/
247 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
248 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
249 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
250 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
253 define Package
/libopenssl
/install
254 $(INSTALL_DIR
) $(1)/usr
/lib
255 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
256 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
259 define Package
/openssl-util
/install
260 $(INSTALL_DIR
) $(1)/etc
/ssl
261 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
262 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
263 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
264 chmod
0700 $(1)/etc
/ssl
/private
265 $(INSTALL_DIR
) $(1)/usr
/bin
266 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
269 $(eval
$(call BuildPackage
,libopenssl
))
270 $(eval
$(call BuildPackage
,openssl-util
))