@@ -16,6 +16,18 @@ func envEnable(_ key: String, default defaultValue: Bool = false) -> Bool {
1616 }
1717}
1818
19+ #if os(macOS)
20+ // NOTE: #if os(macOS) check is not accurate if we are cross compiling for Linux platform. So we add an env key to specify it.
21+ let buildForDarwinPlatform = envEnable ( " OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM " , default: true )
22+ #else
23+ let buildForDarwinPlatform = envEnable ( " OPENSWIFTUI_BUILD_FOR_DARWIN_PLATFORM " )
24+ #endif
25+
26+
27+ // https://github.com/SwiftPackageIndex/SwiftPackageIndex-Server/issues/3061#issuecomment-2118821061
28+ // By-pass https://github.com/swiftlang/swift-package-manager/issues/7580
29+ let isSPIDocGenerationBuild = envEnable ( " SPI_GENERATE_DOCS " , default: false )
30+
1931// MARK: - Env and Config
2032
2133let isXcodeEnv = Context . environment [ " __CFBundleIdentifier " ] == " com.apple.dt.Xcode "
@@ -44,11 +56,7 @@ var sharedSwiftSettings: [SwiftSetting] = [
4456
4557// MARK: - [env] OPENBOX_LIBRARY_EVOLUTION
4658
47- #if os(macOS)
48- let libraryEvolutionCondition = envEnable ( " OPENBOX_LIBRARY_EVOLUTION " , default: true )
49- #else
50- let libraryEvolutionCondition = envEnable ( " OPENBOX_LIBRARY_EVOLUTION " )
51- #endif
59+ let libraryEvolutionCondition = envEnable ( " OPENBOX_LIBRARY_EVOLUTION " , default: buildForDarwinPlatform)
5260
5361if libraryEvolutionCondition {
5462 // NOTE: -enable-library-evolution will cause module verify failure for `swift build`.
@@ -115,14 +123,10 @@ let package = Package(
115123 cxxLanguageStandard: . cxx20
116124)
117125
118-
119- #if os(macOS)
120- let renderBoxCondtion = envEnable ( " OPENBOX_RENDERBOX " , default: true )
121- #else
122- let renderBoxCondtion = envEnable ( " OPENBOX_RENDERBOX " )
123- #endif
124126let useLocalDeps = envEnable ( " OPENBOX_USE_LOCAL_DEPS " )
125127
128+ let renderBoxCondtion = envEnable ( " OPENBOX_RENDERBOX " , default: buildForDarwinPlatform && !isSPIDocGenerationBuild )
129+
126130if renderBoxCondtion {
127131 let privateFrameworkRepo : Package . Dependency
128132 if useLocalDeps {
0 commit comments