Skip to content

Commit a054c30

Browse files
committed
Update OpenBSD support for swiftpm.
Some of this ends up being in common with the FreeBSD stanza, so lightly refactor.
1 parent 55c358a commit a054c30

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

Package.swift

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let terminfoLibraries: [LinkerSetting] = {
2828
if !useTerminfo {
2929
return []
3030
}
31-
#if os(FreeBSD)
31+
#if os(FreeBSD) || os(OpenBSD)
3232
return [.linkedLibrary("ncurses")]
3333
#else
3434
return [.linkedLibrary("ncurses", .when(platforms: [.linux, .macOS]))]
@@ -335,18 +335,7 @@ package.targets.first { $0.name == "llbuildBasic" }?.linkerSettings = [
335335
// FIXME: when the SupportedPlatforms availability directive is updated and
336336
// the platform port is in sync with this directive, these conditions can
337337
// be folded up with .when(platforms:_) clauses.
338-
#if os(OpenBSD)
339-
if let target = package.targets.first(where: { $0.name == "llbuildCore"}) {
340-
target.cSettings = [.unsafeFlags(["-I/usr/local/include"])]
341-
target.linkerSettings = [
342-
.linkedLibrary("sqlite3"),
343-
.unsafeFlags(["-L/usr/local/lib"])
344-
]
345-
}
346-
#elseif os(FreeBSD)
347-
if let target = package.targets.first(where: { $0.name == "llvmSupport" }) {
348-
target.linkerSettings = ["execinfo", "m", "pthread", "ncurses"].map { .linkedLibrary($0) }
349-
}
338+
#if os(FreeBSD) || os(OpenBSD)
350339
package.targets.filter({ $0.name == "llbuildCore" || $0.name == "llbuildCoreTests" }).forEach {
351340
$0.cSettings = [.unsafeFlags(["-I/usr/local/include"])]
352341
$0.linkerSettings = [
@@ -355,6 +344,15 @@ package.targets.filter({ $0.name == "llbuildCore" || $0.name == "llbuildCoreTest
355344
]
356345

357346
}
347+
#endif
348+
#if os(OpenBSD)
349+
if let target = package.targets.first(where: { $0.name == "llvmSupport" }) {
350+
target.linkerSettings = ["execinfo", "ncurses"].map { .linkedLibrary($0) }
351+
}
352+
#elseif os(FreeBSD)
353+
if let target = package.targets.first(where: { $0.name == "llvmSupport" }) {
354+
target.linkerSettings = ["execinfo", "m", "pthread", "ncurses"].map { .linkedLibrary($0) }
355+
}
358356
package.targets.filter({ $0.name == "llbuild" || $0.name == "swift-build-tool" }).forEach {
359357
$0.linkerSettings = [.linkedLibrary("dl"), .linkedLibrary("pthread")]
360358
}

0 commit comments

Comments
 (0)