From e2415cdf7e558dcbade5657f6e915cfed20a7614 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 17 Mar 2023 11:15:09 +0100 Subject: [PATCH 1/4] Add Makefile --- Makefile | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..80f79e5 --- /dev/null +++ b/Makefile @@ -0,0 +1,51 @@ +clean: + @# just delete specific directories instead of .builds so we don't + @# have to re-fetch dependencies + @rm -f .build/debug + @rm -rf .build/*-apple-macosx/ + @rm -rf .build/*-unknown-linux/ + @rm -rf .build/*-unknown-linux-gnu/ + +macos-5.5: clean + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode_13.2.1.app xcrun swift build + +macos-5.6: clean + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode_13.4.1.app xcrun swift build + +macos-5.7: clean + @echo + @echo === Building $@ === + env DEVELOPER_DIR=/Applications/Xcode_14.2.0.app xcrun swift build + +linux-5.5: clean + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.5-focal" swift build + +linux-5.6: clean + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.6-focal" swift build + +linux-5.7: clean + @echo + @echo === Building $@ === + docker run --rm -v "$(PWD)":/host -w /host "swift:5.7-focal" swift build + +linux: + linux-5.5 \ + linux-5.6 \ + linux-5.7 + +macos: + macos-5.5 \ + macos-5.6 \ + macos-5.7 + +all: + macos \ + linux From 02a807e5aa498109697f3a4a148347d66fcb994f Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 17 Mar 2023 11:28:45 +0100 Subject: [PATCH 2/4] Fix Makefile --- Makefile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 80f79e5..aac97ab 100644 --- a/Makefile +++ b/Makefile @@ -9,17 +9,17 @@ clean: macos-5.5: clean @echo @echo === Building $@ === - env DEVELOPER_DIR=/Applications/Xcode_13.2.1.app xcrun swift build + env DEVELOPER_DIR=/Applications/Xcode-13.2.1.app xcrun swift build macos-5.6: clean @echo @echo === Building $@ === - env DEVELOPER_DIR=/Applications/Xcode_13.4.1.app xcrun swift build + env DEVELOPER_DIR=/Applications/Xcode-13.4.1.app xcrun swift build macos-5.7: clean @echo @echo === Building $@ === - env DEVELOPER_DIR=/Applications/Xcode_14.2.0.app xcrun swift build + env DEVELOPER_DIR=/Applications/Xcode-14.2.0.app xcrun swift build linux-5.5: clean @echo @@ -36,16 +36,16 @@ linux-5.7: clean @echo === Building $@ === docker run --rm -v "$(PWD)":/host -w /host "swift:5.7-focal" swift build -linux: +linux: clean \ linux-5.5 \ linux-5.6 \ linux-5.7 -macos: +macos: clean \ macos-5.5 \ macos-5.6 \ macos-5.7 -all: +all: clean \ macos \ linux From e63a2a68d33a1932e5c1b0d30fbf7fbdb56539d0 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 17 Mar 2023 11:31:30 +0100 Subject: [PATCH 3/4] Update Makefile --- Makefile | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index aac97ab..818bf86 100644 --- a/Makefile +++ b/Makefile @@ -1,51 +1,43 @@ -clean: - @# just delete specific directories instead of .builds so we don't - @# have to re-fetch dependencies - @rm -f .build/debug - @rm -rf .build/*-apple-macosx/ - @rm -rf .build/*-unknown-linux/ - @rm -rf .build/*-unknown-linux-gnu/ - -macos-5.5: clean +macos-5.5: @echo @echo === Building $@ === env DEVELOPER_DIR=/Applications/Xcode-13.2.1.app xcrun swift build -macos-5.6: clean +macos-5.6: @echo @echo === Building $@ === env DEVELOPER_DIR=/Applications/Xcode-13.4.1.app xcrun swift build -macos-5.7: clean +macos-5.7: @echo @echo === Building $@ === env DEVELOPER_DIR=/Applications/Xcode-14.2.0.app xcrun swift build -linux-5.5: clean +linux-5.5: @echo @echo === Building $@ === docker run --rm -v "$(PWD)":/host -w /host "swift:5.5-focal" swift build -linux-5.6: clean +linux-5.6: @echo @echo === Building $@ === docker run --rm -v "$(PWD)":/host -w /host "swift:5.6-focal" swift build -linux-5.7: clean +linux-5.7: @echo @echo === Building $@ === docker run --rm -v "$(PWD)":/host -w /host "swift:5.7-focal" swift build -linux: clean \ +linux: \ linux-5.5 \ linux-5.6 \ linux-5.7 -macos: clean \ +macos: \ macos-5.5 \ macos-5.6 \ macos-5.7 -all: clean \ +all: \ macos \ linux From c1a6d83f613a883b39a7904c85fcfc632552bfa6 Mon Sep 17 00:00:00 2001 From: "Sven A. Schmidt" Date: Fri, 17 Mar 2023 11:31:38 +0100 Subject: [PATCH 4/4] Fix Linux warnings --- Sources/ShellOut.swift | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Sources/ShellOut.swift b/Sources/ShellOut.swift index d4e76a5..c2b957c 100644 --- a/Sources/ShellOut.swift +++ b/Sources/ShellOut.swift @@ -398,7 +398,11 @@ extension ShellOutCommand { private extension Process { @discardableResult func launchBash(with command: String, outputHandle: FileHandle? = nil, errorHandle: FileHandle? = nil, environment: [String : String]? = nil) throws -> String { +#if os(Linux) + executableURL = URL(fileURLWithPath: "/bin/bash") +#else launchPath = "/bin/bash" +#endif arguments = ["-c", command] if let environment = environment { @@ -438,7 +442,11 @@ private extension Process { } #endif +#if os(Linux) + try run() +#else launch() +#endif #if os(Linux) outputQueue.sync {