Skip to content

Commit 695eddb

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 4d634f2 commit 695eddb

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
@@ -22,7 +22,7 @@ func hasEnvironmentVariable(_ name: String) -> Bool {
2222

2323
// When building the toolchain on the CI, don't add the CI's runpath for the
2424
// final build before installing.
25-
let installAction = hasEnvironmentVariable("SOURCEKIT_LSP_CI_INSTALL")
25+
let installAction = hasEnvironmentVariable("SWIFTFORMAT_CI_INSTALL")
2626

2727

2828
// MARK: - Compute custom build settings
@@ -35,8 +35,8 @@ if installAction {
3535
let package = Package(
3636
name: "swift-format",
3737
platforms: [
38-
.iOS("13.0"),
39-
.macOS("10.15")
38+
.macOS("12.0"),
39+
.iOS("13.0")
4040
],
4141
products: [
4242
.executable(

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)