We were passionate about "making Swift 3.0 run on more Linux systems", so we started building Swift 3.0 on Ubuntu 16.04, Xenial Xerus, X86 systems. The installation process is very simple, just add our APT repository and use apt-get. The binary file will be installed in the /opt/swift/swift-3.0 directory, so the path path needs to be updated after installing the 3.0 version. Editor's Note: For why we use the /opt/swift instead of the /usr/bin/ directory, we can find the reason in this post on the swift-dev mailing list.
1. Add a repository key
bash
wget -qO- / | sudo apt-key add -
2. Add Xenial repository to
bash
echo "deb http://iachievedit-repos./ xenial main" | sudo tee --append /etc/apt/
3. Execute apt-get update
bash
sudo apt-get update
4. Install swift-3.0!
bash
sudo apt-get install swift-3.0
5. Update the PATH path!
bash
export PATH=/opt/swift/swift-3.0/usr/bin:$PATH
6. Test
bash
git clone /apple/example-package-dealer
cd example-packager-dealer
swift build
Compiling Swift Module 'FisherYates' (1 sources)
Linking Library: .build/debug/
Compiling Swift Module 'PlayingCard' (3 sources)
Linking Library: .build/debug/
Compiling Swift Module 'DeckOfPlayingCards' (1 sources)
Linking Library: .build/debug/
Compiling Swift Module 'Dealer' (1 sources)
Linking Executable: .build/debug/Dealer
Start executing!
bash
.build/debug/Dealer
FAQ
Q. Are these binary versions officially built by Apple?
A. No, I built it on my own personal server. Please refer to my previous article for the construction process.
Q. What historical versions of git are included in this build?
A. You can use apt-cache show swift-3.0 to view this information. For example:
bash
# apt-cache show swift-3.0
Package: swift-3.0
Conflicts: swift-2.2
Version: 1:3.0-0ubuntu10+xenial1
Architecture: amd64
Installed-Size: 370463
Maintainer: iachievedit (support@)
Depends: clang (>= 3.6), libicu-dev
Homepage: /iachievedit/swift
Priority: optional
Section: development
Filename: pool/main/s/swift-3.0/swift-3.0_3.0-0ubuntu10+xenial1_amd64.deb
Size: 72513864
SHA256: b1bf548f353466ea72696089a8b666956a2603edb467eb0517e858eb1ba86511
SHA1: 5dd02b14d21f2e821040de3bb1052561653fcfcd
MD5sum: f2c3d3b9517a303cc86558b6c560a8d6
Description: Open Source Swift
This is a packaged version of Open Source Swift 3.0 built from
the following git revisions of the Apple Github repositories:
Clang: 460d629e85
LLVM: 8d0086ac3e
Swift: 1abe85ab41
Foundation: 4c15543f82
Description-md5: a6b1dd247c7584b61692a101d9d0e5fa
The source tree for each build is unchanged.
Q. Have you tested these binaries before uploading?
A. The Swift construction process is to test binary files. I will perform some basic tests and use it to compile my own application, but I currently do not have a separate and comprehensive test tool.
Q. Are you releasing a new build version on a certain schedule?
A. Not, but I try to keep pace with Apple's official release. My goal is to publish these things, and then use them to experience them and start Swift development on Linux.
Q. Where are the installed files?
A. All files are placed in the /opt/swift/swift-3.0/usr directory.
Q. How to understand the version number of the package?
A. Decompose the version number, 3.0-0ubuntu10+xenial1 can be understood as:
3.0 is the Swift packaged version number
-0ubuntu10 means that this is the second package of Ubuntu, and the beginning of 0 means that the current package is not modified based on the upstream Debain package.
+xenial1 means that this package is used for Xenial Xerus.
I think my understanding is correct, but if you have any other opinion, leave me a message
How we do these things
I used this awesome tutorial on how to deploy a Debain package repository on Amazon S3. I've tried configuring Launchpad PPA, but frankly, I'm very tired of deploying a simple package that requires troublesome and complex metadata integration. I can be sure that these steps are necessary for the deployment of the distribution repository, but for what I need to deploy, it is obviously a killer. For those who develop fpm, they also have some opinions on their own.
The packaging script we use to build the code and upload it to the repository can be found on Github. For Swift 3.0, remember to switch to the swift-3.0 branch.