diff --git a/.gitignore b/.gitignore index f768c6426..4e30263e4 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ build-iPhoneOS/* objective-git.bridgesupport ObjectiveGitFramework/build/* ObjectiveGit-iOS.framework/* -libgit2*.a +External/libgit2*.a *.pbxuser *.perspective @@ -23,5 +23,7 @@ project.xcworkspace ObjectiveGitTests/fixtures/Fixtures/* -ios-openssl/include -ios-openssl/lib +External/ios-openssl/include +External/ios-openssl/lib + +External/libssh2-ios diff --git a/.gitmodules b/.gitmodules index d470322e4..dc91df79e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,5 +1,5 @@ [submodule "libgit2"] - path = libgit2 + path = External/libgit2 url = https://github.com/libgit2/libgit2.git [submodule "ObjectiveGitTests/specta"] path = ObjectiveGitTests/specta @@ -8,8 +8,11 @@ path = ObjectiveGitTests/expecta url = https://github.com/github/expecta.git [submodule "Configuration"] - path = Configuration + path = External/Configuration url = https://github.com/jspahrsummers/xcconfigs.git [submodule "openssl"] - path = openssl + path = External/openssl url = https://github.com/openssl/openssl.git +[submodule "libssh2"] + path = External/libssh2 + url = git://git.libssh2.org/libssh2.git diff --git a/Configuration b/External/Configuration similarity index 100% rename from Configuration rename to External/Configuration diff --git a/ios-openssl/build.sh b/External/ios-openssl/build.sh similarity index 80% rename from ios-openssl/build.sh rename to External/ios-openssl/build.sh index 308f015b6..343f3756b 100755 --- a/ios-openssl/build.sh +++ b/External/ios-openssl/build.sh @@ -5,7 +5,7 @@ set -x -if [ -f "ios-openssl/lib/libssl.a" ] && [ -f "ios-openssl/lib/libcrypto.a" ] && [ -d "ios-openssl/include" ] +if [ -f "External/ios-openssl/lib/libssl.a" ] && [ -f "External/ios-openssl/lib/libcrypto.a" ] && [ -d "External/ios-openssl/include" ] then echo "No update needed." exit 0 @@ -27,7 +27,7 @@ IPHONESIMULATOR_GCC="${IPHONESIMULATOR_PLATFORM}/Developer/usr/bin/gcc" # Clean up whatever was left from our previous build -rm -rf ios-openssl/include ios-openssl/lib +rm -rf External/ios-openssl/include External/ios-openssl/lib rm -rf "/tmp/openssl" rm -rf "/tmp/openssl-*.log" @@ -37,7 +37,7 @@ build() GCC=$2 SDK=$3 rm -rf "/tmp/openssl" - cp -r openssl /tmp/ + cp -r External/openssl /tmp/ pushd . cd "/tmp/openssl" ./Configure BSD-generic32 no-gost --openssldir="/tmp/openssl-${ARCH}" &> "/tmp/openssl-${ARCH}.log" @@ -56,20 +56,20 @@ build "i386" "${IPHONESIMULATOR_GCC}" "${IPHONESIMULATOR_SDK}" # -mkdir ios-openssl/include -cp -r /tmp/openssl-i386/include/openssl ios-openssl/include/ +mkdir External/ios-openssl/include +cp -r /tmp/openssl-i386/include/openssl External/ios-openssl/include/ -mkdir ios-openssl/lib +mkdir External/ios-openssl/lib lipo \ "/tmp/openssl-armv7/lib/libcrypto.a" \ "/tmp/openssl-armv7s/lib/libcrypto.a" \ "/tmp/openssl-i386/lib/libcrypto.a" \ - -create -output ios-openssl/lib/libcrypto.a + -create -output External/ios-openssl/lib/libcrypto.a lipo \ "/tmp/openssl-armv7/lib/libssl.a" \ "/tmp/openssl-armv7s/lib/libssl.a" \ "/tmp/openssl-i386/lib/libssl.a" \ - -create -output ios-openssl/lib/libssl.a + -create -output External/ios-openssl/lib/libssl.a rm -rf "/tmp/openssl" rm -rf "/tmp/openssl-*.log" diff --git a/libgit2 b/External/libgit2 similarity index 100% rename from libgit2 rename to External/libgit2 diff --git a/External/libssh2 b/External/libssh2 new file mode 160000 index 000000000..f1cfa55b6 --- /dev/null +++ b/External/libssh2 @@ -0,0 +1 @@ +Subproject commit f1cfa55b6064ba18fc0005713ed790da579361b5 diff --git a/openssl b/External/openssl similarity index 100% rename from openssl rename to External/openssl diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 48532c2c7..d1e921fac 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -18,6 +18,18 @@ name = "OpenSSL-iOS"; productName = "OpenSSL-iOS"; }; + 6A3C609017D5963700382DFF /* libssh2-iOS */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 6A3C609217D5963700382DFF /* Build configuration list for PBXAggregateTarget "libssh2-iOS" */; + buildPhases = ( + 6A3C609117D5963700382DFF /* ShellScript */, + ); + dependencies = ( + 6A3C609D17D5964E00382DFF /* PBXTargetDependency */, + ); + name = "libssh2-iOS"; + productName = "libssh2-iOS"; + }; D0A330ED16027F1E00A616FA /* libgit2 */ = { isa = PBXAggregateTarget; buildConfigurationList = D0A330EE16027F1E00A616FA /* Build configuration list for PBXAggregateTarget "libgit2" */; @@ -37,6 +49,7 @@ ); dependencies = ( 6A28265B17C69D6300C6A948 /* PBXTargetDependency */, + 6A3C609F17D5965700382DFF /* PBXTargetDependency */, ); name = "libgit2-iOS"; productName = "libgit2-iOS"; @@ -120,6 +133,8 @@ 5BE612931745EEBC00266D8C /* GTTreeBuilderSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 5BE612921745EEBC00266D8C /* GTTreeBuilderSpec.m */; }; 6A1F2FD517C6A8F3003DFADE /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */; }; 6A1F2FD617C6A8F3003DFADE /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD417C6A8F3003DFADE /* libssl.a */; }; + 6A502B8717D6892D00BAF4A5 /* libssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2.a */; }; + 6A5F84D917E30374003156A2 /* libssh2.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A5F84D817E30374003156A2 /* libssh2.dylib */; }; 6A74CA3216A9429700E1A3C5 /* GTRemote.m in Sources */ = {isa = PBXBuildFile; fileRef = 883CD6AA1600EBC600F57354 /* GTRemote.m */; }; 6A74CA3416A942AA00E1A3C5 /* NSData+Git.m in Sources */ = {isa = PBXBuildFile; fileRef = BD6C2267131459E700992935 /* NSData+Git.m */; }; 6A74CA3616A942C000E1A3C5 /* GTConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 883CD6AE1600F01000F57354 /* GTConfiguration+Private.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -228,6 +243,20 @@ remoteGlobalIDString = 6A28265217C69CB400C6A948; remoteInfo = "OpenSSL-iOS"; }; + 6A3C609C17D5964E00382DFF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6A28265217C69CB400C6A948; + remoteInfo = "OpenSSL-iOS"; + }; + 6A3C609E17D5965700382DFF /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 6A3C609017D5963700382DFF; + remoteInfo = "libssh2-iOS"; + }; 88F05A9F16011F9000B7AD1D /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; @@ -367,10 +396,14 @@ 5BE612861745EE3300266D8C /* GTTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTTreeBuilder.h; sourceTree = ""; }; 5BE612871745EE3300266D8C /* GTTreeBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilder.m; sourceTree = ""; }; 5BE612921745EEBC00266D8C /* GTTreeBuilderSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilderSpec.m; sourceTree = ""; }; - 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "ios-openssl/lib/libcrypto.a"; sourceTree = ""; }; - 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "ios-openssl/lib/libssl.a"; sourceTree = ""; }; - 79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = libgit2/include/git2; sourceTree = ""; }; - 79262F8A13C69B1600A4B1EA /* git2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = git2.h; path = libgit2/include/git2.h; sourceTree = ""; }; + 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "External/ios-openssl/lib/libcrypto.a"; sourceTree = ""; }; + 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "External/ios-openssl/lib/libssl.a"; sourceTree = ""; }; + 6A3C60A017D5987600382DFF /* update_libssh2_ios */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = update_libssh2_ios; path = script/update_libssh2_ios; sourceTree = SOURCE_ROOT; }; + 6A502B8617D6892D00BAF4A5 /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = "External/libssh2-ios/lib/libssh2.a"; sourceTree = ""; }; + 6A5F84D617E3034A003156A2 /* libssh2.1.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssh2.1.dylib; path = /usr/local/Cellar/libssh2/1.4.3/lib/libssh2.1.dylib; sourceTree = ""; }; + 6A5F84D817E30374003156A2 /* libssh2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libssh2.dylib; path = /usr/local/lib/libssh2.dylib; sourceTree = ""; }; + 79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = External/libgit2/include/git2; sourceTree = ""; }; + 79262F8A13C69B1600A4B1EA /* git2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = git2.h; path = External/libgit2/include/git2.h; sourceTree = ""; }; 8803DA861313145700E6E818 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; 882154671714740500D76B76 /* GTReflog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTReflog.h; sourceTree = ""; }; 882154681714740500D76B76 /* GTReflog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTReflog.m; sourceTree = ""; }; @@ -487,6 +520,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6A502B8717D6892D00BAF4A5 /* libssh2.a in Frameworks */, 6A1F2FD517C6A8F3003DFADE /* libcrypto.a in Frameworks */, 6A1F2FD617C6A8F3003DFADE /* libssl.a in Frameworks */, 04DB4672133AB5FE00D9C624 /* libz.dylib in Frameworks */, @@ -508,6 +542,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 6A5F84D917E30374003156A2 /* libssh2.dylib in Frameworks */, 887DAFFD15CB1CE200F30D0D /* libssl.dylib in Frameworks */, 887DAFFC15CB1CBD00F30D0D /* libcrypto.dylib in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, @@ -570,10 +605,13 @@ children = ( 887DAFF915CB1C9F00F30D0D /* libssl.dylib */, 887DAFFB15CB1CBD00F30D0D /* libcrypto.dylib */, + 6A5F84D617E3034A003156A2 /* libssh2.1.dylib */, + 6A5F84D817E30374003156A2 /* libssh2.dylib */, 8803DA861313145700E6E818 /* libz.dylib */, 04DB4671133AB5FE00D9C624 /* libz.dylib */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, 6A1F2FD417C6A8F3003DFADE /* libssl.a */, + 6A502B8617D6892D00BAF4A5 /* libssh2.a */, 887DAFF615CB1C8000F30D0D /* Security.framework */, 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, ); @@ -772,7 +810,8 @@ D0D81866174421EB00995A2E /* Mac OS X */, D0D8186C174421EB00995A2E /* README.md */, ); - path = Configuration; + name = Configuration; + path = External/Configuration; sourceTree = ""; }; D0D81858174421EB00995A2E /* Base */ = { @@ -830,6 +869,7 @@ E46931A6172740D300F2077D /* Scripts */ = { isa = PBXGroup; children = ( + 6A3C60A017D5987600382DFF /* update_libssh2_ios */, E46931A7172740D300F2077D /* update_libgit2 */, E46931A8172740D300F2077D /* update_libgit2_ios */, ); @@ -1026,6 +1066,7 @@ D0A330ED16027F1E00A616FA /* libgit2 */, D0A330F216027F3600A616FA /* libgit2-iOS */, 6A28265217C69CB400C6A948 /* OpenSSL-iOS */, + 6A3C609017D5963700382DFF /* libssh2-iOS */, ); }; /* End PBXProject section */ @@ -1121,7 +1162,20 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "ios-openssl/build.sh"; + shellScript = "External/ios-openssl/build.sh"; + }; + 6A3C609117D5963700382DFF /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = script/update_libssh2_ios; }; D0A330F116027F2300A616FA /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -1284,6 +1338,16 @@ target = 6A28265217C69CB400C6A948 /* OpenSSL-iOS */; targetProxy = 6A28265A17C69D6300C6A948 /* PBXContainerItemProxy */; }; + 6A3C609D17D5964E00382DFF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6A28265217C69CB400C6A948 /* OpenSSL-iOS */; + targetProxy = 6A3C609C17D5964E00382DFF /* PBXContainerItemProxy */; + }; + 6A3C609F17D5965700382DFF /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 6A3C609017D5963700382DFF /* libssh2-iOS */; + targetProxy = 6A3C609E17D5965700382DFF /* PBXContainerItemProxy */; + }; 88F05AA016011F9000B7AD1D /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = 8DC2EF4F0486A6940098B216 /* ObjectiveGit */; @@ -1337,12 +1401,15 @@ buildSettings = { GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; HEADER_SEARCH_PATHS = ( - libgit2/include, + External/libgit2/include, "$(OBJROOT)/UninstalledProducts/include", + "External/libssh2-ios/include/libssh2", ); LIBRARY_SEARCH_PATHS = ( ., - "$(SRCROOT)/ios-openssl/lib", + "External/ios-openssl/lib", + "External/libssh2-ios/lib", + External, ); OTHER_LDFLAGS = ( "-lgit2-iOS", @@ -1359,12 +1426,15 @@ buildSettings = { GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; HEADER_SEARCH_PATHS = ( - libgit2/include, + External/libgit2/include, "$(OBJROOT)/UninstalledProducts/include", + "External/libssh2-ios/include/libssh2", ); LIBRARY_SEARCH_PATHS = ( ., - "$(SRCROOT)/ios-openssl/lib", + "External/ios-openssl/lib", + "External/libssh2-ios/lib", + External, ); OTHER_LDFLAGS = ( "-lgit2-iOS", @@ -1383,11 +1453,17 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; + HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + ., + External, + /usr/local/lib, + ); OTHER_LDFLAGS = ( "-lgit2", "-force_load", - libgit2.a, + External/libgit2.a, ); PRODUCT_NAME = ObjectiveGit; WRAPPER_EXTENSION = framework; @@ -1402,11 +1478,17 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; + HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + ., + External, + /usr/local/lib, + ); OTHER_LDFLAGS = ( "-lgit2", "-force_load", - libgit2.a, + External/libgit2.a, ); PRODUCT_NAME = ObjectiveGit; WRAPPER_EXTENSION = framework; @@ -1467,6 +1549,30 @@ }; name = Profile; }; + 6A3C609317D5963700382DFF /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0D81865174421EB00995A2E /* iOS-StaticLibrary.xcconfig */; + buildSettings = { + PRODUCT_NAME = "libssh2-iOS"; + }; + name = Debug; + }; + 6A3C609417D5963700382DFF /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0D81865174421EB00995A2E /* iOS-StaticLibrary.xcconfig */; + buildSettings = { + PRODUCT_NAME = "libssh2-iOS"; + }; + name = Release; + }; + 6A3C609517D5963700382DFF /* Profile */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = D0D81865174421EB00995A2E /* iOS-StaticLibrary.xcconfig */; + buildSettings = { + PRODUCT_NAME = "libssh2-iOS"; + }; + name = Profile; + }; 88F05A8016011E5400B7AD1D /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = D0D81867174421EB00995A2E /* Mac-Application.xcconfig */; @@ -1526,11 +1632,17 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; + HEADER_SEARCH_PATHS = /usr/local/include; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + ., + External, + /usr/local/lib, + ); OTHER_LDFLAGS = ( "-lgit2", "-force_load", - libgit2.a, + External/libgit2.a, ); PRODUCT_NAME = ObjectiveGit; WRAPPER_EXTENSION = framework; @@ -1543,12 +1655,15 @@ buildSettings = { GCC_PREFIX_HEADER = ObjectiveGitFramework_Prefix.pch; HEADER_SEARCH_PATHS = ( - libgit2/include, + External/libgit2/include, "$(OBJROOT)/UninstalledProducts/include", + "External/libssh2-ios/include/libssh2", ); LIBRARY_SEARCH_PATHS = ( ., - "$(SRCROOT)/ios-openssl/lib", + "External/ios-openssl/lib", + "External/libssh2-ios/lib", + External, ); OTHER_LDFLAGS = ( "-lgit2-iOS", @@ -1668,6 +1783,16 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 6A3C609217D5963700382DFF /* Build configuration list for PBXAggregateTarget "libssh2-iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 6A3C609317D5963700382DFF /* Debug */, + 6A3C609417D5963700382DFF /* Release */, + 6A3C609517D5963700382DFF /* Profile */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; 88F05A7F16011E5400B7AD1D /* Build configuration list for PBXNativeTarget "ObjectiveGitTests" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/README.md b/README.md index aaef50956..2641de4e8 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,17 @@ chances are that you will want to also grab its submodules, e.g. as follows: [libgit2]: https://github.com/libgit2/libgit2 [submodule]: http://book.git-scm.com/5_submodules.html +## libssh2 + +To compile [libgit2] with [libssh2] you need to install the following dependencies via [Homebrew]: + +Mac OS X: `brew install libssh2` + +iOS: `brew install libtool autoconf automake` + +[libssh2]: http://www.libssh2.org/ +[Homebrew]: http://brew.sh/ + ## Inclusion in Mac OS X projects It is simple enough to add the ObjectiveGit framework to a desktop application project. An example of this is the [CommitViewer] example on GitHub. In summary: @@ -50,7 +61,7 @@ not allowing third-party dynamic frameworks. A work-around for this is as follow 1. In your target's build settings: 1. Set "Always Search User Paths" to YES 1. Add `$(BUILT_PRODUCTS_DIR)/usr/local/include` and - `$(SRCROOT)../Libs/objective-git/libgit2/include` to the "User Header + `$(SRCROOT)../Libs/objective-git/External/libgit2/include` to the "User Header Search Paths" 1. Add `-all_load` to the "Other Linker Flags" diff --git a/script/update_libgit2 b/script/update_libgit2 index 522edb3e4..0b4932408 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -7,13 +7,13 @@ set -e # ~/.MacOSX/environemnt.plist PATH="/usr/local/bin:$PATH" -if [ "libgit2.a" -nt "libgit2" ] +if [ "External/libgit2.a" -nt "External/libgit2" ] then echo "No update needed." exit 0 fi -cd "libgit2" +cd "External/libgit2" if [ -d "build" ]; then rm -rf "build" diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index c99319729..de7a5d418 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -7,7 +7,7 @@ set -e # ~/.MacOSX/environemnt.plist PATH="/usr/local/bin:$PATH" -if [ "libgit2-ios.a" -nt "libgit2" ] +if [ "External/libgit2-ios.a" -nt "External/libgit2" ] then echo "No update needed." exit 0 @@ -15,7 +15,7 @@ fi ios_version="6.1"; -cd "libgit2" +cd "External/libgit2" # armv7 build @@ -29,9 +29,11 @@ cd build cmake -DCMAKE_C_COMPILER_WORKS:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 \ - -DOPENSSL_SSL_LIBRARY:FILEPATH=../ios-openssl/lib/libssl.a \ - -DOPENSSL_CRYPTO_LIBRARY:FILEPATH=../ios-openssl/lib/libcrypto.a \ - -DOPENSSL_INCLUDE_DIR:PATH=../ios-openssl/include/ \ + -DOPENSSL_SSL_LIBRARY:FILEPATH=../../External/ios-openssl/lib/libssl.a \ + -DOPENSSL_CRYPTO_LIBRARY:FILEPATH=../../External/ios-openssl/lib/libcrypto.a \ + -DOPENSSL_INCLUDE_DIR:PATH=../../External/ios-openssl/include/ \ + -DCMAKE_LIBRARY_PATH:PATH=../../External/libssh2-ios/lib/ \ + -DCMAKE_INCLUDE_PATH:PATH=../../External/libssh2-ios/include/libssh2/ \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING= \ -DCMAKE_OSX_ARCHITECTURES:STRING="armv7;armv7s" \ -DBUILD_CLAR:BOOL=OFF \ @@ -59,9 +61,11 @@ cd build cmake -DCMAKE_C_COMPILER_WORKS:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DCMAKE_C_COMPILER=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/llvm-gcc-4.2/bin/llvm-gcc-4.2 \ - -DOPENSSL_SSL_LIBRARY:FILEPATH=../ios-openssl/lib/libssl.a \ - -DOPENSSL_CRYPTO_LIBRARY:FILEPATH=../ios-openssl/lib/libcrypto.a \ - -DOPENSSL_INCLUDE_DIR:PATH=../ios-openssl/include/ \ + -DOPENSSL_SSL_LIBRARY:FILEPATH=../../External/ios-openssl/lib/libssl.a \ + -DOPENSSL_CRYPTO_LIBRARY:FILEPATH=../../External/ios-openssl/lib/libcrypto.a \ + -DOPENSSL_INCLUDE_DIR:PATH=../../External/ios-openssl/include/ \ + -DCMAKE_LIBRARY_PATH:PATH=../../External/libssh2-ios/lib/ \ + -DCMAKE_INCLUDE_PATH:PATH=../../External/libssh2-ios/include/libssh2/ \ -DCMAKE_OSX_DEPLOYMENT_TARGET:STRING= \ -DCMAKE_OSX_ARCHITECTURES:STRING=i386 \ -DBUILD_CLAR:BOOL=OFF \ diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios new file mode 100755 index 000000000..7ea0e7121 --- /dev/null +++ b/script/update_libssh2_ios @@ -0,0 +1,74 @@ +#!/bin/sh + +set -e + +if [ -f "External/libssh2-ios/lib/libssh2.a" ]; then + echo "No update needed." + exit 0 +fi + +PATH="/usr/local/bin:$PATH" + +SDKVERSION="6.1" +CURRENTPATH=`pwd` +ARCHS="i386 armv7 armv7s" +DEVELOPER="/Applications/Xcode.app/Contents/Developer" + +mkdir -p External/libssh2-ios/lib External/libssh2-ios/lib External/libssh2-ios/src + +for ARCH in ${ARCHS}; do + + if [ "${ARCH}" == "i386" ]; then + PLATFORM="iPhoneSimulator" + else + PLATFORM="iPhoneOS" + fi + + echo "Building libssh2 for ${PLATFORM} ${SDKVERSION} ${ARCH}" + echo "Please stand by..." + + cp -R External/libssh2 External/libssh2-ios/src/ + cd External/libssh2-ios/src/libssh2 + + export DEVROOT="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer" + export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${SDKVERSION}.sdk" + export LD=${DEVROOT}/usr/bin/ld + + if [ "${ARCH}" == "i386" ]; then + export CC=${DEVROOT}/usr/bin/gcc + export CPP=${DEVROOT}/usr/bin/cpp + export CXX=${DEVROOT}/usr/bin/g++ + export CXXCPP=$DEVROOT/usr/bin/cpp + else + export CC=${DEVROOT}/usr/bin/gcc + export CXX=${DEVROOT}/usr/bin/g++ + fi + + export AR=${DEVROOT}/usr/bin/ar + export AS=${DEVROOT}/usr/bin/as + export NM=${DEVROOT}/usr/bin/nm + export RANLIB=$DEVROOT/usr/bin/ranlib + export LDFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -L${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/lib" + export CFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/include" + export CXXFLAGS="-arch ${ARCH} -pipe -no-cpp-precomp -isysroot ${SDKROOT} -I${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/include" + + echo ${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk + + mkdir -p "${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" + LOG="${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-libssh2.log" + ./buildconf >> "${LOG}" 2>&1 + ./configure --host=${ARCH}-apple-darwin --prefix="${CURRENTPATH}/External/libssh2-ios/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk" -with-openssl --with-libssl-prefix=${CURRENTPATH}/External/ios-openssl --disable-shared --enable-static >> "${LOG}" 2>&1 + make >> "${LOG}" 2>&1 + make install >> "${LOG}" 2>&1 + + cd ${CURRENTPATH} + rm -rf External/libssh2-ios/src/libssh2 +done + +echo "Build library..." + +lipo -create ${CURRENTPATH}/External/libssh2-ios/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/libssh2.a ${CURRENTPATH}/External/libssh2-ios/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/libssh2.a ${CURRENTPATH}/External/libssh2-ios/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/libssh2.a -output ${CURRENTPATH}/External/libssh2-ios/lib/libssh2.a +mkdir -p ${CURRENTPATH}/External/libssh2-ios/include/libssh2 +cp -R ${CURRENTPATH}/External/libssh2-ios/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/libssh2* ${CURRENTPATH}/External/libssh2-ios/include/libssh2/ + +echo "Building done."