Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix FreeBSD support
Checklist
Motivation:
To add FreeBSD support to Swift, we must ensure that swift crypto builds on FreeBSD since it's a dependency of swiftpm and several essential packages.
Modifications:
Package.swift
- Ideally FreeBSD should use.when(platforms:)
to set the corresponding swift settings and dependencies. However,Platform.freebsd
is not yet available on swiftpm and therefore use guard the settings behind aisFreeBSD
boolean flag. This is chosen because it minimize the diff and maintains the maximum readability.cmake/modules/SwiftSupport.cmake
- addamd64
arch support, maps tox86_64
.**/CMakeLists.txt
- Use the Linux assembly files for FreeBSD. Both Linux and FreeBSD uses SysV ABI, and there're no syscalls involved (after all, they're supposed to be "pure") so there are no ABI compatibility problem. After all, all the tests are passing on FreeBSD with this PR.Result:
All the tests (via
swift test
) passed on x86_64 FreeBSD 14.1-p6, and passed on aarch64 macOS.Test log available here: swift-test-result.txt