From 6d8982ab4b4436c8aadf5f6e89a15a4eaf346133 Mon Sep 17 00:00:00 2001 From: Romain Muller Date: Wed, 18 May 2011 14:06:55 +0200 Subject: [PATCH] Build with WAF outside of source tree. Update headers and search paths with new build logic. --- GitX.xcodeproj/project.pbxproj | 16 +++++++++------- PBGitGrapher.mm | 2 +- PBGitLane.h | 2 +- PBGitSHA.h | 2 +- PBGitSHA.m | 2 +- build_libgit2.sh | 27 ++++++++++++++++++--------- libgit2 | 2 +- 7 files changed, 32 insertions(+), 21 deletions(-) diff --git a/GitX.xcodeproj/project.pbxproj b/GitX.xcodeproj/project.pbxproj index 766c971..d177e2e 100644 --- a/GitX.xcodeproj/project.pbxproj +++ b/GitX.xcodeproj/project.pbxproj @@ -503,7 +503,7 @@ F5B721C30E05CF7E00AF29DC /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; F5C007730E731B48007B84B2 /* PBGitRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitRef.h; sourceTree = ""; }; F5C007740E731B48007B84B2 /* PBGitRef.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBGitRef.m; sourceTree = ""; }; - F5C580E40EDA250900995434 /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = libgit2/libgit2.a; sourceTree = ""; }; + F5C580E40EDA250900995434 /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgit2.a; sourceTree = BUILT_PRODUCTS_DIR; }; F5C6F68B0E65FF9300478D97 /* PBGitLane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitLane.h; sourceTree = ""; }; F5C6F68C0E65FF9300478D97 /* PBGitLane.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PBGitLane.mm; sourceTree = ""; }; F5D2DC850EA401A80034AD24 /* PBGitConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBGitConfig.h; sourceTree = ""; }; @@ -1616,13 +1616,14 @@ GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GitX_Prefix.pch; - HEADER_SEARCH_PATHS = libgit2/src; + HEADER_SEARCH_PATHS = libgit2/include; INFOPLIST_FILE = Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; INFOPLIST_PREPROCESS = YES; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = libgit2; + LIBRARY_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; PRODUCT_NAME = GitX; SDKROOT = ""; WRAPPER_EXTENSION = app; @@ -1643,13 +1644,13 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = GitX_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = ""; - HEADER_SEARCH_PATHS = libgit2/src; + HEADER_SEARCH_PATHS = libgit2/include; INFOPLIST_FILE = Info.plist; INFOPLIST_OTHER_PREPROCESSOR_FLAGS = "-traditional"; INFOPLIST_PREFIX_HEADER = $PROJECT_TEMP_DIR/revision; INFOPLIST_PREPROCESS = YES; INSTALL_PATH = "$(HOME)/Applications"; - LIBRARY_SEARCH_PATHS = libgit2; + LIBRARY_SEARCH_PATHS = ""; PRODUCT_NAME = GitX; SDKROOT = ""; WRAPPER_EXTENSION = app; @@ -1771,7 +1772,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; INSTALL_PATH = /usr/local/bin; - LIBRARY_SEARCH_PATHS = libgit2; + LIBRARY_SEARCH_PATHS = ""; + ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-framework", Foundation, @@ -1795,7 +1797,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h"; INSTALL_PATH = /usr/local/bin; - LIBRARY_SEARCH_PATHS = libgit2; + LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ( "-framework", Foundation, diff --git a/PBGitGrapher.mm b/PBGitGrapher.mm index d22ba6c..47d9cfd 100644 --- a/PBGitGrapher.mm +++ b/PBGitGrapher.mm @@ -11,7 +11,7 @@ #import "PBGitLane.h" #import "PBGitGraphLine.h" #import -#import "git/oid.h" +#import using namespace std; diff --git a/PBGitLane.h b/PBGitLane.h index 94b59a2..136e5b3 100644 --- a/PBGitLane.h +++ b/PBGitLane.h @@ -6,7 +6,7 @@ // Copyright 2008 __MyCompanyName__. All rights reserved. // #import -#include "git/oid.h" +#include class PBGitLane { static int s_colorIndex; diff --git a/PBGitSHA.h b/PBGitSHA.h index f222911..15eeeb3 100644 --- a/PBGitSHA.h +++ b/PBGitSHA.h @@ -7,7 +7,7 @@ // #import -#include "git/oid.h" +#include @interface PBGitSHA : NSObject { diff --git a/PBGitSHA.m b/PBGitSHA.m index 1745133..a310040 100644 --- a/PBGitSHA.m +++ b/PBGitSHA.m @@ -7,7 +7,7 @@ // #import "PBGitSHA.h" - +#import @interface PBGitSHA () diff --git a/build_libgit2.sh b/build_libgit2.sh index 20d4c26..c5cd3d3 100755 --- a/build_libgit2.sh +++ b/build_libgit2.sh @@ -9,20 +9,29 @@ # based on: http://log.yeahrightkeller.com/post/270155578/run-script-while-cleaning-in-xcode buildAction () { - echo "Building libgit2..." + echo "Building libgit2..." if [[ -d .git ]] then - if [ "$(which git)" == "" ]; then - echo "git not found" - exit -1 - fi + if [ "$(which git)" == "" ]; then + echo "git not found" + exit -1 + fi git submodule init git submodule sync git submodule update cd libgit2 - rm -f libgit2.a - make CFLAGS="-arch i386 -arch ppc" - ranlib libgit2.a + ./waf --out=$TARGET_TEMP_DIR --prefix=$TARGET_BUILD_DIR configure + if [ $? != 0 ]; then + echo "error: failed to waf configure" + exit -1 + fi + ./waf build-static + if [ $? != 0 ]; then + echo "error: failed to waf build-static" + exit -1 + fi + ranlib $TARGET_TEMP_DIR/static/libgit2.a + cp $TARGET_TEMP_DIR/static/libgit2.a $TARGET_BUILD_DIR else echo "error: Not a git repository." echo "error: clone GitX first so that the libgit2 submodule can be updated" @@ -33,7 +42,7 @@ buildAction () { cleanAction () { echo "Cleaning libgit2..." cd libgit2 - make clean + ./waf clean } # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libgit2 b/libgit2 index 4077454..d1685ac 160000 --- a/libgit2 +++ b/libgit2 @@ -1 +1 @@ -Subproject commit 40774549e14e2d9f24b9271173d58b44f82d5254 +Subproject commit d1685ac7e91c5269cf01f6ab57c2c4705a14e6bc