Skip to content

Instantly share code, notes, and snippets.

@therealbnut
Last active May 24, 2017 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save therealbnut/7f0336c48629c07577fa024b0c592eed to your computer and use it in GitHub Desktop.
Save therealbnut/7f0336c48629c07577fa024b0c592eed to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eu
# You can bootstrap by running:
# wget --no-cache -N tinyurl.com/install-swift-linux && chmod +x ./install-swift-linux && ./install-swift-linux
# https://github.com/apple/swift/blob/master/README.md#getting-started
source /etc/os-release
SWIFT_URL_BASE="https://swift.org/builds/development"
SWIFT_VERSION="swift-DEVELOPMENT-SNAPSHOT-2017-05-23-a"
UBUNTU_VERSION="ubuntu${VERSION_ID}"
echo "SWIFT_VERSION: ${SWIFT_VERSION}"
echo "UBUNTU_VERSION: ${UBUNTU_VERSION}"
sudo apt-get install git cmake ninja-build clang python uuid-dev \
libicu-dev icu-devtools libbsd-dev libedit-dev libxml2-dev \
libsqlite3-dev swig libpython-dev libncurses5-dev pkg-config \
libblocksruntime-dev libcurl4-openssl-dev autoconf libtool \
systemtap-sdt-dev libstdc++6
if [ ! -d ./"${SWIFT_VERSION}" ]; then
SWIFT_FILE_NAME="${SWIFT_VERSION}-${UBUNTU_VERSION}"
wget -N "${SWIFT_URL_BASE}/${UBUNTU_VERSION//.}/${SWIFT_VERSION}/${SWIFT_FILE_NAME}.tar.gz"
tar -zxvf "${SWIFT_FILE_NAME}.tar.gz"
mv ./"${SWIFT_FILE_NAME}" ./"${SWIFT_VERSION}/"
echo "export PATH=\"$(pwd)\"/${SWIFT_VERSION}/usr/bin:\"${PATH}\"" >> "${HOME}/.bashrc"
fi
export PATH="${PWD}/${SWIFT_VERSION}/usr/bin":"${PATH}"
git -C swiftpm pull || git clone https://github.com/apple/swift-package-manager.git swiftpm
cd swiftpm
Utilities/bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment