standardize Makefile, change section from base to libs and utils, add detailed descri...
[openwrt/staging/mkresin.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
15 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
16 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
17 PKG_SOURCE_URL:=http://www.openssl.org/source/ \
18 ftp://ftp.funet.fi/pub/crypt/cryptography/libs/openssl/source/ \
19 ftp://ftp.webmonster.de/pub/openssl/source/ \
20 ftp://ftp.sunet.se/pub/security/tools/net/openssl/source/
21 PKG_MD5SUM:=12cedbeb6813a0d7919dbf1f82134b86
22 PKG_CAT:=zcat
23
24 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/openssl/Default
29 TITLE:=Open source SSL toolkit
30 DESCRIPTION:=\
31 The OpenSSL Project is a collaborative effort to develop a robust, \\\
32 commercial-grade, full-featured, and Open Source toolkit implementing the \\\
33 Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) \\\
34 protocols as well as a full-strength general purpose cryptography library.
35 URL:=http://www.openssl.org/
36 endef
37
38 define Package/libopenssl
39 $(call Package/openssl/Default)
40 SECTION:=libs
41 CATEGORY:=Libraries
42 DEPENDS:=+zlib
43 TITLE+= (libraries)
44 DESCRIPTION+=\\\
45 \\\
46 This package contains the OpenSSL shared libraries, needed by other \\\
47 programs.
48 endef
49
50 define Package/openssl-util
51 $(call Package/openssl/Default)
52 SECTION:=utils
53 CATEGORY:=Utilities
54 DEPENDS:=+libopenssl
55 TITLE+= (utility)
56 DESCRIPTION+=\\\
57 \\\
58 This package contains the OpenSSL command-line utility.
59 endef
60
61 define Package/openssl-util/conffiles
62 /etc/ssl/openssl.cnf
63 endef
64
65 OPENSSL_NO_CIPHERS:= no-idea no-md2 no-mdc2 no-rc5 no-sha0 no-rmd160 no-aes192
66 OPENSSL_OPTIONS:= shared no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic no-engines
67
68 define Build/Configure
69 $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' $(PKG_BUILD_DIR)/Configure
70 $(SED) s/OPENWRT_OPTIMIZATION_FLAGS/$(BR2_TARGET_OPTIMIZATION)/g $(PKG_BUILD_DIR)/Configure
71 (cd $(PKG_BUILD_DIR); \
72 ./Configure linux-openwrt \
73 --prefix=/usr \
74 --openssldir=/etc/ssl \
75 -I$(STAGING_DIR)/usr/include \
76 -L$(STAGING_DIR)/usr/lib -ldl \
77 -DOPENSSL_SMALL_FOOTPRINT \
78 $(OPENSSL_NO_CIPHERS) \
79 $(OPENSSL_OPTIONS) \
80 )
81 endef
82
83 define Build/Compile
84 rm -rf $(PKG_INSTALL_DIR)
85 mkdir -p $(PKG_INSTALL_DIR)
86 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
87 MAKEDEPPROG="$(TARGET_CROSS)gcc" \
88 depend
89 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
90 CC="$(TARGET_CC)" \
91 AR="$(TARGET_CROSS)ar r" \
92 RANLIB="$(TARGET_CROSS)ranlib" \
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) -j1 \
97 CC="$(TARGET_CC)" \
98 CCOPTS="$(TARGET_CFLAGS) -fomit-frame-pointer" \
99 do_linux-shared
100 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
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 \
114 $(STAGING_DIR)/usr/include/openssl \
115 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*}
116 endef
117
118 define Package/libopenssl/install
119 install -d -m0755 $(1)/usr/lib
120 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(1)/usr/lib/
121 chmod 0644 $(1)/usr/lib/*
122 endef
123
124 define Package/openssl-util/install
125 install -d -m0755 $(1)/etc/ssl
126 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(1)/etc/ssl/
127 install -d -m0755 $(1)/etc/ssl/certs
128 install -d -m0755 $(1)/etc/ssl/private
129 chmod 0700 $(1)/etc/ssl/private
130 install -d -m0755 $(1)/usr/bin
131 $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(1)/usr/bin/
132 endef
133
134 $(eval $(call BuildPackage,libopenssl))
135 $(eval $(call BuildPackage,openssl-util))