add a default for PKG_BUILD_DIR and PKG_INSTALL_DIR (will use KERNEL_BUILD_DIR if...
[openwrt/openwrt.git] / package / openssl / Makefile
1 #
2 # Copyright (C) 2006 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.8d
13 PKG_RELEASE:=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:=8ed1853538e1d05a1f5ada61ebf8bffa
21 PKG_CAT:=zcat
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/openssl/Default
26 TITLE:=Open source SSL toolkit
27 DESCRIPTION:=\
28 The OpenSSL Project is a collaborative effort to develop a robust, \\\
29 commercial-grade, full-featured, and Open Source toolkit implementing the \\\
30 Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) \\\
31 protocols as well as a full-strength general purpose cryptography library.
32 URL:=http://www.openssl.org/
33 endef
34
35 define Package/libopenssl
36 $(call Package/openssl/Default)
37 SECTION:=libs
38 CATEGORY:=Libraries
39 DEPENDS:=+zlib
40 TITLE+= (libraries)
41 DESCRIPTION+=\\\
42 \\\
43 This package contains the OpenSSL shared libraries, needed by other \\\
44 programs.
45 endef
46
47 define Package/openssl-util
48 $(call Package/openssl/Default)
49 SECTION:=utils
50 CATEGORY:=Utilities
51 DEPENDS:=+libopenssl
52 TITLE+= (utility)
53 DESCRIPTION+=\\\
54 \\\
55 This package contains the OpenSSL command-line utility.
56 endef
57
58 define Package/openssl-util/conffiles
59 /etc/ssl/openssl.cnf
60 endef
61
62 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc2 no-rc5 no-sha0 no-smime \
63 no-rmd160 no-aes192 no-ripemd no-camellia no-ans1 no-krb5
64 OPENSSL_OPTIONS:= shared no-dso no-ec no-err no-fips no-hw no-threads zlib-dynamic \
65 no-engines no-sse2 no-perlasm
66
67
68 define Build/Configure
69 (cd $(PKG_BUILD_DIR); \
70 ./Configure linux-openwrt \
71 --prefix=/usr \
72 --openssldir=/etc/ssl \
73 -I$(STAGING_DIR)/usr/include \
74 -L$(STAGING_DIR)/usr/lib -ldl \
75 -DOPENSSL_SMALL_FOOTPRINT \
76 $(OPENSSL_NO_CIPHERS) \
77 $(OPENSSL_OPTIONS) \
78 )
79 endef
80
81 define Build/Compile
82 rm -rf $(PKG_INSTALL_DIR)
83 mkdir -p $(PKG_INSTALL_DIR)
84 $(MAKE) -C $(PKG_BUILD_DIR) \
85 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
86 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
87 depend
88 $(MAKE) -C $(PKG_BUILD_DIR) \
89 CC="$(TARGET_CC)" \
90 AR="$(TARGET_CROSS)ar r" \
91 RANLIB="$(TARGET_CROSS)ranlib" \
92 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
93 all build-shared
94 # Work around openssl build bug to link libssl.so with libcrypto.so.
95 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
96 $(MAKE) -C $(PKG_BUILD_DIR) \
97 CC="$(TARGET_CC)" \
98 OPENWRT_OPTIMIZATION_FLAGS="$(TARGET_CFLAGS)" \
99 do_linux-shared
100 $(MAKE) -C $(PKG_BUILD_DIR) \
101 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
102 install
103 endef
104
105 define Build/InstallDev
106 mkdir -p $(STAGING_DIR)/usr/include
107 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
108 mkdir -p $(STAGING_DIR)/usr/lib/
109 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
110 endef
111
112 define Build/UninstallDev
113 rm -rf $(STAGING_DIR)/usr/include/openssl \
114 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
115 endef
116
117 define Package/libopenssl/install
118 $(INSTALL_DIR) $(1)/usr/lib
119 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
120 chmod 0644 $(1)/usr/lib/*
121 endef
122
123 define Package/openssl-util/install
124 $(INSTALL_DIR) $(1)/etc/ssl
125 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
126 $(INSTALL_DIR) $(1)/etc/ssl/certs
127 $(INSTALL_DIR) $(1)/etc/ssl/private
128 chmod 0700 $(1)/etc/ssl/private
129 $(INSTALL_DIR) $(1)/usr/bin
130 $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
131 endef
132
133 $(eval $(call BuildPackage,libopenssl))
134 $(eval $(call BuildPackage,openssl-util))