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