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