fix openssl build
[openwrt.git] / package / openssl / Makefile
1 include $(TOPDIR)/rules.mk
2
3 PKG_NAME := openssl
4 PKG_VERSION := 0.9.7e
5 PKG_RELEASE := 1
6
7 PKG_SOURCE_SITE := http://www.openssl.org/source
8 PKG_SOURCE_FILE := $(PKG_NAME)-$(PKG_VERSION).tar.gz
9 PKG_SOURCE_CAT := zcat
10 PKG_SOURCE_DIR := $(PKG_NAME)-$(PKG_VERSION)
11 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_SOURCE_DIR)
12 PKG_IPK := $(PACKAGE_DIR)/$(PKG_NAME)_$(PKG_VERSION)-$(PKG_RELEASE)_$(ARCH).ipk
13
14 OPENSSL_NO_CIPHERS:=no-idea no-mdc2 no-rc5 no-rc2 no-md2 no-md4
15
16 $(DL_DIR)/$(PKG_SOURCE_FILE):
17 mkdir -p $(DL_DIR)
18 $(WGET) -P $(DL_DIR) $(PKG_SOURCE_SITE)/$(PKG_SOURCE_FILE)
19
20 $(PKG_BUILD_DIR)/.patched: $(DL_DIR)/$(PKG_SOURCE_FILE)
21 mkdir -p $(TOOL_BUILD_DIR)
22 $(PKG_SOURCE_CAT) $(DL_DIR)/$(PKG_SOURCE_FILE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
23 $(PATCH) $(PKG_BUILD_DIR) ./patches
24 $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \
25 $(PKG_BUILD_DIR)/Configure
26 touch $(PKG_BUILD_DIR)/.patched
27
28 $(PKG_BUILD_DIR)/.configured: $(PKG_BUILD_DIR)/.patched
29 (cd $(PKG_BUILD_DIR); \
30 CFLAGS="-DOPENSSL_NO_KRB5 -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5" \
31 PATH=$(TARGET_PATH) ./Configure linux-$(ARCH) --prefix=/ \
32 --openssldir=/usr/lib/ssl -L$(STAGING_DIR)/lib -ldl \
33 -I$(STAGING_DIR)/include $(OPENSSL_NO_CIPHERS) \
34 shared no-krb5 no-ec no-engine zlib-dynamic no-hw no-threads )
35 touch $(PKG_BUILD_DIR)/.configured
36
37 $(PKG_BUILD_DIR)/apps/openssl: $(PKG_BUILD_DIR)/.configured
38 $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) all build-shared
39 # Work around openssl build bug to link libssl.so with libcrypto.so.
40 -rm $(PKG_BUILD_DIR)/libssl.so.*.*.*
41 $(MAKE) CC=$(TARGET_CC) -C $(PKG_BUILD_DIR) do_linux-shared
42
43 $(STAGING_DIR)/lib/libssl.so: $(PKG_BUILD_DIR)/apps/openssl
44 $(MAKE) CC=$(TARGET_CC) INSTALL_PREFIX=$(STAGING_DIR) -C $(PKG_BUILD_DIR) install_sw
45 cp -fa $(PKG_BUILD_DIR)/libcrypto.so* $(STAGING_DIR)/lib/
46 chmod a-x $(STAGING_DIR)/lib/libcrypto.so.0.9.7
47 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so)
48 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so.0)
49 cp -fa $(PKG_BUILD_DIR)/libssl.so* $(STAGING_DIR)/lib/
50 chmod a-x $(STAGING_DIR)/lib/libssl.so.0.9.7
51 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so)
52 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so.0)
53
54 $(PKG_IPK): $(STAGING_DIR)/lib/libssl.so
55 mkdir -p $(PACKAGE_DIR)
56 $(SCRIPT_DIR)/make-ipkg-dir.sh $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) $(PKG_NAME).control $(PKG_VERSION)-$(PKG_RELEASE) $(ARCH)
57 mkdir -p $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
58 cp -a $(STAGING_DIR)/lib/libssl.so* $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
59 cp -a $(STAGING_DIR)/lib/libcrypto.so* $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib
60 $(STRIP) $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME)/usr/lib/*
61 $(IPKG_BUILD) $(PKG_BUILD_DIR)/ipkg/$(PKG_NAME) $(PACKAGE_DIR)
62
63 $(IPKG_STATE_DIR)/info/openssl.list: $(PKG_IPK)
64 $(IPKG) install $(PKG_IPK)
65
66 source: $(DL_DIR)/$(PKG_SOURCE_FILE)
67 prepare: $(PKG_BUILD_DIR)/.patched
68 compile: $(STAGING_DIR)/lib/libssl.so $(PKG_IPK)
69 install: $(PKG_ZLIB) $(IPKG_STATE_DIR)/info/openssl.list
70
71 clean:
72 rm -rf $(PKG_BUILD_DIR)
73 rm -f $(STAGING_DIR)/lib/libssl*
74 rm -f $(STAGING_DIR)/lib/libcrypto*
75 rm -f $(PKG_IPK)
76
This page took 0.079791 seconds and 5 git commands to generate.