-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix building and testing on FreeBSD; Add FreeBSD platform support #8193
base: main
Are you sure you want to change the base?
Conversation
@swift-ci test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Just one thing: wanted to prime some discussion on the name of the pkg
enum case and see if we might want to do anything differently there.
@@ -16,11 +16,12 @@ public enum SystemPackageProviderDescription: Hashable, Codable, Sendable { | |||
case apt([String]) | |||
case yum([String]) | |||
case nuget([String]) | |||
case pkg([String]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is FreeBSD's pkg
sufficiently "branded" to call it this? OpenBSD's package manager is named quite similarly, and while it doesn't seem to have a formal name, all of its commands begin with pkg_
. pkg
also isn't a particularly searchable term.
pkg
might still be the right choice, but I just want to make sure we're doing the thought exercise of considering the best name in the context of all the largest 4 BSDs (FreeBSD, OpenBSD, NetBSD, and DragonflyBSD) and what would be least confusing, even if we're not adding those others right now.
Here's some of my thoughts:
- NetBSD's
pkgsrc
is not exclusive to NetBSD, and has its own website / identity / branding. So I think an enum namedpkgsrc
would make sense there. - OpenBSD's package system doesn't have a name. Call the enum
openbsd_pkg
? - FreeBSD's package system doesn't have a name, and DragonflyBSD's package management software (as far as I can tell) is a fork of FreeBSD's (as is the OS generally). Two enums
freebsd_pkg
anddragonflybsd_pkg
? Or a single enumpkg
that applies to both FreeBSD and DragonflyBSD? That might be a bad idea though, as they are different OSes which may have diverged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also in my mind, originally I name this pkgng
, but pkgng
renamed to pkg
quite a while ago. https://wiki.freebsd.org/pkg. DragonflyBSD is using the same pkg
from FreeBSD https://github.com/DragonFlyBSD/DPorts/blob/master/ports-mgmt/pkg/Makefile.
I'm not sure about OpenBSD tho, and currently the SystemPackageProviderDescription
enum does not include one for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, might be worth starting a Swift evolution thread on the naming. In the meantime you could land this behind an API availability of 999.0
@@ -201,7 +201,7 @@ let package = Package( | |||
name: "Basics", | |||
dependencies: [ | |||
"_AsyncFileSystem", | |||
.target(name: "SPMSQLite3", condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .visionOS, .macCatalyst, .linux])), | |||
.target(name: "SPMSQLite3", condition: .when(platforms: [.macOS, .iOS, .tvOS, .watchOS, .visionOS, .macCatalyst, .linux, .custom("freebsd")])), | |||
.product(name: "SwiftToolchainCSQLite", package: "swift-toolchain-sqlite", condition: .when(platforms: [.windows, .android])), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to see this port moving forward. 🥲
Have you tried using this SQLite package instead? The only reason most OSs above don't is that this is new: I switched my upcoming native 6.1 toolchain for Android over to using it and was able to remove the external libsqlite package dependency of this Swift toolchain as a result. I suggest you try the same, will require patching llbuild also.
Fix building and testing on FreeBSD and add support for "FreeBSD" platform
Motivation:
Adding support for "FreeBSD" is swiftpm is necessary to get a usable toolchain building on FreeBSD.
Modifications:
Archiver
On FreeBSD, the
unzip
command is available in base but not thezip
command. Therefore; we use libarchive (viabsdtar
) to produce ZIP archive instead.The implementation is also based on
libarchive
which produces different error messages; Tests are updated accordinglycompile / link arguments
FreeBSD ships with libc++ by default hence should use
-lc++
. Like Linux,defsym
is also required to link targets with_main
symbol.FreeBSD native package manager (
pkgng
) support:FreeBSD uses
pkgng
as its package manager,Result:
Should be able to build swiftpm on FreeBSD. Testing on
x86_64 FreeBSD 14.2 RELEASE