fix ccache error
[openwrt-10.03/.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.8b
13 PKG_RELEASE:=1
14 PKG_MD5SUM:=12cedbeb6813a0d7919dbf1f82134b86
15
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_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
21 PKG_CAT:=zcat
22
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-rmd160 no-aes192
27 OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic no-engines
28
29 include $(INCLUDE_DIR)/package.mk
30
31 define Package/libopenssl
32 SECTION:=base
33 CATEGORY:=Libraries
34 TITLE:=Open source SSL libraries
35 DEPENDS:=+zlib
36 DESCRIPTION:=Open source SSL (Secure Socket Layer) libraries
37 URL:=http://www.openssl.org/
38 endef
39
40 define Package/openssl-util
41 $(call Package/libopenssl)
42 DEPENDS:=libopenssl
43 TITLE:=OpenSSL command line utilities
44 DESCRIPTION:=OpenSSL command line utilities
45 endef
46
47 define Package/openssl-util/conffiles
48 /etc/ssl/openssl.cnf
49 endef
50
51 define Build/Configure
52         $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' $(PKG_BUILD_DIR)/Configure
53         $(SED) s/OPENWRT_OPTIMIZATION_FLAGS/$(BR2_TARGET_OPTIMIZATION)/g $(PKG_BUILD_DIR)/Configure
54         (cd $(PKG_BUILD_DIR); \
55                 ./Configure linux-openwrt \
56                   --prefix=/usr \
57                   --openssldir=/etc/ssl \
58                   -I$(STAGING_DIR)/usr/include \
59                   -L$(STAGING_DIR)/usr/lib -ldl \
60                   -DOPENSSL_SMALL_FOOTPRINT \
61                   $(OPENSSL_NO_CIPHERS) \
62                   $(OPENSSL_OPTIONS) \
63         )
64 endef
65
66 define Build/Compile
67         rm -rf $(PKG_INSTALL_DIR)
68         mkdir -p $(PKG_INSTALL_DIR)
69         $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
70                 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
71                 depend
72         $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
73                 CC="$(TARGET_CC)" \
74                 AR="$(TARGET_CROSS)ar r" \
75                 RANLIB="$(TARGET_CROSS)ranlib" \
76                 all build-shared
77         # Work around openssl build bug to link libssl.so with libcrypto.so.
78         -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
79         $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
80                 CC="$(TARGET_CC)" \
81                 CCOPTS="$(TARGET_CFLAGS) -fomit-frame-pointer" \
82                 do_linux-shared
83         $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
84                 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
85                 install
86 endef
87
88 define Build/InstallDev
89         mkdir -p $(STAGING_DIR)/usr/include
90         $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
91         mkdir -p $(STAGING_DIR)/usr/lib/
92         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
93 endef
94         
95 define Build/UninstallDev
96         rm -rf  $(STAGING_DIR)/usr/include/openssl \
97                 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
98 endef
99
100 define Package/libopenssl/install
101         install -d -m0755 $(1)/usr/lib
102         $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
103         chmod 0644 $(1)/usr/lib/*
104 endef
105
106 define Package/openssl-util/install
107         install -d -m0755 $(1)/etc/ssl
108         $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
109         install -d -m0755 $(1)/etc/ssl/certs
110         install -d -m0755 $(1)/etc/ssl/private
111         chmod 0700 $(1)/etc/ssl/private
112         install -d -m0755 $(1)/usr/bin
113         $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
114 endef
115
116 $(eval $(call BuildPackage,libopenssl))
117 $(eval $(call BuildPackage,openssl-util))