How to install Swift once it's built?

It's not well-documented, but adding --install-destdir will do what you want. The README notes that you can learn a lot by running utils/build-script -h, it's listed in there. You may need to patch the install a bit based on your distro layout and installed packages though, as the Fedora packager had to.

Alternately, the --install-swiftpm flag will have already put everything in a build/Ninja-Release/toolchain-linux-x86_64 directory, from which you can just manually copy all non-conflicting files to /usr.

It isn't an easy process yet, given that Swift builds its own clang that could conflict with an installed clang, so you're probably best off using the Swift toolchain you built from your home directory, by adding that toolchain folder to your path.

1 Like