Installing and Packaging Swift


I've been thinking a lot about the experience building and installing
Swift from source and being able to package Swift (such as providing
packages in systems such as emerge, pacman, rpm, apt-get, homebrew,
etc). As it is, the current process of building and installing Swift
from source isn't simple or clearly documented and I think there is some
changes we can do to make it easier for both users to build Swift and
for package maintainers to package Swift.

It doesn't seem like there is a great adoption for package maintainers
providing Swift packages and this could be attributed to it being
difficult and not clear. One of the goals of this proposal should be to
increase adoption and availability of Swift on various platforms.

I'd like to start a discussion on how we can improve this situation as a
first step for a Swift Evolution proposal on improving the packaging and
installation of Swift. I'll first give a quick run through of the
current process and then later go on with how I think we can improve the

Current Process



The current process of building and installing Swift from source isn't
very clear, the download page at - Download Swift doesn't
include downloading the source, only binaries for a limited amount of

You can find a source code page at - Source Code which
explains the multiple repositories Swift components are distributed
across, this page will link you to the Swift repositories README for
instructions on building Swift.

The README instructions are tied to specific platforms (Ubuntu and
macOS) and do not clearly list the dependencies. These development
dependencies do not list dependencies that are already pre-installed on
the given platforms such as perl. This can make it cumbersome to figure
out what is required on other platforms.

To build Swift, you will need to clone various repositories via git.
There is a script to aid cloning the various repositories and checkout
out the relevant tag based on the release you are trying to install. You
need to clone the entire history of Swift to be able to build it, this
will consume a lot of bandwidth and disk space. Cloning the various git
repositories will often make it difficult to integrate into package

When it comes to building Swift, this can be problematic if you have
missed installing some of the dependencies since there isn't a way to
verify you have everything Swift needs upfront. You can try to build
Swift, but it may fail after a while with an obscure error which isn't
clear that you missed a dependency.

There is no clear instructions on how you can install the version of
Swift you have built on your system.


I think Swift should provide a complete tarball including all of the
Swift sources. A user installing Swift should not have to clone the
entire Swift history and instead download a tarball that contains
everything they need for a specific version. The tarball should be aimed
at users who want to build and install Swift but do not want to develop

The tarball should contain a script (probably similar to a "configure"
script) which can validate the user has all the needed dependencies.

There should be a consist method to build and then install Swift and the
standard library. I think it may be beneficial if these are steps
consistent with other tools and libraries.

Documentation and links to each version tarball should be available on
the Swift website along with detailed list of all the required
build-time and run-time dependencies and supported versions.

1 Like

Once I figure out an answer to this question then I will be happy to PR some better documentation into the