This topic has been on my mind lately given my recent[1] experiences[2] getting Swift going on Gentoo, primarily because the idiomatic Gentoo approach to packages presents effectively a worst-case scenario for bootstrapping Swift:
- It is strongly preferred that packages build from source (ideally on the machine they're going to run on), and cross-compilation wouldn't be a preferred solution;
- It is atypical (though possible!) for multiple versions of a package to be installable simultaneously, so
- It's quite uncommon of for a version of a package to depend on an earlier version of the same unless absolutely necessary
(Of course, Gentoo is... niche... and I wouldn't expect (nor suggest) that the Swift project at large consider it a meaningful use-case, but it is interesting to design with the potential of this in mind.)
I was initially concerned, but with a bit of thought, this seems pretty reasonably surmountable:
So long as there's a guarantee that Swift 5.10 can be relied upon to bootstrap future compilers, one possible path forward on the platform:
- Split the current
swift-5.10.1
package (which builds Swift 5.10.1, installs it into a versioned dir, and symlinks some binaries into/usr/bin
) intoswift-toolchain-5.10.1
(which just builds and installs) andswift-5.10.1
(which depends onswift-toolchain-5.10.1
, and just symlinks)- Since
swift-toolchain-<vers>
is standalone, I can slot it to allow multiplemajor.minor
versions to be installed simultaneously - Since
swift-<vers>
is not, it will continue to only allow one version at a time
- Since
- Future versions of
swift-<vers>
can then depend onswift-toolchain-5.10.1
andswift-toolchain-<vers>
Of course, these details are pretty Gentoo-specific so no need to pay too close attention, but this is at least a vote of confidence that any platform which the Swift 5.10 line can be updated to support can bootstrap itself without needing cross-compilation. (Which, again, is a sort of worst-case scenario for support.)
So, +1 from me. (Especially if we're comfortable marking Swift 5.10.x as a sort of LTS release, given the special nature of this change.)