2 # Copyright (C) 2006-2012 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
17 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
18 PKG_SOURCE_URL
:=http
://www.openssl.org
/source
/ \
19 ftp
://ftp.funet.fi
/pub
/crypt
/mirrors
/ftp.openssl.org
/source \
20 ftp
://ftp.sunet.se
/pub
/security
/tools
/net
/openssl
/source
/
21 PKG_MD5SUM
:=f26b09c028a0541cab33da697d522b25
23 PKG_LICENSE
:=SSLEAY OPENSSL
24 PKG_LICENSE_FILES
:=LICENSE
25 PKG_BUILD_DEPENDS
:=ocf-crypto-headers
26 PKG_CONFIG_DEPENDS
:=CONFIG_OPENSSL_ENGINE_CRYPTO CONFIG_OPENSSL_ENGINE_DIGEST \
27 CONFIG_OPENSSL_WITH_EC CONFIG_OPENSSL_WITH_EC2M
29 include $(INCLUDE_DIR
)/package.mk
31 define Package
/openssl
/Default
32 TITLE
:=Open source SSL toolkit
33 URL
:=http
://www.openssl.org
/
36 define Package
/libopenssl
/config
37 source
"$(SOURCE)/Config.in"
40 define Package
/openssl
/Default
/description
41 The OpenSSL Project is a collaborative effort to develop a robust
,
42 commercial-grade
, full-featured
, and Open Source toolkit implementing the Secure
43 Sockets Layer
(SSL v2
/v3
) and Transport Layer Security
(TLS v1
) protocols
as well
44 as a full-strength general purpose cryptography library.
47 define Package
/libopenssl
48 $(call Package
/openssl
/Default
)
57 define Package
/libopenssl
/description
58 $(call Package
/openssl
/Default
/description
)
59 This package contains the OpenSSL shared libraries
, needed by other programs.
62 define Package
/openssl-util
63 $(call Package
/openssl
/Default
)
70 define Package
/openssl-util
/conffiles
74 define Package
/openssl-util
/description
75 $(call Package
/openssl
/Default
/description
)
76 This package contains the OpenSSL command-line utility.
80 OPENSSL_NO_CIPHERS
:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
81 no-aes192 no-camellia no-ans1 no-krb5
82 OPENSSL_OPTIONS
:= shared no-err no-hw zlib-dynamic no-sse2
84 ifdef CONFIG_OPENSSL_ENGINE_CRYPTO
85 OPENSSL_OPTIONS
+= -DHAVE_CRYPTODEV
86 ifdef CONFIG_OPENSSL_ENGINE_DIGEST
87 OPENSSL_OPTIONS
+= -DUSE_CRYPTODEV_DIGESTS
90 OPENSSL_OPTIONS
+= no-engines
93 ifndef CONFIG_OPENSSL_WITH_EC
94 OPENSSL_OPTIONS
+= no-ec
97 ifndef CONFIG_OPENSSL_WITH_EC2M
98 OPENSSL_OPTIONS
+= no-ec2m
101 ifeq ($(CONFIG_x86_64
),y
)
102 OPENSSL_TARGET
:=linux-x86_64
104 OPENSSL_OPTIONS
+=no-sse2
105 ifeq ($(CONFIG_mips
)$(CONFIG_mipsel
),y
)
106 OPENSSL_TARGET
:=linux-mips-openwrt
108 OPENSSL_TARGET
:=linux-generic-openwrt
109 OPENSSL_OPTIONS
+=no-perlasm
113 STAMP_CONFIGURED
:= $(STAMP_CONFIGURED
)_
$(subst $(space
),_
,$(OPENSSL_OPTIONS
))
115 define Build
/Configure
116 [ -f
$(STAMP_CONFIGURED
) ] ||
{ \
117 rm -f
$(PKG_BUILD_DIR
)/*.so.
* $(PKG_BUILD_DIR
)/*.a
; \
118 find
$(PKG_BUILD_DIR
) -name \
*.o | xargs
rm -f
; \
120 (cd
$(PKG_BUILD_DIR
); \
121 .
/Configure
$(OPENSSL_TARGET
) \
123 --openssldir
=/etc
/ssl \
125 $(TARGET_LDFLAGS
) -ldl \
126 -DOPENSSL_SMALL_FOOTPRINT \
127 $(OPENSSL_NO_CIPHERS
) \
130 # XXX: OpenSSL "make depend" will look for installed headers before its own,
131 # so remove installed stuff first
132 -$(SUBMAKE
) -j1 clean-staging
133 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
134 MAKEDEPPROG
="$(TARGET_CROSS)gcc" \
135 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
136 $(OPENSSL_MAKEFLAGS
) \
140 TARGET_CFLAGS
+= $(FPIC
)
143 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
145 ASFLAGS
="$(TARGET_ASFLAGS) -c" \
146 AR
="$(TARGET_CROSS)ar r" \
147 RANLIB
="$(TARGET_CROSS)ranlib" \
148 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
149 $(OPENSSL_MAKEFLAGS
) \
151 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
153 ASFLAGS
="$(TARGET_ASFLAGS) -c" \
154 AR
="$(TARGET_CROSS)ar r" \
155 RANLIB
="$(TARGET_CROSS)ranlib" \
156 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
157 $(OPENSSL_MAKEFLAGS
) \
159 # Work around openssl build bug to link libssl.so with libcrypto.so.
160 -rm $(PKG_BUILD_DIR
)/libssl.so.
*.
*.
*
161 +$(MAKE
) $(PKG_JOBS
) -C
$(PKG_BUILD_DIR
) \
163 OPENWRT_OPTIMIZATION_FLAGS
="$(TARGET_CFLAGS)" \
164 $(OPENSSL_MAKEFLAGS
) \
166 $(MAKE
) -C
$(PKG_BUILD_DIR
) \
168 INSTALL_PREFIX
="$(PKG_INSTALL_DIR)" \
169 $(OPENSSL_MAKEFLAGS
) \
173 define Build
/InstallDev
174 $(INSTALL_DIR
) $(1)/usr
/include
175 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/openssl
$(1)/usr
/include/
176 $(INSTALL_DIR
) $(1)/usr
/lib
/
177 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/lib
{crypto
,ssl
}.
{a
,so
*} $(1)/usr
/lib
/
178 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
179 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc $(1)/usr
/lib
/pkgconfig
/
180 [ -n
"$(TARGET_LDFLAGS)" ] && $(SED
) 's#$(TARGET_LDFLAGS)##g' $(1)/usr
/lib
/pkgconfig
/{openssl
,libcrypto
,libssl
}.
pc || true
183 define Package
/libopenssl
/install
184 $(INSTALL_DIR
) $(1)/usr
/lib
185 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libcrypto.so.
* $(1)/usr
/lib
/
186 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/libssl.so.
* $(1)/usr
/lib
/
189 define Package
/openssl-util
/install
190 $(INSTALL_DIR
) $(1)/etc
/ssl
191 $(CP
) $(PKG_INSTALL_DIR
)/etc
/ssl
/openssl.cnf
$(1)/etc
/ssl
/
192 $(INSTALL_DIR
) $(1)/etc
/ssl
/certs
193 $(INSTALL_DIR
) $(1)/etc
/ssl
/private
194 chmod
0700 $(1)/etc
/ssl
/private
195 $(INSTALL_DIR
) $(1)/usr
/bin
196 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/bin
/openssl
$(1)/usr
/bin
/
199 $(eval
$(call BuildPackage
,libopenssl
))
200 $(eval
$(call BuildPackage
,openssl-util
))