Skip to content

Commit ec6b1d8

Browse files
authored
Merge pull request swiftlang#720 from buttaface/rpath
[5.8] Add back -no-toolchain-stdlib-rpath when installing sourcekit-lsp on linux
2 parents 99bae51 + 21a7d96 commit ec6b1d8

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

Package.swift

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
// swift-tools-version:5.3
22

33
import PackageDescription
4+
import Foundation
5+
6+
// When building the toolchain on the CI, don't add the CI's runpath for the
7+
// final build before installing.
8+
let sourcekitLSPLinkSettings : [LinkerSetting]
9+
if ProcessInfo.processInfo.environment["SOURCEKIT_LSP_CI_INSTALL"] != nil {
10+
sourcekitLSPLinkSettings = [ .unsafeFlags(["-no-toolchain-stdlib-rpath"], .when(platforms: [.linux, .android])) ]
11+
} else {
12+
sourcekitLSPLinkSettings = []
13+
}
414

515
let package = Package(
616
name: "SourceKitLSP",
@@ -36,7 +46,8 @@ let package = Package(
3646
.product(name: "ArgumentParser", package: "swift-argument-parser"),
3747
.product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"),
3848
],
39-
exclude: ["CMakeLists.txt"]),
49+
exclude: ["CMakeLists.txt"],
50+
linkerSettings: sourcekitLSPLinkSettings),
4051

4152
.target(
4253
name: "SourceKitLSP",
@@ -236,8 +247,6 @@ let package = Package(
236247
// by the external environment. This allows sourcekit-lsp to take advantage of the automation used
237248
// for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests.
238249

239-
import Foundation
240-
241250
if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil {
242251
// Building standalone.
243252
package.dependencies += [

Utilities/build-script-helper.py

+2
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ def build_single_product(product: str, swift_exec: str, args: argparse.Namespace
188188
"""
189189
swiftpm_args = get_swiftpm_options(swift_exec, args)
190190
additional_env = get_swiftpm_environment_variables(swift_exec, args)
191+
if args.action == 'install':
192+
additional_env['SOURCEKIT_LSP_CI_INSTALL'] = "1"
191193
cmd = [swift_exec, 'build', '--product', product] + swiftpm_args
192194
check_call(cmd, additional_env=additional_env, verbose=args.verbose)
193195

0 commit comments

Comments
 (0)