Enable static linking on Linux
- Commit
a582303bcfad2341a15aa8f0a29f3dcf7051ac7b- Author
- Kabir Oberai <[email protected]>
- When
- 2022-07-24 21:39 UTC (4 years ago)
- Parents
7a81f90
Diff
Supersign/Package.swift
diff --git a/Supersign/Package.swift b/Supersign/Package.swiftindex 1f2c9c7..f8e4252 100644--- a/Supersign/Package.swift+++ b/Supersign/Package.swift@@ -8,6 +8,16 @@ let cSettings: [CSetting] = [ .headerSearchPath("../../vendored/include", .when(platforms: [.macOS, .iOS])), ] +extension Product.Library.LibraryType {+ static var smart: Self {+ #if os(Linux)+ return .static+ #else+ return .dynamic+ #endif+ }+}+ let package = Package( name: "Supersign", platforms: [@@ -17,7 +27,7 @@ let package = Package( products: [ .library( name: "Supersign",- type: .dynamic,+ type: .smart, targets: ["Supersign"] ), ],
SupersignCLISupport/Sources/SupersignCLI/main.swift
diff --git a/SupersignCLISupport/Sources/SupersignCLI/main.swift b/SupersignCLISupport/Sources/SupersignCLI/main.swiftindex 093147e..3444031 100644--- a/SupersignCLISupport/Sources/SupersignCLI/main.swift+++ b/SupersignCLISupport/Sources/SupersignCLI/main.swift@@ -2,13 +2,13 @@ import Foundation import Supersign import SupersignCLISupport -let moduleBundle: Bundle-#if swift(>=5.5) || os(macOS)+let moduleBundle: Bundle?+#if os(macOS) moduleBundle = Bundle.module #else-moduleBundle = Bundle(url: Bundle.main.url(forResource: "SupersignCLISupport_SupersignCLI", withExtension: "resources")!)!+moduleBundle = Bundle.main.url(forResource: "SupersignCLISupport_SupersignCLI", withExtension: "resources").flatMap(Bundle.init(url:)) #endif-let app = moduleBundle.url(forResource: "Supercharge", withExtension: "ipa")!+let app = moduleBundle?.url(forResource: "Supercharge", withExtension: "ipa")! #warning("Improve persistence on Windows/Linux")
SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift
diff --git a/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift b/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swiftindex b1150a9..937c1ea 100644--- a/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift+++ b/SupersignCLISupport/Sources/SupersignCLISupport/SuperchargeCommand.swift@@ -12,6 +12,10 @@ struct InstallSuperchargeCommand: ParsableCommand { @Option(name: .shortAndLong) var account: String? func run() throws {+ guard let app = SupersignCLI.config.superchargeApp else {+ throw Console.Error("This copy of Supersign is not configured to install Supercharge.")+ }+ let username: String let credentials: IntegratedInstaller.Credentials @@ -66,7 +70,7 @@ struct InstallSuperchargeCommand: ParsableCommand { storage: SupersignCLI.config.storage, delegate: installDelegate )- installer.install(app: SupersignCLI.config.superchargeApp)+ installer.install(app: app) semaphore.wait() _ = installer }
SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift
diff --git a/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift b/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swiftindex 207d2a0..3fbf696 100644--- a/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift+++ b/SupersignCLISupport/Sources/SupersignCLISupport/SupersignCommand.swift@@ -4,11 +4,11 @@ import ArgumentParser public enum SupersignCLI { public struct Configuration {- public let superchargeApp: URL+ public let superchargeApp: URL? public let storage: KeyValueStorage public init(- superchargeApp: URL,+ superchargeApp: URL?, storage: KeyValueStorage ) { self.superchargeApp = superchargeApp