Last active
March 12, 2017 18:49
-
-
Save bmaupin/db7998ae61238f813f26daca1bec68d3 to your computer and use it in GitHub Desktop.
Build Swift with Foundation on Ubuntu 14.04/16.04
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Note: the Swift binaries for Linux already include Foundation. To install them, see: https://gist.github.com/bmaupin/a1585eb29b893ac8d184 | |
# To use Foundation, just 'import Foundation' | |
# If you really want to build Swift with Foundation, keep reading... | |
# References: | |
# https://github.com/apple/swift#getting-sources-for-swift-and-related-projects | |
# https://github.com/apple/swift-corelibs-foundation/blob/master/Docs/GettingStarted.md#on-linux | |
# A lot of folders will be created for dependencies, so put them all in one subfolder to keep things organized | |
mkdir swift-source | |
cd swift-source | |
# Install dependencies | |
sudo apt 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 | |
# Install a supported version of cmake | |
# (https://github.com/apple/swift/blob/master/docs/Ubuntu14.md) | |
if lsb_release -r | grep -q 14.04; then | |
wget http://www.cmake.org/files/v3.5/cmake-3.5.2.tar.gz | |
tar xf cmake-3.5.2.tar.gz | |
cd cmake-3.5.2 | |
./configure | |
make | |
sudo make install | |
sudo update-alternatives --install /usr/bin/cmake cmake /usr/local/bin/cmake 1 --force | |
cmake --version | |
cd .. | |
fi | |
# Build Swift and Foundation | |
git clone https://github.com/apple/swift.git | |
swift/utils/update-checkout --clone | |
git clone https://github.com/apple/swift-corelibs-foundation.git | |
swift/utils/build-script --xctest --foundation -t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment