Ubuntu 14.04 Package for Open Source Swift 2.2

Categories:

Ubuntu 15.10 and 14.04 instructions are now available here!

Quick and easy instructions for installing Open Source Swift 2.2 on Ubuntu 14.04 using apt-get.

1. Add the repository key

wget -qO- http://dev.iachieved.it/iachievedit.gpg.key | sudo apt-key add -

2. Add the repository to sources.list

echo "deb http://iachievedit-repos.s3.amazonaws.com/ trusty main" | sudo tee --append /etc/apt/sources.list

3. Run apt-get update

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

Run it!

.build/debug/Dealer

FAQ

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 (support@iachieved.it)
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 clang, gcc, etc.

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

I think I got that right, but if you feel otherwise please do drop me a line at support@iachieved.it.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *