From 4a22e0e725733d52f76ae692b6115ba89d302afe Mon Sep 17 00:00:00 2001 From: Butta Date: Mon, 20 Feb 2023 21:47:07 +0530 Subject: [PATCH] Add back -no-toolchain-stdlib-rpath when installing sourcekit-lsp on linux Pull #597 incorrectly removed this, as it's still needed on ELF platforms. --- Package.swift | 15 ++++++++++++--- Utilities/build-script-helper.py | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Package.swift b/Package.swift index 19e5307e9..846bfb513 100644 --- a/Package.swift +++ b/Package.swift @@ -1,6 +1,16 @@ // swift-tools-version:5.5 import PackageDescription +import Foundation + +// When building the toolchain on the CI, don't add the CI's runpath for the +// final build before installing. +let sourcekitLSPLinkSettings : [LinkerSetting] +if ProcessInfo.processInfo.environment["SOURCEKIT_LSP_CI_INSTALL"] != nil { + sourcekitLSPLinkSettings = [ .unsafeFlags(["-no-toolchain-stdlib-rpath"], .when(platforms: [.linux, .android])) ] +} else { + sourcekitLSPLinkSettings = [] +} let package = Package( name: "SourceKitLSP", @@ -36,7 +46,8 @@ let package = Package( .product(name: "ArgumentParser", package: "swift-argument-parser"), .product(name: "SwiftToolsSupport-auto", package: "swift-tools-support-core"), ], - exclude: ["CMakeLists.txt"]), + exclude: ["CMakeLists.txt"], + linkerSettings: sourcekitLSPLinkSettings), .target( name: "SourceKitLSP", @@ -235,8 +246,6 @@ let package = Package( // by the external environment. This allows sourcekit-lsp to take advantage of the automation used // for building the swift toolchain, such as `update-checkout`, or cross-repo PR tests. -import Foundation - if ProcessInfo.processInfo.environment["SWIFTCI_USE_LOCAL_DEPS"] == nil { // Building standalone. package.dependencies += [ diff --git a/Utilities/build-script-helper.py b/Utilities/build-script-helper.py index 17ad9e30b..bd31bec63 100755 --- a/Utilities/build-script-helper.py +++ b/Utilities/build-script-helper.py @@ -188,6 +188,8 @@ def build_single_product(product: str, swift_exec: str, args: argparse.Namespace """ swiftpm_args = get_swiftpm_options(swift_exec, args) additional_env = get_swiftpm_environment_variables(swift_exec, args) + if args.action == 'install': + additional_env['SOURCEKIT_LSP_CI_INSTALL'] = "1" cmd = [swift_exec, 'build', '--product', product] + swiftpm_args check_call(cmd, additional_env=additional_env, verbose=args.verbose)