Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6e546f4

Browse files
committedApr 23, 2018
Build system overhaul!
This changes our various scripts to dump their build artifacts in External/build instead of various per-external directories (or /tmp for OpenSSL), which makes it easier to link them to each other when we finally get to building libgit2 on iOS.
1 parent 9047f2b commit 6e546f4

File tree

9 files changed

+124
-136
lines changed

9 files changed

+124
-136
lines changed
 

‎External/libcrypto.a

-1
This file was deleted.

‎External/libgit2

Submodule libgit2 updated 66 files

‎External/libssl.a

-1
This file was deleted.

‎ObjectiveGitFramework.xcodeproj/project.pbxproj

+48-54
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,14 @@
9191
4D1C40D8182C006D00BE2960 /* GTBlobSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D1C40D7182C006D00BE2960 /* GTBlobSpec.m */; };
9292
4D79C0EE17DF9F4D00997DE4 /* GTCredential.h in Headers */ = {isa = PBXBuildFile; fileRef = 4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */; settings = {ATTRIBUTES = (Public, ); }; };
9393
4D79C0EF17DF9F4D00997DE4 /* GTCredential.m in Sources */ = {isa = PBXBuildFile; fileRef = 4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */; };
94+
4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; };
95+
4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D9BCD23206D84AD003CD3CE /* libgit2.a */; };
9496
4DBA4A3217DA73CE006CD5F5 /* GTRemoteSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */; };
9597
4DC55AE51AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
9698
4DC55AE61AD859AD0032563C /* GTCheckoutOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */; settings = {ATTRIBUTES = (Public, ); }; };
9799
4DC55AE71AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; };
98100
4DC55AE81AD859AD0032563C /* GTCheckoutOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */; };
101+
4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; };
99102
4DFFB15B183AA8D600D1565E /* GTRepository+RemoteOperations.h in Headers */ = {isa = PBXBuildFile; fileRef = 4DFFB159183AA8D600D1565E /* GTRepository+RemoteOperations.h */; settings = {ATTRIBUTES = (Public, ); }; };
100103
4DFFB15C183AA8D600D1565E /* GTRepository+RemoteOperations.m in Sources */ = {isa = PBXBuildFile; fileRef = 4DFFB15A183AA8D600D1565E /* GTRepository+RemoteOperations.m */; };
101104
55C8055013861FE7004DCB0F /* GTObjectDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = 55C8054D13861F34004DCB0F /* GTObjectDatabase.m */; };
@@ -297,7 +300,7 @@
297300
D040AF78177B9A9E001AD9EB /* GTSignatureSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D040AF77177B9A9E001AD9EB /* GTSignatureSpec.m */; };
298301
D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD317C6A8F3003DFADE /* libcrypto.a */; };
299302
D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A1F2FD417C6A8F3003DFADE /* libssl.a */; };
300-
D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */; };
303+
D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 6A502B8617D6892D00BAF4A5 /* libssh2.a */; };
301304
D06D9E011755D10000558C17 /* GTEnumeratorSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D06D9E001755D10000558C17 /* GTEnumeratorSpec.m */; };
302305
D0751CD918BE520400134314 /* GTFilterListSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = D0751CD818BE520400134314 /* GTFilterListSpec.m */; };
303306
D09C2E361755F16200065E36 /* GTSubmodule.h in Headers */ = {isa = PBXBuildFile; fileRef = D09C2E341755F16200065E36 /* GTSubmodule.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -319,7 +322,6 @@
319322
F81B6B50207B032800AB0836 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63871207AE62A00D1FD32 /* XCTest.framework */; };
320323
F81B6B55207B0A9F00AB0836 /* Mac-XCTest.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = F81B6B54207B0A9F00AB0836 /* Mac-XCTest.xcconfig */; };
321324
F81B6B59207B0D3B00AB0836 /* SwiftSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0A0129619F9A660007F1914 /* SwiftSpec.swift */; };
322-
F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63865207ACCAA00D1FD32 /* Nimble.framework */; };
323325
F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F8D63872207AE63A00D1FD32 /* XCTest.framework */; };
324326
F86949AA1BF1B79E00A989D3 /* GTUtilityFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = F8EFA0391B4059ED000FF7D0 /* GTUtilityFunctions.m */; };
325327
F879D8311B4B788F002D5C07 /* Libgit2FeaturesSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = F879D82F1B4B77F4002D5C07 /* Libgit2FeaturesSpec.m */; };
@@ -491,6 +493,7 @@
491493
4D79C0EC17DF9F4D00997DE4 /* GTCredential.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCredential.h; sourceTree = "<group>"; };
492494
4D79C0ED17DF9F4D00997DE4 /* GTCredential.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCredential.m; sourceTree = "<group>"; };
493495
4D79C0F617DFAA7100997DE4 /* GTCredential+Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "GTCredential+Private.h"; sourceTree = "<group>"; };
496+
4D9BCD23206D84AD003CD3CE /* libgit2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libgit2.a; path = External/build/lib/libgit2.a; sourceTree = "<group>"; };
494497
4DBA4A3117DA73CE006CD5F5 /* GTRemoteSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTRemoteSpec.m; sourceTree = "<group>"; };
495498
4DC55AE31AD859AD0032563C /* GTCheckoutOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTCheckoutOptions.h; sourceTree = "<group>"; };
496499
4DC55AE41AD859AD0032563C /* GTCheckoutOptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTCheckoutOptions.m; sourceTree = "<group>"; };
@@ -504,9 +507,9 @@
504507
5BE612861745EE3300266D8C /* GTTreeBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTTreeBuilder.h; sourceTree = "<group>"; };
505508
5BE612871745EE3300266D8C /* GTTreeBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilder.m; sourceTree = "<group>"; };
506509
5BE612921745EEBC00266D8C /* GTTreeBuilderSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTTreeBuilderSpec.m; sourceTree = "<group>"; };
507-
6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = "External/ios-openssl/lib/libcrypto.a"; sourceTree = "<group>"; };
508-
6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = "External/ios-openssl/lib/libssl.a"; sourceTree = "<group>"; };
509-
6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = "libssh2-ios.a"; path = "External/libssh2-ios/lib/libssh2-ios.a"; sourceTree = "<group>"; };
510+
6A1F2FD317C6A8F3003DFADE /* libcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libcrypto.a; path = External/build/lib/libcrypto.a; sourceTree = "<group>"; };
511+
6A1F2FD417C6A8F3003DFADE /* libssl.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssl.a; path = External/build/lib/libssl.a; sourceTree = "<group>"; };
512+
6A502B8617D6892D00BAF4A5 /* libssh2.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libssh2.a; path = External/build/lib/libssh2.a; sourceTree = "<group>"; };
510513
6EEB519F199D62B9001D72C0 /* GTFetchHeadEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GTFetchHeadEntry.h; sourceTree = "<group>"; };
511514
6EEB51A0199D62B9001D72C0 /* GTFetchHeadEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GTFetchHeadEntry.m; sourceTree = "<group>"; };
512515
79262F0E13C697BE00A4B1EA /* git2 */ = {isa = PBXFileReference; lastKnownFileType = folder; name = git2; path = External/libgit2/include/git2; sourceTree = "<group>"; };
@@ -683,6 +686,7 @@
683686
files = (
684687
F8D6385D207AC75100D1FD32 /* libz.tbd in Frameworks */,
685688
F8D6385C207AC74A00D1FD32 /* libiconv.tbd in Frameworks */,
689+
4D9BCD24206D84AD003CD3CE /* libgit2.a in Frameworks */,
686690
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */,
687691
);
688692
runOnlyForDeploymentPostprocessing = 0;
@@ -694,9 +698,9 @@
694698
F8D63861207ACAF700D1FD32 /* libiconv.tbd in Frameworks */,
695699
F8D6385F207ACAE600D1FD32 /* libz.tbd in Frameworks */,
696700
D05FC5E319FAD03C008C9348 /* libssl.a in Frameworks */,
697-
F84277BA207B1002008AB8E8 /* Nimble.framework in Frameworks */,
698701
D05FC5E219FAD039008C9348 /* libcrypto.a in Frameworks */,
699-
D05FC5E419FAD040008C9348 /* libssh2-ios.a in Frameworks */,
702+
D05FC5E419FAD040008C9348 /* libssh2.a in Frameworks */,
703+
4D9BCD25206D84B2003CD3CE /* libgit2.a in Frameworks */,
700704
);
701705
runOnlyForDeploymentPostprocessing = 0;
702706
};
@@ -707,6 +711,7 @@
707711
F84277BE207B104A008AB8E8 /* XCTest.framework in Frameworks */,
708712
F8D63868207ACCEE00D1FD32 /* Quick.framework in Frameworks */,
709713
F879D83C1B4B7F7D002D5C07 /* ObjectiveGit.framework in Frameworks */,
714+
4DFA918F207D0B87003CD3CE /* Nimble.framework in Frameworks */,
710715
F8D6386A207ACDDD00D1FD32 /* ZipArchive.framework in Frameworks */,
711716
);
712717
runOnlyForDeploymentPostprocessing = 0;
@@ -746,16 +751,17 @@
746751
0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = {
747752
isa = PBXGroup;
748753
children = (
749-
1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */,
750754
306123A817EA5261006591D4 /* extobjc */,
751755
889923F919FF5DD40092A9A6 /* git2 */,
752756
6A1F2FD317C6A8F3003DFADE /* libcrypto.a */,
753757
F8D63860207ACAF600D1FD32 /* libiconv.tbd */,
754758
F8D6385B207AC74A00D1FD32 /* libiconv.tbd */,
755-
6A502B8617D6892D00BAF4A5 /* libssh2-ios.a */,
756-
6A1F2FD417C6A8F3003DFADE /* libssl.a */,
757759
23BB67BB1C7DF45300A37A66 /* libz.tbd */,
758760
F8D6385E207ACAE600D1FD32 /* libz.tbd */,
761+
6A1F2FD417C6A8F3003DFADE /* libssl.a */,
762+
6A502B8617D6892D00BAF4A5 /* libssh2.a */,
763+
4D9BCD23206D84AD003CD3CE /* libgit2.a */,
764+
1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */,
759765
D0A0128B19F9853D007F1914 /* Nimble.framework */,
760766
F8D63865207ACCAA00D1FD32 /* Nimble.framework */,
761767
D0A0128819F98475007F1914 /* Quick.framework */,
@@ -1683,6 +1689,10 @@
16831689
DYLIB_CURRENT_VERSION = 1;
16841690
FRAMEWORK_VERSION = A;
16851691
INFOPLIST_FILE = Info.plist;
1692+
LIBRARY_SEARCH_PATHS = (
1693+
"$(inherited)",
1694+
"$(PROJECT_DIR)/External/build/lib",
1695+
);
16861696
MODULEMAP_FILE = ObjectiveGit.modulemap;
16871697
OTHER_LDFLAGS = (
16881698
"-lgit2",
@@ -1707,6 +1717,10 @@
17071717
DYLIB_CURRENT_VERSION = 1;
17081718
FRAMEWORK_VERSION = A;
17091719
INFOPLIST_FILE = Info.plist;
1720+
LIBRARY_SEARCH_PATHS = (
1721+
"$(inherited)",
1722+
"$(PROJECT_DIR)/External/build/lib",
1723+
);
17101724
MODULEMAP_FILE = ObjectiveGit.modulemap;
17111725
OTHER_LDFLAGS = (
17121726
"-lgit2",
@@ -1942,6 +1956,10 @@
19421956
DYLIB_CURRENT_VERSION = 1;
19431957
FRAMEWORK_VERSION = A;
19441958
INFOPLIST_FILE = Info.plist;
1959+
LIBRARY_SEARCH_PATHS = (
1960+
"$(inherited)",
1961+
"$(PROJECT_DIR)/External/build/lib",
1962+
);
19451963
MODULEMAP_FILE = ObjectiveGit.modulemap;
19461964
OTHER_LDFLAGS = (
19471965
"-lgit2",
@@ -1990,22 +2008,15 @@
19902008
DYLIB_CURRENT_VERSION = 1;
19912009
HEADER_SEARCH_PATHS = (
19922010
"$(inherited)",
1993-
"External/libssh2-ios/include/libssh2",
1994-
External/libgit2/include,
2011+
External/build/include,
19952012
);
19962013
INFOPLIST_FILE = Info.plist;
1997-
LIBRARY_SEARCH_PATHS = (
1998-
"External/ios-openssl/lib",
1999-
"External/libssh2-ios/lib",
2000-
"External/libgit2-ios",
2001-
);
2014+
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib";
20022015
MODULEMAP_FILE = ObjectiveGit.modulemap;
2003-
OTHER_LDFLAGS = (
2004-
"-lgit2-ios",
2005-
"-all_load",
2006-
);
2016+
OTHER_LDFLAGS = "-all_load";
20072017
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
20082018
PRODUCT_NAME = ObjectiveGit;
2019+
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include";
20092020
VERSIONING_SYSTEM = "apple-generic";
20102021
VERSION_INFO_PREFIX = "";
20112022
};
@@ -2054,22 +2065,15 @@
20542065
DYLIB_CURRENT_VERSION = 1;
20552066
HEADER_SEARCH_PATHS = (
20562067
"$(inherited)",
2057-
"External/libssh2-ios/include/libssh2",
2058-
External/libgit2/include,
2068+
External/build/include,
20592069
);
20602070
INFOPLIST_FILE = Info.plist;
2061-
LIBRARY_SEARCH_PATHS = (
2062-
"External/ios-openssl/lib",
2063-
"External/libssh2-ios/lib",
2064-
"External/libgit2-ios",
2065-
);
2071+
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib";
20662072
MODULEMAP_FILE = ObjectiveGit.modulemap;
2067-
OTHER_LDFLAGS = (
2068-
"-lgit2-ios",
2069-
"-all_load",
2070-
);
2073+
OTHER_LDFLAGS = "-all_load";
20712074
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
20722075
PRODUCT_NAME = ObjectiveGit;
2076+
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include";
20732077
VERSIONING_SYSTEM = "apple-generic";
20742078
VERSION_INFO_PREFIX = "";
20752079
};
@@ -2086,22 +2090,15 @@
20862090
DYLIB_CURRENT_VERSION = 1;
20872091
HEADER_SEARCH_PATHS = (
20882092
"$(inherited)",
2089-
"External/libssh2-ios/include/libssh2",
2090-
External/libgit2/include,
2093+
External/build/include,
20912094
);
20922095
INFOPLIST_FILE = Info.plist;
2093-
LIBRARY_SEARCH_PATHS = (
2094-
"External/ios-openssl/lib",
2095-
"External/libssh2-ios/lib",
2096-
"External/libgit2-ios",
2097-
);
2096+
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib";
20982097
MODULEMAP_FILE = ObjectiveGit.modulemap;
2099-
OTHER_LDFLAGS = (
2100-
"-lgit2-ios",
2101-
"-all_load",
2102-
);
2098+
OTHER_LDFLAGS = "-all_load";
21032099
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
21042100
PRODUCT_NAME = ObjectiveGit;
2101+
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include";
21052102
VERSIONING_SYSTEM = "apple-generic";
21062103
VERSION_INFO_PREFIX = "";
21072104
};
@@ -2118,22 +2115,15 @@
21182115
DYLIB_CURRENT_VERSION = 1;
21192116
HEADER_SEARCH_PATHS = (
21202117
"$(inherited)",
2121-
"External/libssh2-ios/include/libssh2",
2122-
External/libgit2/include,
2118+
External/build/include,
21232119
);
21242120
INFOPLIST_FILE = Info.plist;
2125-
LIBRARY_SEARCH_PATHS = (
2126-
"External/ios-openssl/lib",
2127-
"External/libssh2-ios/lib",
2128-
"External/libgit2-ios",
2129-
);
2121+
LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/External/build/lib";
21302122
MODULEMAP_FILE = ObjectiveGit.modulemap;
2131-
OTHER_LDFLAGS = (
2132-
"-lgit2-ios",
2133-
"-all_load",
2134-
);
2123+
OTHER_LDFLAGS = "-all_load";
21352124
PRODUCT_BUNDLE_IDENTIFIER = "org.libgit2.$(PRODUCT_NAME:rfc1034identifier)";
21362125
PRODUCT_NAME = ObjectiveGit;
2126+
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/External/libgit2/include";
21372127
VERSIONING_SYSTEM = "apple-generic";
21382128
VERSION_INFO_PREFIX = "";
21392129
};
@@ -2185,6 +2175,10 @@
21852175
DYLIB_CURRENT_VERSION = 1;
21862176
FRAMEWORK_VERSION = A;
21872177
INFOPLIST_FILE = Info.plist;
2178+
LIBRARY_SEARCH_PATHS = (
2179+
"$(inherited)",
2180+
"$(PROJECT_DIR)/External/build/lib",
2181+
);
21882182
MODULEMAP_FILE = ObjectiveGit.modulemap;
21892183
OTHER_LDFLAGS = (
21902184
"-lgit2",

‎script/ios_build_functions.sh

+19-5
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ function setup_build_environment ()
99
# e.g. via brew. Xcode's Run Script phase doesn't seem to honor
1010
# ~/.MacOSX/environment.plist
1111
PATH="/usr/local/bin:/opt/boxen/homebrew/bin:$PATH"
12-
12+
1313
pushd "$SCRIPT_DIR/.." > /dev/null
1414
ROOT_PATH="$PWD"
1515
popd > /dev/null
@@ -22,7 +22,7 @@ function setup_build_environment ()
2222
MACOSX_DEPLOYMENT_TARGET=""
2323

2424
XCODE_MAJOR_VERSION=$(xcode_major_version)
25-
25+
2626
CAN_BUILD_64BIT="0"
2727

2828
# If IPHONEOS_DEPLOYMENT_TARGET has not been specified
@@ -32,7 +32,7 @@ function setup_build_environment ()
3232
then
3333
IPHONEOS_DEPLOYMENT_TARGET="6.0"
3434
fi
35-
35+
3636
# Determine if we can be building 64-bit binaries
3737
if [ "${XCODE_MAJOR_VERSION}" -ge "5" ] && [ $(echo ${IPHONEOS_DEPLOYMENT_TARGET} '>=' 6.0 | bc -l) == "1" ]
3838
then
@@ -46,12 +46,19 @@ function setup_build_environment ()
4646
# builds to be first
4747
ARCHS="x86_64 ${ARCHS} arm64"
4848
fi
49+
50+
# Setup a shared area for our build artifacts
51+
INSTALL_PATH="${ROOT_PATH}/External/build"
52+
mkdir -p "${INSTALL_PATH}"
53+
mkdir -p "${INSTALL_PATH}/log"
54+
mkdir -p "${INSTALL_PATH}/include"
55+
mkdir -p "${INSTALL_PATH}/lib/pkgconfig"
4956
}
5057

5158
function build_all_archs ()
5259
{
5360
setup_build_environment
54-
61+
5562
local setup=$1
5663
local build_arch=$2
5764
local finish_build=$3
@@ -81,10 +88,17 @@ function build_all_archs ()
8188

8289
SDKNAME="${PLATFORM}${SDKVERSION}"
8390
SDKROOT="$(ios_sdk_path ${SDKNAME})"
84-
91+
92+
LOG="${INSTALL_PATH}/log/${LIBRARY_NAME}-${ARCH}.log"
93+
[ -f "${LOG}" ] && rm "${LOG}"
94+
8595
echo "Building ${LIBRARY_NAME} for ${SDKNAME} ${ARCH}"
96+
echo "Build log can be found in ${LOG}"
8697
echo "Please stand by..."
8798

99+
ARCH_INSTALL_PATH="${INSTALL_PATH}/${SDKNAME}-${ARCH}.sdk"
100+
mkdir -p "${ARCH_INSTALL_PATH}"
101+
88102
# run the per arch build command
89103
eval $build_arch
90104
done

‎script/update_libgit2_ios

+18-27
Original file line numberDiff line numberDiff line change
@@ -8,69 +8,60 @@ source "${SCRIPT_DIR}/ios_build_functions.sh"
88

99
function setup ()
1010
{
11-
if [ "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a" -nt "${ROOT_PATH}/External/libgit2" ]
11+
if [ "${INSTALL_PATH}/lib/libgit2.a" -nt "${ROOT_PATH}/External/libgit2" ]
1212
then
1313
echo "No update needed."
1414
exit 0
1515
fi
1616

1717
LIBRARY_NAME="libgit2"
18-
LIB_PATH="${ROOT_PATH}/External/libgit2-ios"
19-
rm -rf "${LIB_PATH}"
20-
21-
pushd "${ROOT_PATH}/External/libgit2" > /dev/null
2218
}
2319

2420
function build_libgit2 ()
2521
{
26-
rm -rf "build"
27-
mkdir "build"
28-
29-
pushd "build" > /dev/null
3022

31-
# LOL Cmake
32-
if [ "${ARCH}" != "i386" ] && [ "${ARCH}" != "x86_64" ]
33-
then
34-
SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}"
35-
fi
23+
# Force CMake to rebuild
24+
rm -rf "${ARCH_INSTALL_PATH}/libgit2"
3625

37-
# install the each built arch somewhere sane
38-
INSTALL_PREFIX="${LIB_PATH}/${SDKNAME}-${ARCH}.sdk"
26+
mkdir -p "${ARCH_INSTALL_PATH}/libgit2"
27+
pushd "${ARCH_INSTALL_PATH}/libgit2" > /dev/null
3928

40-
mkdir -p "${INSTALL_PREFIX}"
29+
# LOL Cmake
30+
SYS_ROOT="-DCMAKE_OSX_SYSROOT=${SDKROOT}"
4131

42-
LOG="${INSTALL_PREFIX}/build-libgit2.log"
43-
echo "$LOG"
32+
# Limit pkg-config to what we're currently expecting it to use
33+
# PKG_CONFIG_PATH="${INSTALL_PATH}/lib/pkgconfig/"
34+
# LDFLAGS="-L $(xcrun --sdk iphoneos --show-sdk-path)/usr/lib"
35+
# export PKG_CONFIG_PATH
36+
# export LDFLAGS
4437

4538
cmake \
4639
-DCMAKE_C_COMPILER_WORKS:BOOL=ON \
4740
-DBUILD_SHARED_LIBS:BOOL=OFF \
48-
-DCMAKE_PREFIX_PATH:PATH="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk" \
41+
-DCMAKE_PREFIX_PATH:PATH="${INSTALL_PATH}/" \
4942
-DPKG_CONFIG_USE_CMAKE_PREFIX_PATH:BOOL=ON \
50-
-DCMAKE_INSTALL_PREFIX:PATH="${INSTALL_PREFIX}/" \
43+
-DCMAKE_INSTALL_PREFIX:PATH="${ARCH_INSTALL_PATH}/" \
5144
-DBUILD_CLAR:BOOL=OFF \
5245
-DTHREADSAFE:BOOL=ON \
5346
-DCURL:BOOL=OFF \
5447
-DCMAKE_C_FLAGS:STRING="-fembed-bitcode" \
5548
"${SYS_ROOT}" \
5649
-DCMAKE_OSX_ARCHITECTURES:STRING="${ARCH}" \
57-
.. >> "${LOG}" 2>&1
50+
"${ROOT_PATH}/External/libgit2" >> "${LOG}" 2>&1
5851
cmake --build . --target install >> "${LOG}" 2>&1
52+
popd > /dev/null
5953

6054
# push the built library into the list
61-
BUILT_LIB_PATHS+=("${INSTALL_PREFIX}/lib/libgit2.a")
62-
popd > /dev/null
55+
BUILT_LIB_PATHS+=("${ARCH_INSTALL_PATH}/lib/libgit2.a")
6356
}
6457

6558
function fat_binary ()
6659
{
6760
echo "Building fat binary..."
6861

69-
lipo -create "${BUILT_LIB_PATHS[@]}" -output "${ROOT_PATH}/External/libgit2-ios/libgit2-ios.a"
62+
lipo -create "${BUILT_LIB_PATHS[@]}" -output "${INSTALL_PATH}/lib/libgit2.a"
7063

7164
echo "Building done."
72-
73-
popd > /dev/null
7465
}
7566

7667
build_all_archs setup build_libgit2 fat_binary

‎script/update_libssh2_ios

+15-17
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,44 @@ source "${SCRIPT_DIR}/ios_build_functions.sh"
88

99
function setup ()
1010
{
11-
if [ -f "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a" ]
11+
if [ -f "${INSTALL_PATH}/lib/libssh2.a" ]
1212
then
1313
echo "No update needed."
1414
exit 0
1515
fi
1616
LIBRARY_NAME="libssh2"
1717
}
1818

19-
function build_ssh2 ()
19+
function build_ssh2 ()
2020
{
21-
mkdir -p "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/lib" "${ROOT_PATH}/External/libssh2-ios/src"
22-
23-
rm -rf "${ROOT_PATH}/External/libssh2-ios/src/libssh2"
24-
cp -R "${ROOT_PATH}/External/libssh2" "${ROOT_PATH}/External/libssh2-ios/src/"
25-
pushd "${ROOT_PATH}/External/libssh2-ios/src/libssh2" > /dev/null
21+
cp -R "${ROOT_PATH}/External/libssh2" "${ARCH_INSTALL_PATH}/libssh2"
22+
pushd "${ARCH_INSTALL_PATH}/libssh2" > /dev/null
2623

2724
export CFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"
2825
export CPPFLAGS="-arch ${ARCH} -fembed-bitcode -pipe -no-cpp-precomp -isysroot ${SDKROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET}"
2926

30-
mkdir -p "${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk"
31-
LOG="${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/build-libssh2.log"
32-
33-
echo "${LOG}"
34-
3527
./buildconf >> "${LOG}" 2>&1
36-
./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
28+
./configure --host=${HOST} --prefix="${ARCH_INSTALL_PATH}" --with-openssl --with-libssl-prefix="${INSTALL_PATH}" --disable-shared --enable-static >> "${LOG}" 2>&1
3729
make >> "${LOG}" 2>&1
3830
make install >> "${LOG}" 2>&1
3931
popd > /dev/null
4032

41-
BUILT_LIBS+=("${ROOT_PATH}/External/libssh2-ios/bin/${SDKNAME}-${ARCH}.sdk/lib/libssh2.a")
33+
rm -rf "${ARCH_INSTALL_PATH}/libssh2"
34+
35+
BUILT_LIBS+=("${ARCH_INSTALL_PATH}/lib/libssh2.a")
4236
}
4337

4438
function fat_binary ()
4539
{
40+
echo "Copying headers & pkg-config files"
41+
42+
cp -r "${ARCH_INSTALL_PATH}"/include/libssh*.h "${INSTALL_PATH}/include/"
43+
cp "${ARCH_INSTALL_PATH}/lib/pkgconfig/libssh2.pc" "${INSTALL_PATH}/lib/pkgconfig/"
44+
perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/libssh2.pc" >> "${LOG}" 2>&1
45+
4646
echo "Building fat binary..."
4747

48-
lipo -create "${BUILT_LIBS[@]}" -output "${ROOT_PATH}/External/libssh2-ios/lib/libssh2-ios.a"
49-
mkdir -p "${ROOT_PATH}/External/libssh2-ios/include/libssh2"
50-
cp -R "${ROOT_PATH}/External/libssh2-ios/bin/iphonesimulator${SDKVERSION}-i386.sdk/include/libssh2.h" "${ROOT_PATH}/External/libssh2-ios/include/libssh2/"
48+
lipo -create "${BUILT_LIBS[@]}" -output "${INSTALL_PATH}/lib/libssh2.a"
5149

5250
echo "Building done."
5351
}

‎script/update_libssl_ios

+22-29
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,28 @@
11
#!/bin/bash
22

3+
set -e
4+
35
# source the common build functions
46
SCRIPT_DIR=$(dirname "$0")
57
source "${SCRIPT_DIR}/ios_build_functions.sh"
68

79
function setup ()
810
{
9-
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" ]
11+
if [ -f "${INSTALL_PATH}/lib/libssl.a" -a \
12+
-f "${INSTALL_PATH}/lib/libcrypto.a" -a \
13+
-d "${INSTALL_PATH}/include/openssl" ]
1014
then
1115
echo "No update needed."
1216
exit 0
1317
fi
1418

1519
LIBRARY_NAME="OpenSSL"
16-
17-
rm -rf "${ROOT_PATH}/External/ios-openssl/include" "External/ios-openssl/lib"
18-
}
19-
20-
function cleanup ()
21-
{
22-
rm -rf "/tmp/openssl"
23-
rm -rf "/tmp/openssl-*.log"
2420
}
2521

26-
function build_ssl ()
22+
function build_ssl ()
2723
{
28-
rm -rf "/tmp/openssl"
29-
cp -r "${ROOT_PATH}/External/openssl" "/tmp/"
30-
pushd "/tmp/openssl" > /dev/null
31-
32-
LOG="/tmp/openssl-${ARCH}.log"
24+
cp -r "${ROOT_PATH}/External/openssl" "${ARCH_INSTALL_PATH}/openssl"
25+
pushd "${ARCH_INSTALL_PATH}/openssl" > /dev/null
3326

3427
if [ "${ARCH}" == "arm64" ] || [ "${ARCH}" == "x86_64" ]
3528
then
@@ -40,36 +33,36 @@ function build_ssl ()
4033
CONFIG="no-gost no-asm"
4134
perl -i -pe 's|static volatile sig_atomic_t intr_signal|static volatile int intr_signal|' crypto/ui/ui_openssl.c
4235
fi
43-
echo "$LOG"
4436

45-
./Configure ${HOST} ${CONFIG} --openssldir="/tmp/openssl-${ARCH}" >> "${LOG}" 2>&1
37+
./Configure ${HOST} ${CONFIG} --openssldir="${ARCH_INSTALL_PATH}" >> "${LOG}" 2>&1
4638
perl -i -pe "s|^CC= gcc|CC= ${CLANG} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -arch ${ARCH} -fembed-bitcode |g" Makefile >> "${LOG}" 2>&1
4739
perl -i -pe "s|^CFLAG= (.*)|CFLAG= -isysroot ${SDKROOT} \$1|g" Makefile >> "${LOG}" 2>&1
4840
make >> "${LOG}" 2>&1
4941

5042
make install_sw >> "${LOG}" 2>&1
5143
popd > /dev/null
52-
rm -rf "/tmp/openssl"
5344

54-
BUILT_CRYPTO_PATHS+=("/tmp/openssl-${ARCH}/lib/libcrypto.a")
55-
BUILT_SSL_PATHS+=("/tmp/openssl-${ARCH}/lib/libssl.a")
45+
rm -rf "${ARCH_INSTALL_PATH}/openssl"
46+
47+
BUILT_CRYPTO_PATHS+=("${ARCH_INSTALL_PATH}/lib/libcrypto.a")
48+
BUILT_SSL_PATHS+=("${ARCH_INSTALL_PATH}/lib/libssl.a")
5649
}
5750

5851
function fat_binary ()
5952
{
60-
echo "Building fat binary..."
53+
echo "Copying headers & pkg-config files"
54+
cp -r "${ARCH_INSTALL_PATH}/include/openssl" "${INSTALL_PATH}/include/"
55+
for pkgfile in "${ARCH_INSTALL_PATH}"/lib/pkgconfig/*.pc; do
56+
cp "${pkgfile}" "${INSTALL_PATH}/lib/pkgconfig/"
57+
perl -i -pe "s|^(prefix=${INSTALL_PATH}).*$|\$1|g" "${INSTALL_PATH}/lib/pkgconfig/$(basename "${pkgfile}")" >> "${LOG}" 2>&1
58+
done
6159

62-
mkdir -p "${ROOT_PATH}/External/ios-openssl/include"
63-
cp -r /tmp/openssl-i386/include/openssl "${ROOT_PATH}/External/ios-openssl/include/"
64-
65-
mkdir -p "${ROOT_PATH}/External/ios-openssl/lib"
60+
echo "Building fat binary..."
6661

67-
lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libcrypto.a"
68-
lipo -create "${BUILT_SSL_PATHS[@]}" -output "${ROOT_PATH}/External/ios-openssl/lib/libssl.a"
62+
lipo -create "${BUILT_CRYPTO_PATHS[@]}" -output "${INSTALL_PATH}/lib/libcrypto.a"
63+
lipo -create "${BUILT_SSL_PATHS[@]}" -output "${INSTALL_PATH}/lib/libssl.a"
6964

7065
echo "Building done."
7166
}
7267

73-
cleanup
7468
build_all_archs setup build_ssl fat_binary
75-
cleanup

‎script/xcode_functions.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function ios_sdk_version ()
2626
# iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0)
2727
# SDKVersion: 9.0
2828

29-
/usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
29+
/usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }'
3030
}
3131

3232
# Returns the path to the specified iOS SDK name

0 commit comments

Comments
 (0)
Please sign in to comment.