Skip to content

Commit 320e518

Browse files
authored
Merge pull request #853 from daveinglis/window_fixes
Fix building .S files on windows & resource bundles
2 parents 8aa8d1d + 643b268 commit 320e518

File tree

5 files changed

+8
-9
lines changed

5 files changed

+8
-9
lines changed

Sources/SWBCore/SpecImplementations/Tools/LinkerTools.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -740,16 +740,12 @@ public final class LdLinkerSpec : GenericLinkerSpec, SpecIdentifierType, @unchec
740740
}
741741
}
742742

743-
var environment: [(String, String)] = self.environmentFromSpec(cbc, delegate)
744-
// On Windows, some linker drivers require TMPDIR to be set.
745-
if cbc.producer.hostOperatingSystem == .windows {
746-
environment.append(("TMPDIR", cbc.scope.evaluate(BuiltinMacros.OBJROOT).str))
747-
}
748743
// Compute the inputs and outputs.
749744
var inputs: [any PlannedNode] = inputPaths.map{ delegate.createNode($0) }
750745

751746
await inputs.append(contentsOf: additionalInputDependencies(cbc, delegate, optionContext: discoveredCommandLineToolSpecInfo(cbc.producer, cbc.scope, delegate), lookup: lookup).map(delegate.createNode))
752747

748+
let environment: [(String, String)] = self.environmentFromSpec(cbc, delegate)
753749
// Add dependencies for any arguments indicating a file path.
754750
Self.addAdditionalDependenciesFromCommandLine(cbc, commandLine, EnvironmentBindings(environment), &inputs, &outputs, delegate)
755751

Sources/SWBCore/SpecImplementations/Tools/TouchTool.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ final class TouchToolSpec : CommandLineToolSpec, SpecIdentifierType, @unchecked
4242
delegate.error("Can't determine path to cmd.exe because the ComSpec environment variable is not set")
4343
return
4444
}
45-
// FIXME: Need to properly quote the path here, or generally handle this better
46-
commandLine = [commandShellPath, "/c", "copy /b \"\(input.absolutePath.str)\" +,,"]
45+
commandLine = [commandShellPath, "/c", "copy", "/b", input.absolutePath.str, "+,,"]
4746
} else {
4847
commandLine = ["/usr/bin/touch", "-c", input.absolutePath.str]
4948
}

Sources/SWBWindowsPlatform/Specs/WindowsCompile.xcspec

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
Type = Compiler;
1818
BasedOn = "default:com.apple.compilers.llvm.clang.1_0";
1919
EnvironmentVariables = {
20+
"TEMP" = "$(OBJROOT)";
21+
"TMP" = "$(OBJROOT)";
2022
};
2123
Name = "Apple LLVM Windows";
2224
Description = "Apple LLVM Windows compiler";

Sources/SWBWindowsPlatform/Specs/WindowsLd.xcspec

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
IsAbstract = Yes;
2222
SupportsInputFileList = No;
2323
EnvironmentVariables = {
24-
"TEMP" = "$(TEMP)";
24+
"TEMP" = "$(OBJROOT)";
25+
"TMP" = "$(OBJROOT)";
26+
"TMPDIR" = "$(OBJROOT)";
2527
"PATH" = "$(TOOLCHAIN_DIR)/usr/bin;$(DEVELOPER_DIR)/Runtimes/$(TOOLCHAIN_VERSION)/usr/bin;$(PATH)";
2628
};
2729
Options = (

Tests/SWBCoreTests/CommandLineSpecTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1720,7 +1720,7 @@ import SWBMacro
17201720
#expect(task.execDescription == "Touch input")
17211721
if core.hostOperatingSystem == .windows {
17221722
let commandShellPath = try #require(getEnvironmentVariable("ComSpec"), "Can't determine path to cmd.exe because the ComSpec environment variable is not set")
1723-
task.checkCommandLine([commandShellPath, "/c", "copy /b \"\(Path.root.join("tmp/input").str)\" +,,"])
1723+
task.checkCommandLine([commandShellPath, "/c", "copy", "/b", Path.root.join("tmp/input").str, "+,,"])
17241724
} else {
17251725
task.checkCommandLine(["/usr/bin/touch", "-c", Path.root.join("tmp/input").str])
17261726
}

0 commit comments

Comments
 (0)