diff --git a/External/libcrypto.a b/External/libcrypto.a deleted file mode 120000 index fe603c877..000000000 --- a/External/libcrypto.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libcrypto.a \ No newline at end of file diff --git a/External/libgit2 b/External/libgit2 index b8cb75361..8d36dc62b 160000 --- a/External/libgit2 +++ b/External/libgit2 @@ -1 +1 @@ -Subproject commit b8cb75361d48f16f41dfa99b5b988a914e53040b +Subproject commit 8d36dc62ba1b5d7deb66b6f982e005ddbc2ce343 diff --git a/External/libssl.a b/External/libssl.a deleted file mode 120000 index e321f3268..000000000 --- a/External/libssl.a +++ /dev/null @@ -1 +0,0 @@ -/usr/local/opt/openssl/lib/libssl.a \ No newline at end of file diff --git a/ObjectiveGit.modulemap b/ObjectiveGit.modulemap index e52bf7ccb..bb441d417 100644 --- a/ObjectiveGit.modulemap +++ b/ObjectiveGit.modulemap @@ -57,12 +57,14 @@ framework module ObjectiveGit { header "git2/sys/hashsig.h" header "git2/sys/index.h" header "git2/sys/mempack.h" + header "git2/sys/merge.h" header "git2/sys/odb_backend.h" header "git2/sys/refdb_backend.h" header "git2/sys/reflog.h" header "git2/sys/refs.h" header "git2/sys/repository.h" header "git2/sys/transport.h" + header "git2/sys/time.h" header "git2/cred_helpers.h" header "git2/sys/openssl.h" header "git2/sys/stream.h" diff --git a/ObjectiveGitFramework.xcodeproj/project.pbxproj b/ObjectiveGitFramework.xcodeproj/project.pbxproj index 3ca2f0336..c89360224 100644 --- a/ObjectiveGitFramework.xcodeproj/project.pbxproj +++ b/ObjectiveGitFramework.xcodeproj/project.pbxproj @@ -91,11 +91,14 @@ 4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; }; 4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; }; + 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; + 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; }; 4DBA4A3217DA73CE006CD5F5 /* GTRemoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */; }; 4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; 4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; }; + 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; }; 4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; }; 55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; }; @@ -297,7 +300,7 @@ D040AF78177B9A9E001AD9EB /* GTSignatureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF77177B9A9E001AD9EB /* GTSignatureSpec.m */; }; D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */; }; D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD417C6A8F3003DFADE /* libssl.a */; }; - D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */; }; + D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2.a */; }; D06D9E011755D10000558C17 /* GTEnumeratorSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D06D9E001755D10000558C17 /* GTEnumeratorSpec.m */; }; D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0751CD818BE520400134314 /* GTFilterListSpec.m */; }; D09C2E361755F16200065E36 /* GTSubmodule.h in Headers */ = {isa = PBXBuildFile; fileRef = D09C2E341755F16200065E36 /* GTSubmodule.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -490,6 +493,7 @@ 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCredential.h; sourceTree = ""; }; 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCredential.m; sourceTree = ""; }; 4D79C0F617DFAA7100997DE4 /* GTCredential+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTCredential+Private.h"; sourceTree = ""; }; + 4D9BCD23206D84AD003CD3CE /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = External/build/lib/libgit2.a; sourceTree = ""; }; 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = ""; }; 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = ""; }; 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = ""; }; @@ -503,9 +507,9 @@ 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 = "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 = ""; }; - 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libssh2-ios.a"; path = "External/libssh2-ios/lib/libssh2-ios.a"; sourceTree = ""; }; + 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = External/build/lib/libcrypto.a; sourceTree = ""; }; + 6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = External/build/lib/libssl.a; sourceTree = ""; }; + 6A502B8617D6892D00BAF4A5 /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = External/build/lib/libssh2.a; sourceTree = ""; }; 6EEB519F199D62B9001D72C0 /* GTFetchHeadEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFetchHeadEntry.h; sourceTree = ""; }; 6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFetchHeadEntry.m; sourceTree = ""; }; 79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = External/libgit2/include/git2; sourceTree = ""; }; @@ -682,6 +686,7 @@ files = ( F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */, F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */, + 4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */, 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -694,7 +699,8 @@ F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */, D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */, D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */, - D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */, + D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */, + 4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -705,6 +711,7 @@ F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */, F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */, F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */, + 4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */, F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -744,16 +751,17 @@ 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { isa = PBXGroup; children = ( - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, 306123A817EA5261006591D4 /* extobjc */, 889923F919FF5DD40092A9A6 /* git2 */, 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */, F8D63860207ACAF600D1FD32 /* libiconv.tbd */, F8D6385B207AC74A00D1FD32 /* libiconv.tbd */, - 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */, - 6A1F2FD417C6A8F3003DFADE /* libssl.a */, 23BB67BB1C7DF45300A37A66 /* libz.tbd */, F8D6385E207ACAE600D1FD32 /* libz.tbd */, + 6A1F2FD417C6A8F3003DFADE /* libssl.a */, + 6A502B8617D6892D00BAF4A5 /* libssh2.a */, + 4D9BCD23206D84AD003CD3CE /* libgit2.a */, + 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, D0A0128B19F9853D007F1914 /* Nimble.framework */, F8D63865207ACCAA00D1FD32 /* Nimble.framework */, D0A0128819F98475007F1914 /* Quick.framework */, @@ -1681,6 +1689,11 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/opt/openssl/lib, + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1705,6 +1718,11 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/opt/openssl/lib, + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1752,7 +1770,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1790,7 +1808,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1923,7 +1941,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -1940,6 +1958,11 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/opt/openssl/lib, + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -1988,22 +2011,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2052,22 +2068,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2084,22 +2093,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2116,22 +2118,15 @@ DYLIB_CURRENT_VERSION = 1; HEADER_SEARCH_PATHS = ( "$(inherited)", - "External/libssh2-ios/include/libssh2", - External/libgit2/include, + External/build/include, ); INFOPLIST_FILE = Info.plist; - LIBRARY_SEARCH_PATHS = ( - "External/ios-openssl/lib", - "External/libssh2-ios/lib", - "External/libgit2-ios", - ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib"; MODULEMAP_FILE = ObjectiveGit.modulemap; - OTHER_LDFLAGS = ( - "-lgit2-ios", - "-all_load", - ); + OTHER_LDFLAGS = "-all_load"; PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = ObjectiveGit; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include"; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2166,7 +2161,7 @@ "$(inherited)", "-DGIT_SSH", ); - SWIFT_VERSION = 2.3; + SWIFT_VERSION = 3.0; TARGETED_DEVICE_FAMILY = "1,2"; WARNING_CFLAGS = ( "$(inherited)", @@ -2183,6 +2178,11 @@ DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; INFOPLIST_FILE = Info.plist; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + /usr/local/opt/openssl/lib, + "$(PROJECT_DIR)/External/build/lib", + ); MODULEMAP_FILE = ObjectiveGit.modulemap; OTHER_LDFLAGS = ( "-lgit2", @@ -2317,7 +2317,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -2362,7 +2361,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Test; @@ -2409,7 +2407,6 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Release; @@ -2455,7 +2452,6 @@ PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; - SWIFT_VERSION = 4.0; VALIDATE_PRODUCT = YES; }; name = Profile; diff --git a/ObjectiveGitTests/Libgit2FeaturesSpec.m b/ObjectiveGitTests/Libgit2FeaturesSpec.m index d1898975d..1a57524f5 100644 --- a/ObjectiveGitTests/Libgit2FeaturesSpec.m +++ b/ObjectiveGitTests/Libgit2FeaturesSpec.m @@ -30,10 +30,17 @@ expect(@(git_features & GIT_FEATURE_HTTPS)).to(beTruthy()); }); - xit(@"should be built with SSH enabled", ^{ + it(@"should be built with SSH enabled", ^{ expect(@(git_features & GIT_FEATURE_SSH)).to(beTruthy()); }); + it(@"should have ssh memory credentials", ^{ + NSError *error; + GTCredential *cred = [GTCredential credentialWithUserName:@"null" publicKeyString:@"pub" privateKeyString:@"priv" passphrase:@"pass" error:&error]; + + expect(cred).notTo(beNil()); + expect(error).to(beNil()); + }); }); QuickSpecEnd diff --git a/script/bootstrap b/script/bootstrap index ffccf0212..18f76616a 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -1,6 +1,6 @@ #!/bin/bash -export SCRIPT_DIR=$(dirname "$0") +export SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) ## ## Configuration Variables diff --git a/script/cibuild b/script/cibuild index 4f2a1a356..cc58cb660 100755 --- a/script/cibuild +++ b/script/cibuild @@ -33,7 +33,7 @@ fi ## set -o pipefail -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) XCWORKSPACE="ObjectiveGitFramework.xcworkspace" XCODE_OPTIONS=$(RUN_CLANG_STATIC_ANALYZER=NO ONLY_ACTIVE_ARCH=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO) diff --git a/script/ios_build_functions.sh b/script/ios_build_functions.sh index 36f5b14c7..515ca81b1 100755 --- a/script/ios_build_functions.sh +++ b/script/ios_build_functions.sh @@ -1,6 +1,6 @@ #!/bin/bash -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/xcode_functions.sh" function setup_build_environment () @@ -9,7 +9,7 @@ function setup_build_environment () # e.g. via brew. Xcode's Run Script phase doesn't seem to honor # ~/.MacOSX/environment.plist PATH="/usr/local/bin:/opt/boxen/homebrew/bin:$PATH" - + pushd "$SCRIPT_DIR/.." > /dev/null ROOT_PATH="$PWD" popd > /dev/null @@ -22,7 +22,7 @@ function setup_build_environment () MACOSX_DEPLOYMENT_TARGET="" XCODE_MAJOR_VERSION=$(xcode_major_version) - + CAN_BUILD_64BIT="0" # If IPHONEOS_DEPLOYMENT_TARGET has not been specified @@ -32,7 +32,7 @@ function setup_build_environment () then IPHONEOS_DEPLOYMENT_TARGET="6.0" fi - + # Determine if we can be building 64-bit binaries if [ "${XCODE_MAJOR_VERSION}" -ge "5" ] && [ $(echo ${IPHONEOS_DEPLOYMENT_TARGET} '>=' 6.0 | bc -l) == "1" ] then @@ -46,12 +46,19 @@ function setup_build_environment () # builds to be first ARCHS="x86_64 ${ARCHS} arm64" fi + + # Setup a shared area for our build artifacts + INSTALL_PATH="${ROOT_PATH}/External/build" + mkdir -p "${INSTALL_PATH}" + mkdir -p "${INSTALL_PATH}/log" + mkdir -p "${INSTALL_PATH}/include" + mkdir -p "${INSTALL_PATH}/lib/pkgconfig" } function build_all_archs () { setup_build_environment - + local setup=$1 local build_arch=$2 local finish_build=$3 @@ -81,10 +88,17 @@ function build_all_archs () SDKNAME="${PLATFORM}${SDKVERSION}" SDKROOT="$(ios_sdk_path ${SDKNAME})" - + + LOG="${INSTALL_PATH}/log/${LIBRARY_NAME}-${ARCH}.log" + [ -f "${LOG}" ] && rm "${LOG}" + echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}" + echo "Build log can be found in ${LOG}" echo "Please stand by..." + ARCH_INSTALL_PATH="${INSTALL_PATH}/${SDKNAME}-${ARCH}.sdk" + mkdir -p "${ARCH_INSTALL_PATH}" + # run the per arch build command eval $build_arch done diff --git a/script/pkg-config-static b/script/pkg-config-static new file mode 100755 index 000000000..64c6ea205 --- /dev/null +++ b/script/pkg-config-static @@ -0,0 +1,2 @@ +#!/bin/sh +pkg-config --static "$@" diff --git a/script/update_libgit2 b/script/update_libgit2 index d84cb1de1..151231742 100755 --- a/script/update_libgit2 +++ b/script/update_libgit2 @@ -22,6 +22,9 @@ fi mkdir build cd build +# OpenSSL is keg-only, so add its pkgconfig location manually +export PKG_CONFIG_PATH=/usr/local/opt/openssl/lib/pkgconfig + cmake -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLIBSSH2_INCLUDE_DIRS:PATH=/usr/local/include/ \ -DBUILD_CLAR:BOOL=OFF \ diff --git a/script/update_libgit2_ios b/script/update_libgit2_ios index 7732f32e9..2586f128b 100755 --- a/script/update_libgit2_ios +++ b/script/update_libgit2_ios @@ -3,74 +3,68 @@ set -e # source the common build functions -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ] + if [ "${INSTALL_PATH}/lib/libgit2.a" -nt "${ROOT_PATH}/External/libgit2" ] then echo "No update needed." exit 0 fi LIBRARY_NAME="libgit2" - LIB_PATH="${ROOT_PATH}/External/libgit2-ios" - rm -rf "${LIB_PATH}" - - pushd "${ROOT_PATH}/External/libgit2" > /dev/null } function build_libgit2 () { - rm -rf "build" - mkdir "build" - pushd "build" > /dev/null + # Force CMake to rebuild + rm -rf "${ARCH_INSTALL_PATH}/libgit2" - # LOL Cmake - if [ "${ARCH}" != "i386" ] && [ "${ARCH}" != "x86_64" ] - then - SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" - fi + mkdir -p "${ARCH_INSTALL_PATH}/libgit2" + pushd "${ARCH_INSTALL_PATH}/libgit2" > /dev/null - # install the each built arch somewhere sane - INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk" + # LOL Cmake + SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}" - mkdir -p "${INSTALL_PREFIX}" + # We only want to discover our static library + export PKG_CONFIG="${SCRIPT_DIR}"/pkg-config-static - LOG="${INSTALL_PREFIX}/build-libgit2.log" - echo "$LOG" + # Limit pkg-config to what we're currently expecting it to use + # PKG_CONFIG_PATH="${INSTALL_PATH}/lib/pkgconfig/" + # LDFLAGS="-L $(xcrun --sdk iphoneos --show-sdk-path)/usr/lib" + # export PKG_CONFIG_PATH + # export LDFLAGS cmake \ -DCMAKE_C_COMPILER_WORKS:BOOL=ON \ -DBUILD_SHARED_LIBS:BOOL=OFF \ - -DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" \ + -DCMAKE_PREFIX_PATH:PATH="${INSTALL_PATH}/" \ -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \ - -DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \ + -DCMAKE_INSTALL_PREFIX:PATH="${ARCH_INSTALL_PATH}/" \ -DBUILD_CLAR:BOOL=OFF \ -DTHREADSAFE:BOOL=ON \ -DCURL:BOOL=OFF \ -DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \ "${SYS_ROOT}" \ -DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \ - .. >> "${LOG}" 2>&1 + "${ROOT_PATH}/External/libgit2" >> "${LOG}" 2>&1 cmake --build . --target install >> "${LOG}" 2>&1 + popd > /dev/null # push the built library into the list - BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a") - popd > /dev/null + BUILT_LIB_PATHS+=("${ARCH_INSTALL_PATH}/lib/libgit2.a") } function fat_binary () { echo "Building fat binary..." - lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" + lipo -create "${BUILT_LIB_PATHS[@]}" -output "${INSTALL_PATH}/lib/libgit2.a" echo "Building done." - - popd > /dev/null } build_all_archs setup build_libgit2 fat_binary diff --git a/script/update_libssh2_ios b/script/update_libssh2_ios index 8dd89c51c..b015047c5 100755 --- a/script/update_libssh2_ios +++ b/script/update_libssh2_ios @@ -3,12 +3,12 @@ set -e # source the common build functions -SCRIPT_DIR=$(dirname "$0") +SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd) source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ -f "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" ] + if [ -f "${INSTALL_PATH}/lib/libssh2.a" ] then echo "No update needed." exit 0 @@ -16,38 +16,36 @@ function setup () LIBRARY_NAME="libssh2" } -function build_ssh2 () +function build_ssh2 () { - mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src" - - rm -rf "${ROOT_PATH}/External/libssh2-ios/src/libssh2" - cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/" - pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null + cp -R "${ROOT_PATH}/External/libssh2" "${ARCH_INSTALL_PATH}/libssh2" + pushd "${ARCH_INSTALL_PATH}/libssh2" > /dev/null export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}" - mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" - LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log" - - echo "${LOG}" - ./buildconf >> "${LOG}" 2>&1 - ./configure --host=${HOST} --prefix="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" --with-openssl --with-libssl-prefix="${ROOT_PATH}/External/ios-openssl" --disable-shared --enable-static >> "${LOG}" 2>&1 + ./configure --host=${HOST} --prefix="${ARCH_INSTALL_PATH}" --with-openssl --with-libssl-prefix="${INSTALL_PATH}" --disable-shared --enable-static >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1 make install >> "${LOG}" 2>&1 popd > /dev/null - BUILT_LIBS+=("${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/lib/libssh2.a") + rm -rf "${ARCH_INSTALL_PATH}/libssh2" + + BUILT_LIBS+=("${ARCH_INSTALL_PATH}/lib/libssh2.a") } function fat_binary () { + echo "Copying headers & pkg-config files" + + cp -r "${ARCH_INSTALL_PATH}"/include/libssh*.h "${INSTALL_PATH}/include/" + cp "${ARCH_INSTALL_PATH}/lib/pkgconfig/libssh2.pc" "${INSTALL_PATH}/lib/pkgconfig/" + perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/libssh2.pc" >> "${LOG}" 2>&1 + echo "Building fat binary..." - lipo -create "${BUILT_LIBS[@]}" -output "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" - mkdir -p "${ROOT_PATH}/External/libssh2-ios/include/libssh2" - cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-i386.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/" + lipo -create "${BUILT_LIBS[@]}" -output "${INSTALL_PATH}/lib/libssh2.a" echo "Building done." } diff --git a/script/update_libssl_ios b/script/update_libssl_ios index 54c0a9a1e..2b4593683 100755 --- a/script/update_libssl_ios +++ b/script/update_libssl_ios @@ -1,35 +1,28 @@ #!/bin/bash +set -e + # source the common build functions SCRIPT_DIR=$(dirname "$0") source "${SCRIPT_DIR}/ios_build_functions.sh" function setup () { - if [ -f "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" ] && [ -f "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" ] && [ -d "${ROOT_PATH}/External/ios-openssl/include" ] + if [ -f "${INSTALL_PATH}/lib/libssl.a" -a \ + -f "${INSTALL_PATH}/lib/libcrypto.a" -a \ + -d "${INSTALL_PATH}/include/openssl" ] then echo "No update needed." exit 0 fi LIBRARY_NAME="OpenSSL" - - rm -rf "${ROOT_PATH}/External/ios-openssl/include" "External/ios-openssl/lib" -} - -function cleanup () -{ - rm -rf "/tmp/openssl" - rm -rf "/tmp/openssl-*.log" } -function build_ssl () +function build_ssl () { - rm -rf "/tmp/openssl" - cp -r "${ROOT_PATH}/External/openssl" "/tmp/" - pushd "/tmp/openssl" > /dev/null - - LOG="/tmp/openssl-${ARCH}.log" + cp -r "${ROOT_PATH}/External/openssl" "${ARCH_INSTALL_PATH}/openssl" + pushd "${ARCH_INSTALL_PATH}/openssl" > /dev/null if [ "${ARCH}" == "arm64" ] || [ "${ARCH}" == "x86_64" ] then @@ -40,36 +33,36 @@ function build_ssl () CONFIG="no-gost no-asm" perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c fi - echo "$LOG" - ./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1 + ./Configure ${HOST} ${CONFIG} --openssldir="${ARCH_INSTALL_PATH}" >> "${LOG}" 2>&1 perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1 perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1 make >> "${LOG}" 2>&1 make install_sw >> "${LOG}" 2>&1 popd > /dev/null - rm -rf "/tmp/openssl" - BUILT_CRYPTO_PATHS+=("/tmp/openssl-${ARCH}/lib/libcrypto.a") - BUILT_SSL_PATHS+=("/tmp/openssl-${ARCH}/lib/libssl.a") + rm -rf "${ARCH_INSTALL_PATH}/openssl" + + BUILT_CRYPTO_PATHS+=("${ARCH_INSTALL_PATH}/lib/libcrypto.a") + BUILT_SSL_PATHS+=("${ARCH_INSTALL_PATH}/lib/libssl.a") } function fat_binary () { - echo "Building fat binary..." + echo "Copying headers & pkg-config files" + cp -r "${ARCH_INSTALL_PATH}/include/openssl" "${INSTALL_PATH}/include/" + for pkgfile in "${ARCH_INSTALL_PATH}"/lib/pkgconfig/*.pc; do + cp "${pkgfile}" "${INSTALL_PATH}/lib/pkgconfig/" + perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/$(basename "${pkgfile}")" >> "${LOG}" 2>&1 + done - mkdir -p "${ROOT_PATH}/External/ios-openssl/include" - cp -r /tmp/openssl-i386/include/openssl "${ROOT_PATH}/External/ios-openssl/include/" - - mkdir -p "${ROOT_PATH}/External/ios-openssl/lib" + echo "Building fat binary..." - lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a" - lipo -create "${BUILT_SSL_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libssl.a" + lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${INSTALL_PATH}/lib/libcrypto.a" + lipo -create "${BUILT_SSL_PATHS[@]}" -output "${INSTALL_PATH}/lib/libssl.a" echo "Building done." } -cleanup build_all_archs setup build_ssl fat_binary -cleanup diff --git a/script/xcode_functions.sh b/script/xcode_functions.sh index c9e6980f6..2dc7e3b2c 100755 --- a/script/xcode_functions.sh +++ b/script/xcode_functions.sh @@ -26,7 +26,7 @@ function ios_sdk_version () # iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0) # SDKVersion: 9.0 - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' + /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' } # Returns the path to the specified iOS SDK name