2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
9 include $(TOPDIR)/rules.mk
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
17 ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \
18 ftp://ftp.webmonster.de/pub/openssl/source/ \
19 ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
20 PKG_MD5SUM:=3a7ff24f6ea5cd711984722ad654b927
22 include $(INCLUDE_DIR)/package.mk
24 define Package/openssl/Default
25 TITLE:=Open source SSL toolkit
26 URL:=http://www.openssl.org/
29 define Package/openssl/Default/description
30 The OpenSSL Project is a collaborative effort to develop a robust,
31 commercial-grade, full-featured, and Open Source toolkit implementing the
32 Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1)
33 protocols as well as a full-strength general purpose cryptography library.
36 define Package/libopenssl
37 $(call Package/openssl/Default)
44 define Package/libopenssl/description
45 $(call Package/openssl/Default/description)
46 This package contains the OpenSSL shared libraries, needed by other
50 define Package/openssl-util
51 $(call Package/openssl/Default)
58 define Package/openssl-util/conffiles
62 define Package/openssl-util/description
63 $(call Package/openssl/Default/description)
64 This package contains the OpenSSL command-line utility.
68 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc2 no-rc5 no-sha0 no-smime \
69 no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
70 OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
71 no-engines no-sse2 no-perlasm
74 define Build/Configure
75 (cd $(PKG_BUILD_DIR); \
76 ./Configure linux-openwrt \
78 --openssldir=/etc/ssl \
80 $(TARGET_LDFLAGS) -ldl \
81 -DOPENSSL_SMALL_FOOTPRINT \
82 $(OPENSSL_NO_CIPHERS) \
88 rm -rf $(PKG_INSTALL_DIR)
89 mkdir -p $(PKG_INSTALL_DIR)
90 $(MAKE) -C $(PKG_BUILD_DIR) \
91 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
92 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
94 $(MAKE) -C $(PKG_BUILD_DIR) \
96 AR="$(TARGET_CROSS)ar r" \
97 RANLIB="$(TARGET_CROSS)ranlib" \
98 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
100 # Work around openssl build bug to link libssl.so with libcrypto.so.
101 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
102 $(MAKE) -C $(PKG_BUILD_DIR) \
104 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
106 $(MAKE) -C $(PKG_BUILD_DIR) \
107 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
111 define Build/InstallDev
112 mkdir -p $(STAGING_DIR)/usr/include
113 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
114 mkdir -p $(STAGING_DIR)/usr/lib/
115 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
116 mkdir -p $(STAGING_DIR)/usr/lib/pkgconfig
117 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(STAGING_DIR)/usr/lib/pkgconfig/
118 $(SED) 's,^includedir=.*,includedir=$(STAGING_DIR)/usr/include,g' $(STAGING_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
119 $(SED) 's,^libdir=.*,libdir=$(STAGING_DIR)/usr/lib,g' $(STAGING_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
120 $(SED) 's,$(TARGET_LDFLAGS),,g' $(STAGING_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
123 define Build/UninstallDev
124 rm -rf $(STAGING_DIR)/usr/include/openssl \
125 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} \
126 $(STAGING_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
129 define Package/libopenssl/install
130 $(INSTALL_DIR) $(1)/usr/lib
131 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
132 chmod 0644 $(1)/usr/lib/*
135 define Package/openssl-util/install
136 $(INSTALL_DIR) $(1)/etc/ssl
137 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
138 $(INSTALL_DIR) $(1)/etc/ssl/certs
139 $(INSTALL_DIR) $(1)/etc/ssl/private
140 chmod 0700 $(1)/etc/ssl/private
141 $(INSTALL_DIR) $(1)/usr/bin
142 $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
145 $(eval $(call BuildPackage,libopenssl))
146 $(eval $(call BuildPackage,openssl-util))