build: fix dependencies with Xcode 12

https://github.com/Carthage/Carthage/blob/master/Documentation/Xcode12Workaround.md
Change-Id: I7cf6694c789d9d05ab5d913665cc276a4d0a86ee
diff --git a/Ring/carthage.sh b/Ring/carthage.sh
new file mode 100755
index 0000000..10bc2ea
--- /dev/null
+++ b/Ring/carthage.sh
@@ -0,0 +1,20 @@
+# carthage.sh
+# Usage example: ./carthage.sh build --platform iOS
+# from https://github.com/Carthage/Carthage/issues/3019
+
+set -euo pipefail
+
+xcconfig=$(mktemp /tmp/static.xcconfig.XXXXXX)
+trap 'rm -f "$xcconfig"' INT TERM HUP EXIT
+
+# For Xcode 12 make sure EXCLUDED_ARCHS is set to arm architectures otherwise
+# the build will fail on lipo due to duplicate architectures.
+
+CURRENT_XCODE_VERSION=$(xcodebuild -version | grep "Build version" | cut -d' ' -f3)
+echo "EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$CURRENT_XCODE_VERSION = arm64 arm64e armv7 armv7s armv6 armv8" >> $xcconfig
+
+echo 'EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200 = $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_simulator__NATIVE_ARCH_64_BIT_x86_64__XCODE_1200__BUILD_$(XCODE_PRODUCT_BUILD_VERSION))' >> $xcconfig
+echo 'EXCLUDED_ARCHS = $(inherited) $(EXCLUDED_ARCHS__EFFECTIVE_PLATFORM_SUFFIX_$(EFFECTIVE_PLATFORM_SUFFIX)__NATIVE_ARCH_64_BIT_$(NATIVE_ARCH_64_BIT)__XCODE_$(XCODE_VERSION_MAJOR))' >> $xcconfig
+
+export XCODE_XCCONFIG_FILE="$xcconfig"
+carthage "$@"
diff --git a/Ring/fetch-dependencies.sh b/Ring/fetch-dependencies.sh
index 33c5d20..ab889b6 100755
--- a/Ring/fetch-dependencies.sh
+++ b/Ring/fetch-dependencies.sh
@@ -5,7 +5,7 @@
 ####################################
 
 # Bootstrap Carthage
-carthage bootstrap --platform iOS --no-use-binaries --cache-builds
+./carthage.sh bootstrap --platform iOS --no-use-binaries --cache-builds
 
 ############################################
 ## DOWNLOAD WHIRLYGLOBEMAPLY DEPENDENCIES ##