Remove packages when cleaning
[openwrt.git] / openwrt / package / openssl / openssl.mk
1 #############################################################
2 #
3 # openssl
4 #
5 #############################################################
6
7 # TARGETS
8 OPENSSL_SITE:=http://www.openssl.org/source
9 OPENSSL_SOURCE:=openssl-0.9.7d.tar.gz
10 OPENSSL_DIR:=$(BUILD_DIR)/openssl-0.9.7d
11 OPENSSL_IPK_DIR=$(OPENWRT_IPK_DIR)/openssl
12 OPENSSL_PATCH=$(OPENSSL_IPK_DIR)/openssl.patch
13
14 OPENSSL_IPK_BUILD_DIR=$(BUILD_DIR)/openssl-0.9.7d-ipk
15 LIBSSL_IPK=$(BUILD_DIR)/libssl_0.9.7d_mipsel.ipk
16
17 $(DL_DIR)/$(OPENSSL_SOURCE):
18 $(WGET) -P $(DL_DIR) $(OPENSSL_SITE)/$(OPENSSL_SOURCE)
19
20 $(OPENSSL_DIR)/.unpacked: $(DL_DIR)/$(OPENSSL_SOURCE) $(OPENSSL_PATCH)
21 gunzip -c $(DL_DIR)/$(OPENSSL_SOURCE) | tar -C $(BUILD_DIR) -xvf -
22 cat $(OPENSSL_PATCH) | patch -p1 -d $(OPENSSL_DIR)
23 # sigh... we have to resort to this just to set a gcc flag.
24 $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \
25 $(OPENSSL_DIR)/Configure
26 touch $(OPENSSL_DIR)/.unpacked
27
28 $(OPENSSL_DIR)/Makefile: $(OPENSSL_DIR)/.unpacked
29 (cd $(OPENSSL_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_OPTS) no-threads \
34 shared no-idea no-mdc2 no-rc5)
35
36 $(OPENSSL_DIR)/apps/openssl: $(OPENSSL_DIR)/Makefile
37 $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) all build-shared
38 # Work around openssl build bug to link libssl.so with libcrypto.so.
39 -rm $(OPENSSL_DIR)/libssl.so.*.*.*
40 $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) do_linux-shared
41
42 $(STAGING_DIR)/lib/libcrypto.a: $(OPENSSL_DIR)/apps/openssl
43 $(MAKE) CC=$(TARGET_CC) INSTALL_PREFIX=$(STAGING_DIR) -C $(OPENSSL_DIR) install
44 cp -fa $(OPENSSL_DIR)/libcrypto.so* $(STAGING_DIR)/lib/
45 chmod a-x $(STAGING_DIR)/lib/libcrypto.so.0.9.7
46 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so)
47 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so.0)
48 cp -fa $(OPENSSL_DIR)/libssl.so* $(STAGING_DIR)/lib/
49 chmod a-x $(STAGING_DIR)/lib/libssl.so.0.9.7
50 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so)
51 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so.0)
52
53 $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7: $(STAGING_DIR)/lib/libcrypto.a
54 mkdir -p $(TARGET_DIR)/usr/lib
55 cp -fa $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/usr/lib/
56 cp -fa $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/usr/lib/
57 #cp -fa $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/
58 -$(STRIP) $(TARGET_DIR)/usr/lib/libssl.so.0.9.7
59 -$(STRIP) $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7
60
61 $(TARGET_DIR)/usr/lib/libssl.a: $(STAGING_DIR)/lib/libcrypto.a
62 mkdir -p $(TARGET_DIR)/usr/include
63 cp -a $(STAGING_DIR)/include/openssl $(TARGET_DIR)/usr/include/
64 cp -dpf $(STAGING_DIR)/lib/libssl.a $(TARGET_DIR)/usr/lib/
65 cp -dpf $(STAGING_DIR)/lib/libcrypto.a $(TARGET_DIR)/usr/lib/
66 touch -c $(TARGET_DIR)/usr/lib/libssl.a
67
68 openssl-headers: $(TARGET_DIR)/usr/lib/libssl.a
69
70 openssl: uclibc $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7
71
72 $(LIBSSL_IPK): uclibc $(STAGING_DIR)/lib/libcrypto.a
73 mkdir -p $(OPENSSL_IPK_BUILD_DIR)/CONTROL
74 cp $(OPENSSL_IPK_DIR)/control $(OPENSSL_IPK_BUILD_DIR)/CONTROL/control
75 mkdir -p $(OPENSSL_IPK_BUILD_DIR)/usr/lib
76 cp -fa $(STAGING_DIR)/lib/libcrypto.so* $(OPENSSL_IPK_BUILD_DIR)/usr/lib/
77 cp -fa $(STAGING_DIR)/lib/libssl.so* $(OPENSSL_IPK_BUILD_DIR)/usr/lib/
78 -$(STRIP) $(OPENSSL_IPK_BUILD_DIR)/usr/lib/libssl.so.0.9.7
79 -$(STRIP) $(OPENSSL_IPK_BUILD_DIR)/usr/lib/libcrypto.so.0.9.7
80 cd $(BUILD_DIR); $(IPKG_BUILD) $(OPENSSL_IPK_BUILD_DIR)
81
82 openssl-ipk: $(LIBSSL_IPK)
83
84 openssl-source: $(DL_DIR)/$(OPENSSL_SOURCE)
85
86 openssl-clean:
87 rm -f $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/openssl
88 rm -f $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/lib/libcrypto.so*
89 rm -f $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/lib/libssl.so*
90 rm -rf $(OPENSSL_IPK_BUILD_DIR)
91 $(MAKE) -C $(OPENSSL_DIR) clean
92
93 openssl-dirclean:
94 rm -rf $(OPENSSL_DIR)
95
This page took 0.053415 seconds and 5 git commands to generate.