Wed, 29 Jul 2009 11:23:17 +0200
Import package vendor original sources for necessary manipulations.
michael@1 | 1 | # This Makefile builds all the third_party code |
michael@1 | 2 | # It shouldn't be called by anything other than automated scripts |
michael@1 | 3 | |
michael@1 | 4 | # Both lzo and openvpn should be built universally |
michael@1 | 5 | |
michael@1 | 6 | LZO_DIR=lzo-2.02 |
michael@1 | 7 | PKCS11_DIR=pkcs11-helper-1.07 |
michael@1 | 8 | |
michael@1 | 9 | all: tuntap lzo openvpn |
michael@1 | 10 | |
michael@1 | 11 | pkcs11-helper:: |
michael@1 | 12 | @for a in ppc i686; do \ |
michael@1 | 13 | echo Configure PKCS11-Helper for $$a; \ |
michael@1 | 14 | cd $(PKCS11_DIR); \ |
michael@1 | 15 | echo Forcefully be clean; \ |
michael@1 | 16 | $(MAKE) clean; \ |
michael@1 | 17 | OPENSSL_LIBS="-lcrypto" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --enable-static --disable-dependency-tracking --prefix=$$(pwd)/staging_$$a/ --includedir=$$(pwd)/staging/include/; \ |
michael@1 | 18 | echo Build PKCS11-Helper; \ |
michael@1 | 19 | $(MAKE); \ |
michael@1 | 20 | echo Install to third_party/$(PKCS11_DIR)/staging_$$a; \ |
michael@1 | 21 | $(MAKE) install; \ |
michael@1 | 22 | cd ../; \ |
michael@1 | 23 | done |
michael@1 | 24 | mkdir -p $(PKCS11_DIR)/staging/lib |
michael@1 | 25 | lipo $(PKCS11_DIR)/staging_*/lib/libpkcs11-helper.a -create -output $(PKCS11_DIR)/staging/lib/libpkcs11-helper.a |
michael@1 | 26 | cp $(PKCS11_DIR)/staging_i686/lib/libpkcs11-helper.la $(PKCS11_DIR)/staging/lib/ |
michael@1 | 27 | |
michael@1 | 28 | lzo:: |
michael@1 | 29 | @for a in ppc i686; do \ |
michael@1 | 30 | echo Configure LZO for $$a; \ |
michael@1 | 31 | cd $(LZO_DIR); \ |
michael@1 | 32 | echo Forcefully be clean; \ |
michael@1 | 33 | $(MAKE) clean; \ |
michael@1 | 34 | CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --disable-dependency-tracking --disable-asm --prefix=$$(pwd)/staging_$$a/ --includedir=$$(pwd)/staging/include/; \ |
michael@1 | 35 | echo Build LZO; \ |
michael@1 | 36 | $(MAKE); \ |
michael@1 | 37 | echo Install to third_party/$(LZO_DIR)/staging_$$a; \ |
michael@1 | 38 | $(MAKE) install; \ |
michael@1 | 39 | cd ../; \ |
michael@1 | 40 | done |
michael@1 | 41 | |
michael@1 | 42 | # Use lipo to create a universal library |
michael@1 | 43 | mkdir -p $(LZO_DIR)/staging/lib |
michael@1 | 44 | lipo $(LZO_DIR)/staging_*/lib/liblzo2.a -create -output $(LZO_DIR)/staging/lib/liblzo2.a |
michael@1 | 45 | cp $(LZO_DIR)/staging_i686/lib/liblzo2.la $(LZO_DIR)/staging/lib/ |
michael@1 | 46 | |
michael@1 | 47 | # wtf? library was renamed??? move it back so openvpn will build correctly |
michael@1 | 48 | cd $(LZO_DIR)/staging/lib/; mv liblzo2.a liblzo.a; mv liblzo2.la liblzo.la |
michael@1 | 49 | |
michael@1 | 50 | lzo-clean: |
michael@1 | 51 | $(MAKE) -C $(LZO_DIR) clean |
michael@1 | 52 | rm -rf $(LZO_DIR)/staging* |
michael@1 | 53 | |
michael@1 | 54 | openvpn: lzo pkcs11-helper |
michael@1 | 55 | @for a in ppc i686; do \ |
michael@1 | 56 | echo Configure OpenVPN for $$a; \ |
michael@1 | 57 | cd openvpn/; \ |
michael@1 | 58 | echo Forcefully be clean; \ |
michael@1 | 59 | $(MAKE) clean; \ |
michael@1 | 60 | autoreconf -i -v; \ |
michael@1 | 61 | LDFLAGS="-L../$(PKCS11_DIR)/staging/lib/" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.4u.sdk -Os -mmacosx-version-min=10.4 -arch $$a" ./configure --with-lzo-headers=../$(LZO_DIR)/staging/include/ --with-lzo-lib=../$(LZO_DIR)/staging/lib/ --with-pkcs11-helper-headers=../$(PKCS11_DIR)/staging/include/ --with-pkcs11-helper-libs=../$(PKCS11_DIR)/staging/lib/ --disable-dependency-tracking; \ |
michael@1 | 62 | echo Build OpenVPN; \ |
michael@1 | 63 | $(MAKE); \ |
michael@1 | 64 | mv openvpn openvpn_tblk_$$a; \ |
michael@1 | 65 | cd ../; \ |
michael@1 | 66 | done |
michael@1 | 67 | |
michael@1 | 68 | # Use lipo to create a universal library |
michael@1 | 69 | lipo openvpn/openvpn_tblk_* -create -output openvpn/openvpn |
michael@1 | 70 | |
michael@1 | 71 | openvpn-clean: |
michael@1 | 72 | $(MAKE) -C openvpn/ clean |
michael@1 | 73 | rm -f openvpn/openvpn_tblk_* |
michael@1 | 74 | |
michael@1 | 75 | .PHONY : tuntap |
michael@1 | 76 | |
michael@1 | 77 | tuntap: |
michael@1 | 78 | # Now we'll build the tun/tap driver |
michael@1 | 79 | $(MAKE) -C tuntap/ |
michael@1 | 80 | |
michael@1 | 81 | tuntap-clean: |
michael@1 | 82 | $(MAKE) -C tuntap/ clean |
michael@1 | 83 | |
michael@1 | 84 | |
michael@1 | 85 | |
michael@1 | 86 | clean: lzo-clean tuntap-clean openvpn-clean |