forked from jatoben/CommandLine
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-linux-swift.sh
executable file
·28 lines (24 loc) · 1.18 KB
/
install-linux-swift.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
set -ev
SWIFT_SNAPSHOT="swift-3.0-PREVIEW-2"
XCTEST_SNAPSHOT="swift-3.0-PREVIEW-2"
echo "Installing ${SWIFT_SNAPSHOT}..."
if [ ! -f "${SWIFT_SNAPSHOT}-ubuntu14.04.tar.gz" ]; then
curl -s -L -O "https://swift.org/builds/$(echo $SWIFT_SNAPSHOT | tr A-Z a-z)/ubuntu1404/${SWIFT_SNAPSHOT}/${SWIFT_SNAPSHOT}-ubuntu14.04.tar.gz"
fi
tar -zxf "${SWIFT_SNAPSHOT}-ubuntu14.04.tar.gz"
sudo rm -rf /swift
sudo mv "${SWIFT_SNAPSHOT}-ubuntu14.04" /swift
# Force the use of the gold linker
# See https://bugs.swift.org/browse/SR-1023 and https://github.com/apple/swift/pull/2609
sudo rm /usr/bin/ld
sudo ln -s /usr/bin/ld.gold /usr/bin/ld
echo "Installing XCTest..."
if [ ! -f "${XCTEST_SNAPSHOT}.tar.gz" ]; then
curl -s -L -O "https://github.com/apple/swift-corelibs-xctest/archive/${XCTEST_SNAPSHOT}.tar.gz"
fi
tar -zxvf "${XCTEST_SNAPSHOT}.tar.gz"
cd "swift-corelibs-xctest-${XCTEST_SNAPSHOT}"
sudo ./build_script.py --swiftc="/swift/usr/bin/swiftc" --build-dir="/tmp/XCTest_build" --foundation-build-dir="/swift/usr/lib/swift/linux" --library-install-path="/swift/usr/lib/swift/linux" --module-install-path="/swift/usr/lib/swift/linux/x86_64"
cd ..
rm -rf "swift-corelibs-xctest-${XCTEST_SNAPSHOT}"