Skip to content

Commit 39f0b19

Browse files
michael-yujijakepetroules
authored andcommitted
fix freebsd build
1 parent 87af058 commit 39f0b19

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Package.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ let terminfoLibraries: [LinkerSetting] = {
2828
if !useTerminfo {
2929
return []
3030
}
31+
#if os(FreeBSD)
32+
return [.linkedLibrary("ncurses")]
33+
#else
3134
return [.linkedLibrary("ncurses", .when(platforms: [.linux, .macOS]))]
35+
#endif
3236
}()
3337

3438
let package = Package(
@@ -339,4 +343,19 @@ if let target = package.targets.first(where: { $0.name == "llbuildCore"}) {
339343
.unsafeFlags(["-L/usr/local/lib"])
340344
]
341345
}
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+
}
350+
package.targets.filter({ $0.name == "llbuildCore" || $0.name == "llbuildCoreTests" }).forEach {
351+
$0.cSettings = [.unsafeFlags(["-I/usr/local/include"])]
352+
$0.linkerSettings = [
353+
.linkedLibrary("sqlite3"),
354+
.unsafeFlags(["-L/usr/local/lib"])
355+
]
356+
357+
}
358+
package.targets.filter({ $0.name == "llbuild" || $0.name == "swift-build-tool" }).forEach {
359+
$0.linkerSettings = [.linkedLibrary("dl"), .linkedLibrary("pthread")]
360+
}
342361
#endif

lib/llvm/Support/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
6464
execinfo)
6565
endif()
6666

67-
if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux")
67+
if(${CMAKE_SYSTEM_NAME} MATCHES "Android|Darwin|Linux|FreeBSD")
6868
target_link_libraries(llvmSupport PRIVATE curses)
6969
endif()

utils/adjust-times/adjust-times.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#define UTIME_NOW ((1l << 30) - 1l)
1717
#define UTIME_OMIT ((1l << 30) - 2l)
1818
#else
19-
#if defined(__OpenBSD__)
19+
#if defined(__OpenBSD__) || defined(__FreeBSD__)
2020
#include <sys/types.h>
2121
#include <utime.h>
2222
#endif

0 commit comments

Comments
 (0)