Skip to content

Commit 623cb17

Browse files
committed
Clean up rpaths of installed swift-format
- Don’t explicitly add rpaths to `/usr/lib/swift`, `@executable_path/../lib/swift/macosx` and `@executable_path/../lib/swift-5.5/macosx` on Darwin. I don’t know what they were needed for but they don’t seem to be necessary. Also standard Swift command line tools created from Xcode don’t contain these rpaths. - Increase the deployment target to macOS 12.0. This removes an rpath in the built binary that is an absolute path to the toolchain on the host, which was used to build swift-format. - Set `--disable-local-rpath` on Linux. Otherwise the swift-format executable has an `$ORIGIN` rpath on Linux, which we don’t want. - Rename `SOURCEKIT_LSP_CI_INSTALL` -> `SWIFTFORMAT_CI_INSTALL`. Just cleaning up after copy-pasting. rdar://121400644
1 parent b9cb53f commit 623cb17

File tree

2 files changed

+6
-24
lines changed

2 files changed

+6
-24
lines changed

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import PackageDescription
1717
let package = Package(
1818
name: "swift-format",
1919
platforms: [
20-
.iOS("13.0"),
21-
.macOS("10.15")
20+
.macOS("12.0"),
21+
.iOS("13.0")
2222
],
2323
products: [
2424
.executable(
@@ -144,7 +144,7 @@ func hasEnvironmentVariable(_ name: String) -> Bool {
144144

145145
// When building the toolchain on the CI, don't add the CI's runpath for the
146146
// final build before installing.
147-
var installAction: Bool { hasEnvironmentVariable("SOURCEKIT_LSP_CI_INSTALL") }
147+
var installAction: Bool { hasEnvironmentVariable("SWIFTFORMAT_CI_INSTALL") }
148148

149149
/// Assume that all the package dependencies are checked out next to sourcekit-lsp and use that instead of fetching a
150150
/// remote dependency.

build-script-helper.py

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -110,33 +110,15 @@ def get_swiftpm_options(
110110
swift_exec, cross_compile_config=cross_compile_config
111111
)
112112
build_os = build_target.split("-")[2]
113-
if build_os.startswith("macosx"):
114-
args += [
115-
"-Xlinker",
116-
"-rpath",
117-
"-Xlinker",
118-
"/usr/lib/swift",
119-
]
120-
args += [
121-
"-Xlinker",
122-
"-rpath",
123-
"-Xlinker",
124-
"@executable_path/../lib/swift/macosx",
125-
]
126-
args += [
127-
"-Xlinker",
128-
"-rpath",
129-
"-Xlinker",
130-
"@executable_path/../lib/swift-5.5/macosx",
131-
]
132-
else:
113+
if not build_os.startswith("macosx"):
133114
# Library rpath for swift, dispatch, Foundation, etc. when installing
134115
args += [
135116
"-Xlinker",
136117
"-rpath",
137118
"-Xlinker",
138119
"$ORIGIN/../lib/swift/" + build_os,
139120
]
121+
args += ['--disable-local-rpath']
140122

141123
if cross_compile_host:
142124
if build_os.startswith("macosx") and cross_compile_host.startswith("macosx-"):
@@ -151,7 +133,7 @@ def get_swiftpm_environment_variables(action: str):
151133
env = dict(os.environ)
152134
env["SWIFTCI_USE_LOCAL_DEPS"] = "1"
153135
if action == "install":
154-
env["SOURCEKIT_LSP_CI_INSTALL"] = "1"
136+
env["SWIFTFORMAT_CI_INSTALL"] = "1"
155137
return env
156138

157139

0 commit comments

Comments
 (0)