Skip to content

Commit

Permalink
Support compiling against Musl (#3188)
Browse files Browse the repository at this point in the history
Vapor already makes some provision for compiling against Musl in the
RFC1123 implementation, where `Glibc` is not assumed and is imported
conditionally alongside a conditional import of `Musl`. However, there
are a couple of other places where `Glibc` is still assumed when
compiling for Linux.

This patch replaces these imports with the same `#if canImport(...)`
pattern.

Co-authored-by: Tim Condon <0xTim@users.noreply.github.com>
  • Loading branch information
simonjbeaumont and 0xTim committed May 12, 2024
1 parent 8353aed commit d9fa0d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Sources/Vapor/Utilities/DirectoryConfiguration.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#else
import Darwin.C
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/Vapor/Utilities/DotEnv.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#if os(Linux)
#if canImport(Glibc)
import Glibc
#elseif canImport(Musl)
import Musl
#else
import Darwin
#endif
Expand Down

0 comments on commit d9fa0d3

Please sign in to comment.