Skip to content

Commit ac3ac9e

Browse files
committed
Fix building .S files on windows & resource bundles
- building .S files on windows requires clang to have TMP/TEMP env passed (also move the linker change that added TMPDIR to the tool env to the spec file for consistency). - fix the resource bundle error that when touching a file was passing a badly quoted path.
1 parent 821fb53 commit ac3ac9e

File tree

4 files changed

+7
-8
lines changed

4 files changed

+7
-8
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+
var 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 = (

0 commit comments

Comments
 (0)