credit where credit is due
[openwrt/staging/florian.git] / openwrt / 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 PATH=$(TARGET_PATH) \
56 ./Configure linux-openwrt \
57 --prefix=/usr \
58 --openssldir=/etc/ssl \
59 -I$(STAGING_DIR)/usr/include \
60 -L$(STAGING_DIR)/usr/lib -ldl \
61 -DOPENSSL_SMALL_FOOTPRINT \
62 $(OPENSSL_NO_CIPHERS) \
63 $(OPENSSL_OPTIONS) \
64 )
65 endef
66
67 define Build/Compile
68 rm -rf $(PKG_INSTALL_DIR)
69 mkdir -p $(PKG_INSTALL_DIR)
70 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
71 MAKEDEPPROG="$(TARGET_CC)" \
72 depend
73 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
74 CC="$(TARGET_CC)" \
75 AR="$(TARGET_CROSS)ar r" \
76 RANLIB="$(TARGET_CROSS)ranlib" \
77 all build-shared
78 # Work around openssl build bug to link libssl.so with libcrypto.so.
79 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
80 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
81 CC=$(TARGET_CC) \
82 CCOPTS="$(TARGET_CFLAGS) -fomit-frame-pointer" \
83 do_linux-shared
84 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
85 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
86 install
87 endef
88
89 define Build/InstallDev
90 mkdir -p $(STAGING_DIR)/usr/include
91 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
92 mkdir -p $(STAGING_DIR)/usr/lib/
93 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
94 endef
95
96 define Build/UninstallDev
97 rm -rf $(STAGING_DIR)/usr/include/openssl \
98 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
99 endef
100
101 define Package/libopenssl/install
102 install -d -m0755 $(1)/usr/lib
103 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
104 chmod 0644 $(1)/usr/lib/*
105 endef
106
107 define Package/openssl-util/install
108 install -d -m0755 $(1)/etc/ssl
109 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
110 install -d -m0755 $(1)/etc/ssl/certs
111 install -d -m0755 $(1)/etc/ssl/private
112 chmod 0700 $(1)/etc/ssl/private
113 install -d -m0755 $(1)/usr/bin
114 $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
115 endef
116
117 $(eval $(call BuildPackage,libopenssl))
118 $(eval $(call BuildPackage,openssl-util))