[package] openssl: add patch for CVE-2010-0740 ("Record of death") vulnerability
[openwrt/svn-archive/archive.git] / package / openssl / Makefile
1 #
2 # Copyright (C) 2006-2010 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=openssl
11 PKG_VERSION:=0.9.8m
12 PKG_RELEASE:=3
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
16 ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \
17 ftp://ftp.webmonster.de/pub/openssl/source/ \
18 ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
19 PKG_MD5SUM:=898bf125370926d5f692a2201124f8ec
20
21 PKG_BUILD_DEPENDS:=ocf-crypto-headers
22 PKG_CONFIG_DEPENDS:=CONFIG_OPENSSL_ENGINE
23
24 include $(INCLUDE_DIR)/package.mk
25
26 define Package/openssl/Default
27 TITLE:=Open source SSL toolkit
28 URL:=http://www.openssl.org/
29 endef
30
31 define Package/libopenssl/config
32 source "$(SOURCE)/Config.in"
33 endef
34
35 define Package/openssl/Default/description
36 The OpenSSL Project is a collaborative effort to develop a robust,
37 commercial-grade, full-featured, and Open Source toolkit implementing the Secure
38 Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols as well
39 as a full-strength general purpose cryptography library.
40 endef
41
42 define Package/libopenssl
43 $(call Package/openssl/Default)
44 SECTION:=libs
45 SUBMENU:=SSL
46 CATEGORY:=Libraries
47 DEPENDS:=+zlib
48 TITLE+= (libraries)
49 endef
50
51 define Package/libopenssl/description
52 $(call Package/openssl/Default/description)
53 This package contains the OpenSSL shared libraries, needed by other programs.
54 endef
55
56 define Package/openssl-util
57 $(call Package/openssl/Default)
58 SECTION:=utils
59 CATEGORY:=Utilities
60 DEPENDS:=+libopenssl
61 TITLE+= (utility)
62 endef
63
64 define Package/openssl-util/conffiles
65 /etc/ssl/openssl.cnf
66 endef
67
68 define Package/openssl-util/description
69 $(call Package/openssl/Default/description)
70 This package contains the OpenSSL command-line utility.
71 endef
72
73
74 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
75 no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
76 OPENSSL_OPTIONS:= shared no-ec no-err no-hw no-threads zlib-dynamic no-sse2
77
78 ifdef CONFIG_OPENSSL_ENGINE
79 OPENSSL_OPTIONS += --with-cryptodev
80 else
81 OPENSSL_OPTIONS += no-engines
82 endif
83
84 OPENSSL_OPTIONS += no-perlasm
85
86 define Build/Configure
87 (cd $(PKG_BUILD_DIR); \
88 ./Configure linux-openwrt \
89 --prefix=/usr \
90 --openssldir=/etc/ssl \
91 $(TARGET_CPPFLAGS) \
92 $(TARGET_LDFLAGS) -ldl \
93 -DOPENSSL_SMALL_FOOTPRINT \
94 $(OPENSSL_NO_CIPHERS) \
95 $(OPENSSL_OPTIONS) \
96 )
97 endef
98
99 TARGET_CFLAGS += $(FPIC)
100
101 define Build/Compile
102 # XXX: OpenSSL "make depend" will look for installed headers before its own,
103 # so remove installed stuff first
104 -$(SUBMAKE) -j1 clean-staging
105 $(MAKE) -C $(PKG_BUILD_DIR) \
106 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
107 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
108 $(OPENSSL_MAKEFLAGS) \
109 depend
110 $(_SINGLE)$(MAKE) -C $(PKG_BUILD_DIR) \
111 CC="$(TARGET_CC)" \
112 AR="$(TARGET_CROSS)ar r" \
113 RANLIB="$(TARGET_CROSS)ranlib" \
114 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
115 $(OPENSSL_MAKEFLAGS) \
116 all
117 $(MAKE) -C $(PKG_BUILD_DIR) \
118 CC="$(TARGET_CC)" \
119 AR="$(TARGET_CROSS)ar r" \
120 RANLIB="$(TARGET_CROSS)ranlib" \
121 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
122 $(OPENSSL_MAKEFLAGS) \
123 build-shared
124 # Work around openssl build bug to link libssl.so with libcrypto.so.
125 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
126 $(MAKE) -C $(PKG_BUILD_DIR) \
127 CC="$(TARGET_CC)" \
128 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
129 $(OPENSSL_MAKEFLAGS) \
130 do_linux-shared
131 $(MAKE) -C $(PKG_BUILD_DIR) \
132 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
133 $(OPENSSL_MAKEFLAGS) \
134 install
135 endef
136
137 define Build/InstallDev
138 $(INSTALL_DIR) $(1)/usr/include
139 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
140 $(INSTALL_DIR) $(1)/usr/lib/
141 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
142 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
143 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
144 $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
145 endef
146
147 define Package/libopenssl/install
148 $(INSTALL_DIR) $(1)/usr/lib
149 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libcrypto.so.* $(1)/usr/lib/
150 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libssl.so.* $(1)/usr/lib/
151 endef
152
153 define Package/openssl-util/install
154 $(INSTALL_DIR) $(1)/etc/ssl
155 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
156 $(INSTALL_DIR) $(1)/etc/ssl/certs
157 $(INSTALL_DIR) $(1)/etc/ssl/private
158 chmod 0700 $(1)/etc/ssl/private
159 $(INSTALL_DIR) $(1)/usr/bin
160 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
161 endef
162
163 $(eval $(call BuildPackage,libopenssl))
164 $(eval $(call BuildPackage,openssl-util))