f0b5431ad681951b94883509f6db06096bed6699
[openwrt/svn-archive/archive.git] / openwrt / package / openssl / Makefile
1 # $Id$
2
3 include $(TOPDIR)/rules.mk
4
5 PKG_NAME:=openssl
6 PKG_VERSION:=0.9.8a
7 PKG_RELEASE:=1
8 PKG_MD5SUM:=1d16c727c10185e4d694f87f5e424ee1
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-rc2 no-rc5
21
22 include $(TOPDIR)/package/rules.mk
23
24 $(eval $(call PKG_template,LIBOPENSSL,libopenssl,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
25 $(eval $(call PKG_template,OPENSSL_UTIL,openssl-util,$(PKG_VERSION)-$(PKG_RELEASE),$(ARCH)))
26
27 $(PKG_BUILD_DIR)/.configured:
28 $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' $(PKG_BUILD_DIR)/Configure
29 (cd $(PKG_BUILD_DIR); \
30 PATH=$(TARGET_PATH) \
31 ./Configure linux-generic32 \
32 --prefix=/usr \
33 --openssldir=/etc/ssl \
34 -I$(STAGING_DIR)/usr/include \
35 -L$(STAGING_DIR)/usr/lib -ldl \
36 $(OPENSSL_NO_CIPHERS) \
37 shared no-asm no-ec no-err no-fips no-hw no-krb5 no-threads zlib-dynamic \
38 )
39 touch $@
40
41 $(PKG_BUILD_DIR)/.built:
42 rm -rf $(PKG_INSTALL_DIR)
43 mkdir -p $(PKG_INSTALL_DIR)
44 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
45 MAKEDEPPROG="$(TARGET_CC)" \
46 depend
47 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
48 CC="$(TARGET_CC)" \
49 CCOPTS="$(TARGET_CFLAGS) -fomit-frame-pointer" \
50 AR="$(TARGET_CROSS)ar r" \
51 RANLIB="$(TARGET_CROSS)ranlib" \
52 all build-shared
53 # Work around openssl build bug to link libssl.so with libcrypto.so.
54 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
55 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
56 CC=$(TARGET_CC) \
57 CCOPTS="$(TARGET_CFLAGS) -fomit-frame-pointer" \
58 do_linux-shared
59 $(MAKE) -C $(PKG_BUILD_DIR) -j1 \
60 INSTALL_PREFIX="$(PKG_INSTALL_DIR)" \
61 install
62 touch $@
63
64 $(IPKG_LIBOPENSSL):
65 install -d -m0755 $(IDIR_LIBOPENSSL)/usr/lib
66 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.so.* $(IDIR_LIBOPENSSL)/usr/lib/
67 chmod 0644 $(IDIR_LIBOPENSSL)/usr/lib/*
68 $(RSTRIP) $(IDIR_LIBOPENSSL)
69 $(IPKG_BUILD) $(IDIR_LIBOPENSSL) $(PACKAGE_DIR)
70
71 $(IPKG_OPENSSL_UTIL):
72 install -d -m0755 $(IDIR_OPENSSL_UTIL)/etc/ssl
73 $(CP) $(PKG_INSTALL_DIR)/etc/ssl/openssl.cnf $(IDIR_OPENSSL_UTIL)/etc/ssl/
74 install -d -m0755 $(IDIR_OPENSSL_UTIL)/etc/ssl/certs
75 install -d -m0700 $(IDIR_OPENSSL_UTIL)/etc/ssl/private
76 install -d -m0755 $(IDIR_OPENSSL_UTIL)/usr/bin
77 $(CP) $(PKG_INSTALL_DIR)/usr/bin/openssl $(IDIR_OPENSSL_UTIL)/usr/bin/
78 $(RSTRIP) $(IDIR_OPENSSL_UTIL)
79 $(IPKG_BUILD) $(IDIR_OPENSSL_UTIL) $(PACKAGE_DIR)
80
81 $(STAGING_DIR)/usr/lib/libssl.so: $(PKG_BUILD_DIR)/.built
82 mkdir -p $(STAGING_DIR)/usr/include
83 $(CP) $(PKG_INSTALL_DIR)/usr/include/openssl $(STAGING_DIR)/usr/include/
84 mkdir -p $(STAGING_DIR)/usr/lib/
85 $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} $(STAGING_DIR)/usr/lib/
86 touch $@
87
88 install-dev: $(STAGING_DIR)/usr/lib/libssl.so
89
90 uninstall-dev:
91 rm -rf \
92 $(STAGING_DIR)/usr/include/openssl \
93 $(STAGING_DIR)/usr/lib/lib{crypto,ssl}.{a,so*} \
94
95 compile-targets: install-dev
96 clean-targets: uninstall-dev