michael@1: # This Makefile builds all the third_party code michael@1: # It shouldn't be called by anything other than automated scripts michael@1: michael@1: # Both lzo and openvpn should be built universally michael@3: # MSvB: ...using four architectures i386, x86_64, ppc, and ppc64 michael@1: michael@3: HOSTARCH=x86_64 michael@3: LZO_DIR=lzo-2.03 michael@1: PKCS11_DIR=pkcs11-helper-1.07 michael@1: michael@3: all: tuntap openvpn michael@1: michael@3: pkcs11-helper: michael@3: echo Configure PKCS11-Helper 32/64 bit universal library michael@3: cd $(PKCS11_DIR) && OPENSSL_CFLAGS="-I/usr/include" OPENSSL_LIBS="-L/usr/lib -lssl -lcrypto" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -Os -mmacosx-version-min=10.5 -arch ppc -arch ppc64 -arch i386 -arch x86_64" ./configure --enable-static --disable-dependency-tracking --prefix=$$(pwd)/staging/ --includedir=$$(pwd)/staging/include/ michael@3: echo Build PKCS11-Helper 32/64 bit universal binary michael@3: $(MAKE) -C $(PKCS11_DIR) michael@3: echo Install to third_party/$(PKCS11_DIR)/staging michael@3: $(MAKE) -C $(PKCS11_DIR) install michael@1: michael@3: lzo: michael@3: @for a in ppc ppc64 i386 x86_64; do \ michael@1: echo Configure LZO for $$a; \ michael@1: cd $(LZO_DIR); \ michael@1: echo Forcefully be clean; \ michael@1: $(MAKE) clean; \ michael@3: CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -Os -mmacosx-version-min=10.5 -arch $$a" ./configure --host=$(HOSTARCH) --build=$$a --disable-dependency-tracking --disable-asm --prefix=$$(pwd)/staging_$$a/ --includedir=$$(pwd)/staging/include/; \ michael@1: echo Build LZO; \ michael@1: $(MAKE); \ michael@1: echo Install to third_party/$(LZO_DIR)/staging_$$a; \ michael@1: $(MAKE) install; \ michael@3: cd ..; \ michael@1: done michael@1: michael@1: # Use lipo to create a universal library michael@1: mkdir -p $(LZO_DIR)/staging/lib michael@1: lipo $(LZO_DIR)/staging_*/lib/liblzo2.a -create -output $(LZO_DIR)/staging/lib/liblzo2.a michael@3: cp $(LZO_DIR)/staging_i386/lib/liblzo2.la $(LZO_DIR)/staging/lib/ michael@1: michael@1: # wtf? library was renamed??? move it back so openvpn will build correctly michael@3: cd $(LZO_DIR)/staging/lib; mv liblzo2.a liblzo.a; mv liblzo2.la liblzo.la michael@1: michael@1: lzo-clean: michael@1: $(MAKE) -C $(LZO_DIR) clean michael@1: rm -rf $(LZO_DIR)/staging* michael@1: michael@1: openvpn: lzo pkcs11-helper michael@3: echo Configure OpenVPN 32/64 bit universal binary michael@3: cd openvpn && autoreconf -i -v michael@3: cd openvpn && LDFLAGS="-L../$(PKCS11_DIR)/staging/lib/" CFLAGS="-isysroot /Developer/SDKs/MacOSX10.5.sdk -Os -mmacosx-version-min=10.5 -arch ppc -arch ppc64 -arch i386 -arch x86_64" ./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@3: echo Build OpenVPN 32/64 bit universal binary michael@3: $(MAKE) -C openvpn michael@1: michael@1: openvpn-clean: michael@3: $(MAKE) -C openvpn clean michael@1: michael@1: .PHONY : tuntap michael@1: michael@1: tuntap: michael@1: # Now we'll build the tun/tap driver michael@3: # # MSvB: Patch buildconf for building 64-bit (broken as of 20090728) michael@3: # sed -i .orig \ michael@3: # -e 's;-arch ppc;-arch ppc -arch ppc64;g' \ michael@3: # -e 's;-arch i386;-arch i386 -arch x86_64;g' \ michael@3: # tuntap/src/tap/Makefile tuntap/src/tun/Makefile michael@3: # MSvB: Patch buildconf for building with up to date APIs michael@3: sed -i .orig \ michael@3: -e 's;MacOSX10.4u.sdk;MacOSX10.5.sdk;g' \ michael@3: tuntap/src/tap/Makefile tuntap/src/tun/Makefile michael@3: $(MAKE) -C tuntap michael@1: michael@1: tuntap-clean: michael@3: $(MAKE) -C tuntap clean michael@1: michael@1: clean: lzo-clean tuntap-clean openvpn-clean