andersee's ftruncate patch
[openwrt.git] / obsolete-buildroot / make / 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_PATCH=$(SOURCE_DIR)/openssl.patch
12
13 OPENSSL_IPK_DIR=$(BUILD_DIR)/openssl-0.9.7d-ipk
14 LIBSSL_IPK=$(BUILD_DIR)/libssl_0.9.7d_mipsel.ipk
15
16 $(DL_DIR)/$(OPENSSL_SOURCE):
17 $(WGET) -P $(DL_DIR) $(OPENSSL_SITE)/$(OPENSSL_SOURCE)
18
19 $(OPENSSL_DIR)/.unpacked: $(DL_DIR)/$(OPENSSL_SOURCE) $(OPENSSL_PATCH)
20 gunzip -c $(DL_DIR)/$(OPENSSL_SOURCE) | tar -C $(BUILD_DIR) -xvf -
21 cat $(OPENSSL_PATCH) | patch -p1 -d $(OPENSSL_DIR)
22 # sigh... we have to resort to this just to set a gcc flag.
23 $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \
24 $(OPENSSL_DIR)/Configure
25 touch $(OPENSSL_DIR)/.unpacked
26
27 $(OPENSSL_DIR)/Makefile: $(OPENSSL_DIR)/.unpacked
28 (cd $(OPENSSL_DIR); \
29 CFLAGS="-DOPENSSL_NO_KRB5 -DOPENSSL_NO_IDEA -DOPENSSL_NO_MDC2 -DOPENSSL_NO_RC5" \
30 PATH=$(TARGET_PATH) ./Configure linux-$(ARCH) --prefix=/ \
31 --openssldir=/usr/lib/ssl -L$(STAGING_DIR)/lib -ldl \
32 -I$(STAGING_DIR)/include $(OPENSSL_OPTS) no-threads \
33 shared no-idea no-mdc2 no-rc5)
34
35 $(OPENSSL_DIR)/apps/openssl: $(OPENSSL_DIR)/Makefile
36 $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) all build-shared
37 # Work around openssl build bug to link libssl.so with libcrypto.so.
38 -rm $(OPENSSL_DIR)/libssl.so.*.*.*
39 $(MAKE) CC=$(TARGET_CC) -C $(OPENSSL_DIR) do_linux-shared
40
41 $(STAGING_DIR)/lib/libcrypto.a: $(OPENSSL_DIR)/apps/openssl
42 $(MAKE) CC=$(TARGET_CC) INSTALL_PREFIX=$(STAGING_DIR) -C $(OPENSSL_DIR) install
43 cp -fa $(OPENSSL_DIR)/libcrypto.so* $(STAGING_DIR)/lib/
44 chmod a-x $(STAGING_DIR)/lib/libcrypto.so.0.9.7
45 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so)
46 (cd $(STAGING_DIR)/lib; ln -fs libcrypto.so.0.9.7 libcrypto.so.0)
47 cp -fa $(OPENSSL_DIR)/libssl.so* $(STAGING_DIR)/lib/
48 chmod a-x $(STAGING_DIR)/lib/libssl.so.0.9.7
49 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so)
50 (cd $(STAGING_DIR)/lib; ln -fs libssl.so.0.9.7 libssl.so.0)
51
52 $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7: $(STAGING_DIR)/lib/libcrypto.a
53 mkdir -p $(TARGET_DIR)/usr/lib
54 cp -fa $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/usr/lib/
55 cp -fa $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/usr/lib/
56 #cp -fa $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/
57 -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libssl.so.0.9.7
58 -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7
59
60 $(TARGET_DIR)/usr/lib/libssl.a: $(STAGING_DIR)/lib/libcrypto.a
61 mkdir -p $(TARGET_DIR)/usr/include
62 cp -a $(STAGING_DIR)/include/openssl $(TARGET_DIR)/usr/include/
63 cp -dpf $(STAGING_DIR)/lib/libssl.a $(TARGET_DIR)/usr/lib/
64 cp -dpf $(STAGING_DIR)/lib/libcrypto.a $(TARGET_DIR)/usr/lib/
65 touch -c $(TARGET_DIR)/usr/lib/libssl.a
66
67 openssl-headers: $(TARGET_DIR)/usr/lib/libssl.a
68
69 openssl: uclibc $(TARGET_DIR)/usr/lib/libcrypto.so.0.9.7
70
71 $(LIBSSL_IPK): uclibc $(STAGING_DIR)/usr/lib/libcrypto.so.0.9.7
72 mkdir -p $(OPENSSL_IPK_DIR)/CONTROL
73 cp $(SOURCE_DIR)/libssl.control $(OPENSSL_IPK_DIR)/CONTROL/control
74 mkdir -p $(OPENSSL_IPK_DIR)/usr/lib
75 cp -fa $(STAGING_DIR)/lib/libcrypto.so* $(OPENSSL_IPK_DIR)/usr/lib/
76 cp -fa $(STAGING_DIR)/lib/libssl.so* $(OPENSSL_IPK_DIR)/usr/lib/
77 -$(STRIP) --strip-unneeded $(OPENSSL_IPK_DIR)/usr/lib/libssl.so.0.9.7
78 -$(STRIP) --strip-unneeded $(OPENSSL_IPK_DIR)/usr/lib/libcrypto.so.0.9.7
79 cd $(BUILD_DIR); $(STAGING_DIR)/bin/ipkg-build -c -o root -g root $(OPENSSL_IPK_DIR)
80
81 openssl-ipk: $(LIBSSL_IPK)
82
83 openssl-source: $(DL_DIR)/$(OPENSSL_SOURCE)
84
85 openssl-clean:
86 rm -f $(STAGING_DIR)/bin/openssl $(TARGET_DIR)/bin/openssl
87 rm -f $(STAGING_DIR)/lib/libcrypto.so* $(TARGET_DIR)/lib/libcrypto.so*
88 rm -f $(STAGING_DIR)/lib/libssl.so* $(TARGET_DIR)/lib/libssl.so*
89 $(MAKE) -C $(OPENSSL_DIR) clean
90
91 openssl-dirclean:
92 rm -rf $(OPENSSL_DIR)
93
This page took 0.047345 seconds and 5 git commands to generate.