Ubuntu Packages for Open Source Swift
1. Add the repository key
wget -qO- http://dev.iachieved.it/iachievedit.gpg.key | sudo apt-key add -
2. Add the appropriate repository to
echo "deb http://iachievedit-repos.s3.amazonaws.com/ trusty main" | sudo tee --append /etc/apt/sources.list
echo "deb http://iachievedit-repos.s3.amazonaws.com/ wily main" | sudo tee --append /etc/apt/sources.list
sudo apt-get update
4. Install swift-2.2!
apt-get install swift-2.2
I am currently serving this package off of Amazon S3 so it may take a bit to download. I am looking at whether or not I can afford utilizing CloudFront.
5. Try it out
git clone https://github.com/apple/example-package-dealer cd example-packager-dealer swift build Compiling Swift Module 'FisherYates' (1 sources) Linking Library: .build/debug/FisherYates.a Compiling Swift Module 'PlayingCard' (3 sources) Linking Library: .build/debug/PlayingCard.a Compiling Swift Module 'DeckOfPlayingCards' (1 sources) Linking Library: .build/debug/DeckOfPlayingCards.a Compiling Swift Module 'Dealer' (1 sources) Linking Executable: .build/debug/Dealer
Q. Did Apple build these binaries?
A. No, I built them on my personal server using the instructions I posted here.
Q. What git revisions are included in the build?
A. You can use
apt-cache show swift-2.2 to see this information. For example:
# apt-cache show swift-2.2 Package: swift-2.2 Version: 1:2.2-0ubuntu4~trusty1 Architecture: amd64 Maintainer: iachievedit (email@example.com) Depends: clang-3.6, libicu-dev Homepage: http://dev.iachieved.it/iachievedit/swift Priority: optional Section: development Filename: pool/main/s/swift-2.2/swift-2.2_2.2-0ubuntu4~trusty1_amd64.deb Size: 60218098 SHA256: 69d5c38c97fd748af7829cb4c00d51539d0e6c21de9740754d2fa0da71c1bb8e SHA1: 5872fb2a9c06cc4461d4a26eb9c4350e3b89ac1a MD5sum: 87e12231e38a75e9126855b803daa4fd Description: Open Source Swift This is a packaged version of Open Source Swift 2.2 built from the following git revisions of the Apple Github repositories: Clang: f66c5bb67b LLVM: 7bae82deaa Swift: 23366f2001 Foundation: 0b6479b664 Description-md5: 1c037ae5d6761bd55f026676773e5e30
The source tree is untouched for each build.
Q. Do you test the binaries before you upload them?
A. The Swift build process tests the resulting binaries, and I then do run some basic tests and compile my own applications, but there is currently no separate exhaustive test suite.
Q. Are you releasing builds on a set schedule?
A. Not really, though I may try to stay in sync with the releases from Apple. The idea was to get something out for folks to experiment with and start coding Swift on Linux.
Q. Where is everything installed?
A. Everything gets put in
/usr, just like installing
Q. How do I decipher the package version number?
A. This was my first take on what I thought should be an appropriate package version number. Breaking it down,
2.2-0ubuntu3~trusty1 should be:
- 2.2 is the version of Swift that is packaged
- -0ubuntu3 indicates that this is the 3rd package for Ubuntu, with the 0 indicating that there is no upstream Debian package upon which this package was based
- ~trusty1 indicates that this package is for Trusty Tahr
Wily packages do not contain anything like
~wiley1 in their version number such that an upgrade from Trusty to Wiley would automatically upgrade your
swift-2.2 package correctly.
I think I got that right, but if you feel otherwise please do drop me a line at
How Does This Work?
I used these awesome instructions on how to host a Debian package repository on Amazon S3. I tried to set up a Launchpad PPA, but quite frankly, got tired of trying to wade through all the metadata required to put together a simple package. I’m sure for hosting distribution repositories it’s all required, but for this it felt like overkill. The folks that develop fpm also have some choice things to say about it.
In addition I’ll be submitting the other bits on how to package and upload to Github.