{"id":2658,"date":"2016-02-16T08:22:18","date_gmt":"2016-02-16T14:22:18","guid":{"rendered":"http:\/\/dev.iachieved.it\/iachievedit\/?p=2658"},"modified":"2016-09-17T15:05:48","modified_gmt":"2016-09-17T21:05:48","slug":"introducing-swift-3-0","status":"publish","type":"post","link":"https:\/\/dev.iachieved.it\/iachievedit\/introducing-swift-3-0\/","title":{"rendered":"APT Repositories for Swift 3.0"},"content":{"rendered":"<p><a href=\"https:\/\/swift.org\/\"><img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/Swift-3.0-orange.svg?style=flat\" alt=\"Swift 3.0\" \/><\/a> <img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/OS-Ubuntu-blue.svg?style=flat\" alt=\"Ubuntu\" \/> <img decoding=\"async\" src=\"https:\/\/img.shields.io\/badge\/Arch-X86-red.svg?style=flat\" alt=\"X86\" \/><\/p>\n<p><b>Editor&#8217;s Note:<\/b>  This post has been updated as of September 13, 2016 to reflect the official release of Swift 3.0.<\/p>\n<h3>Swift 3.0<\/h3>\n<p>Swift 3.0 has officially been released as of <a href=\"https:\/\/swift.org\/blog\/swift-3-0-released\/\">September 13, 2016<\/a>!<\/p>\n<h3>apt-get<\/h3>\n<p>Downloading a <code>.tar.gz<\/code> from Apple is nice.  Using <code>apt-get<\/code> on an Ubuntu distribution is even better.  To make it is easy to get started with Swift on Linux, we&#8217;ve provided an Ubuntu repository that you can obtain the latest Swift packages from.<\/p>\n<p><b>1.  Add the repository key<\/b><\/p>\n<pre class=\"crayon:false\">\nwget -qO- http:\/\/dev.iachieved.it\/iachievedit.gpg.key | sudo apt-key add -\n<\/pre>\n<p><b>2.  Add the appropriate repository to <code>sources.list<\/code><\/b><\/p>\n<p><b>Ubuntu 14.04 (Trusty Tahr)<\/b><\/p>\n<pre class=\"crayon:false\">\necho \"deb http:\/\/iachievedit-repos.s3.amazonaws.com\/ trusty main\" | sudo tee --append \/etc\/apt\/sources.list\n<\/pre>\n<p><b>Ubuntu 15.10 (Wily Werewolf)<\/b><\/p>\n<pre class=\"crayon:false\">\necho \"deb http:\/\/iachievedit-repos.s3.amazonaws.com\/ wily main\" | sudo tee --append \/etc\/apt\/sources.list\n<\/pre>\n<p><b>Ubuntu 16.04 (Xenial Xerus)<\/b><\/p>\n<pre class=\"crayon:false\">\necho \"deb http:\/\/iachievedit-repos.s3.amazonaws.com\/ xenial main\" | sudo tee --append \/etc\/apt\/sources.list\n<\/pre>\n<p><b>3.  Run <code>apt-get update<\/code><\/b><\/p>\n<pre class=\"crayon:false\">\nsudo apt-get update\n<\/pre>\n<p><b>4.  Install swift-3.0!<\/b><\/p>\n<pre class=\"crayon:false\">\napt-get install swift-3.0\n<\/pre>\n<p><b>5.  Update that <code>PATH<\/code>!<\/b><\/p>\n<p>Our packages install Swift in <code>\/opt\/swift\/swift-3.0<\/code>:<\/p>\n<pre class=\"crayon:false\">\nexport PATH=\/opt\/swift\/swift-3.0\/usr\/bin:$PATH\n<\/pre>\n<p>Even better, update your <code>.bashrc<\/code>, <code>.zshrc<\/code>, etc. script and permanently add <code>\/opt\/swift\/swift-3.0\/usr\/bin<\/code> to your <code>PATH<\/code>.<\/p>\n<p><b>6.  Try it out<\/b><\/p>\n<pre class=\"crayon:false\">\ngit clone https:\/\/github.com\/apple\/example-package-dealer\ncd example-packager-dealer\nswift build\nCompiling Swift Module 'FisherYates' (1 sources)\nLinking Library:  .build\/debug\/FisherYates.a\nCompiling Swift Module 'PlayingCard' (3 sources)\nLinking Library:  .build\/debug\/PlayingCard.a\nCompiling Swift Module 'DeckOfPlayingCards' (1 sources)\nLinking Library:  .build\/debug\/DeckOfPlayingCards.a\nCompiling Swift Module 'Dealer' (1 sources)\nLinking Executable:  .build\/debug\/Dealer\n<\/pre>\n<p>Run it!<\/p>\n<pre class=\"crayon:false\">\n.build\/debug\/Dealer\n<\/pre>\n<h2>FAQ<\/h2>\n<p><b>Q.<\/b>  Did Apple build these binaries?<br \/>\n<b>A.<\/b>  No, I built them on my personal server using the instructions I posted <a href=\"http:\/\/dev.iachieved.it\/iachievedit\/keeping-up-with-open-source-swift\/\">here<\/a>.<\/p>\n<p><b>Q.<\/b>  What git revisions are included in the build?<br \/>\n<b>A.<\/b>  You can use <code>apt-cache show swift-3.0<\/code> to see this information.  For example:<\/p>\n<pre class=\"crayon:false\">\n# apt-cache show swift-3.0\nPackage: swift-3.0\nConflicts: swift-2.2\nVersion: 1:3.0-0ubuntu14+xenial1\nArchitecture: amd64\nInstalled-Size: 379197\nMaintainer: iachievedit (support@iachieved.it)\nDepends: clang (>= 3.6), libicu-dev\nHomepage: http:\/\/dev.iachieved.it\/iachievedit\/swift\nPriority: optional\nSection: development\nFilename: pool\/main\/s\/swift-3.0\/swift-3.0_3.0-0ubuntu14+xenial1_amd64.deb\nSize: 73949420\nSHA256: 5a7231d307bfb6564ec931313bfaf1a9442d5a8a911afe8e7f9ed08fbb767fca\nSHA1: ad3698e81b80a61f960536413e1ec6d69167a4ee\nMD5sum: 3e7976a0874d1894cb6fb3222bd743f8\nDescription: Open Source Swift\n This is a packaged version of Open Source Swift 3.0 built from\n the following git revisions of the Apple Github repositories:\n       Clang:  968470f170\n        LLVM:  0e49d60410\n       Swift:  13f05f0094\n  Foundation:  2eccd197f2\nDescription-md5: b4a6698ebeacd64f3d3dff2b5698e9de\n<\/pre>\n<p>The source tree is <i>untouched<\/i> for each build.<\/p>\n<p><b>Q.<\/b>  Do you test the binaries before you upload them?<br \/>\n<b>A.<\/b>  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.<\/p>\n<p><b>Q.<\/b>  Are you releasing builds on a set schedule?<br \/>\n<b>A.<\/b>  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.<\/p>\n<p><b>Q.<\/b>  Where is everything installed?<br \/>\n<b>A.<\/b>  Everything gets put in <code>\/opt\/swift\/swift-3.0\/usr<\/code>.<\/p>\n<p><b>Q.<\/b>  How do I decipher the package version number?<br \/>\n<b>A.<\/b>  This was my first take on what I thought should be an appropriate package version number.  Breaking it down, <code>3.0-0ubuntu2~trusty1<\/code> should be:<\/p>\n<ul>\n<li>3.0 is the version of Swift that is packaged\n<li>-0ubuntu2 indicates that this is the 2nd package for Ubuntu, with the 0 indicating that there is no upstream Debian package upon which this package was based\n<li>~trusty1 indicates that this package is for Trusty Tahr\n<\/ul>\n<p>I <i>think<\/i> I got that right, but if you feel otherwise please do drop me a line at <code>admin@iachieved.it<\/code>.<\/p>\n<h2>How Does This Work?<\/h2>\n<p>I used <a href=\"http:\/\/xn.pinkhamster.net\/blog\/tech\/host-a-debian-repository-on-s3.html\">these awesome instructions<\/a> 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&#8217;m sure for hosting distribution repositories it&#8217;s all required, but for this it felt like overkill.  The folks that develop <a href=\"https:\/\/github.com\/jordansissel\/fpm\">fpm<\/a> also have some choice things to say about it.<\/p>\n<p>The packaging scripts we use to build everything and upload to the repository can be found <a href=\"\nhttps:\/\/github.com\/iachievedit\/package-swift\">Github<\/a>.  For Swift 3.0 make sure and look at the <code>swift-3.0<\/code> branch.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Editor&#8217;s Note: This post has been updated as of September 13, 2016 to reflect the official release of Swift 3.0. Swift 3.0 Swift 3.0 has officially been released as of September 13, 2016! apt-get Downloading a .tar.gz from Apple is nice. Using apt-get on an Ubuntu distribution is even better. To make it is easy [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":3108,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[62,53],"class_list":["post-2658","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-swift","tag-debian-swift-repository","tag-swift-repository"],"_links":{"self":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/2658"}],"collection":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/comments?post=2658"}],"version-history":[{"count":24,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/2658\/revisions"}],"predecessor-version":[{"id":3204,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/posts\/2658\/revisions\/3204"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media\/3108"}],"wp:attachment":[{"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/media?parent=2658"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/categories?post=2658"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.iachieved.it\/iachievedit\/wp-json\/wp\/v2\/tags?post=2658"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}