From e97a6fcb1ab07462881ac165fdbb37f067e205d5 Mon Sep 17 00:00:00 2001 From: Alastair Houghton Date: Thu, 7 Dec 2023 18:42:43 +0000 Subject: [PATCH] Changes to build with Musl. (#283) Added imports of Musl in a few places. Also added definitions for `systemStderr` and `systemStdout`. --- Sources/Logging/Locks.swift | 2 ++ Sources/Logging/Logging.swift | 5 +++++ Sources/Logging/MetadataProvider.swift | 2 ++ 3 files changed, 9 insertions(+) diff --git a/Sources/Logging/Locks.swift b/Sources/Logging/Locks.swift index 1919e4d8..59a76552 100644 --- a/Sources/Logging/Locks.swift +++ b/Sources/Logging/Locks.swift @@ -34,6 +34,8 @@ import Darwin import WinSDK #elseif canImport(Glibc) import Glibc +#elseif canImport(Musl) +import Musl #else #error("Unsupported runtime") #endif diff --git a/Sources/Logging/Logging.swift b/Sources/Logging/Logging.swift index 23ef1ab0..8bcf243d 100644 --- a/Sources/Logging/Logging.swift +++ b/Sources/Logging/Logging.swift @@ -18,6 +18,8 @@ import Darwin import CRT #elseif canImport(Glibc) import Glibc +#elseif canImport(Musl) +import Musl #elseif canImport(WASILibc) import WASILibc #else @@ -1251,6 +1253,9 @@ let systemStdout = CRT.stdout #elseif canImport(Glibc) let systemStderr = Glibc.stderr! let systemStdout = Glibc.stdout! +#elseif canImport(Musl) +let systemStderr = Musl.stderr! +let systemStdout = Musl.stdout! #elseif canImport(WASILibc) let systemStderr = WASILibc.stderr! let systemStdout = WASILibc.stdout! diff --git a/Sources/Logging/MetadataProvider.swift b/Sources/Logging/MetadataProvider.swift index 3bff6691..62d9ad89 100644 --- a/Sources/Logging/MetadataProvider.swift +++ b/Sources/Logging/MetadataProvider.swift @@ -18,6 +18,8 @@ import Darwin import CRT #elseif canImport(Glibc) import Glibc +#elseif canImport(Musl) +import Musl #elseif canImport(WASILibc) import WASILibc #else