f72b99bc928ccf0d2f2e4fa9d88573992b39c1d0
[openwrt/svn-archive/archive.git] / package / openssl / Makefile
1 #
2 # Copyright (C) 2006-2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=openssl
12 PKG_VERSION:=0.9.8i
13 PKG_RELEASE:=3.1
14
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:=561e00f18821c74b2b86c8c7786f9d8b
21
22 include $(INCLUDE_DIR)/package.mk
23
24 define Package/openssl/Default
25 TITLE:=Open source SSL toolkit
26 URL:=http://www.openssl.org/
27 endef
28
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.
34 endef
35
36 define Package/libopenssl
37 $(call Package/openssl/Default)
38 SECTION:=libs
39 CATEGORY:=Libraries
40 DEPENDS:=+zlib
41 TITLE+= (libraries)
42 endef
43
44 define Package/libopenssl/description
45 $(call Package/openssl/Default/description)
46 This package contains the OpenSSL shared libraries, needed by other
47 programs.
48 endef
49
50 define Package/openssl-util
51 $(call Package/openssl/Default)
52 SECTION:=utils
53 CATEGORY:=Utilities
54 DEPENDS:=+libopenssl
55 TITLE+= (utility)
56 endef
57
58 define Package/openssl-util/conffiles
59 /etc/ssl/openssl.cnf
60 endef
61
62 define Package/openssl-util/description
63 $(call Package/openssl/Default/description)
64 This package contains the OpenSSL command-line utility.
65 endef
66
67
68 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-smime \
69 no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
70 ifeq ($(BOARD),ixp4xx)
71 OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
72 no-sse2 no-perlasm --with-cryptodev
73 else
74 OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-threads zlib-dynamic \
75 no-engines no-sse2 no-perlasm
76 endif
77
78
79 define Build/Configure
80 (cd $(PKG_BUILD_DIR); \
81 ./Configure linux-openwrt \
82 --prefix=/usr \
83 --openssldir=/etc/ssl \
84 $(TARGET_CPPFLAGS) \
85 $(TARGET_LDFLAGS) -ldl \
86 -DOPENSSL_SMALL_FOOTPRINT \
87 $(OPENSSL_NO_CIPHERS) \
88 $(OPENSSL_OPTIONS) \
89 )
90 endef
91
92 TARGET_CFLAGS += $(FPIC)
93
94 define Build/Compile
95 # XXX: OpenSSL "make depend" will look for installed headers before its own,
96 # so remove installed stuff first
97 -$(SUBMAKE) -j1 clean-staging
98 $(MAKE) -C $(PKG_BUILD_DIR) \
99 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
100 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
101 depend
102 $(MAKE) -C $(PKG_BUILD_DIR) \
103 CC="$(TARGET_CC)" \
104 AR="$(TARGET_CROSS)ar r" \
105 RANLIB="$(TARGET_CROSS)ranlib" \
106 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
107 all build-shared
108 # Work around openssl build bug to link libssl.so with libcrypto.so.
109 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
110 $(MAKE) -C $(PKG_BUILD_DIR) \
111 CC="$(TARGET_CC)" \
112 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
113 do_linux-shared
114 $(MAKE) -C $(PKG_BUILD_DIR) \
115 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
116 install
117 endef
118
119 define Build/InstallDev
120 mkdir -p $(1)/usr/include
121 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(1)/usr/include/
122 mkdir -p $(1)/usr/lib/
123 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(1)/usr/lib/
124 mkdir -p $(1)/usr/lib/pkgconfig
125 $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc $(1)/usr/lib/pkgconfig/
126 $(SED) 's#$(TARGET_LDFLAGS)##g' $(1)/usr/lib/pkgconfig/{openssl,libcrypto,libssl}.pc
127 endef
128
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/*
133 endef
134
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 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
143 endef
144
145 $(eval $(call BuildPackage,libopenssl))
146 $(eval $(call BuildPackage,openssl-util))