From 8697d34340b70571b361de3fdf74d700ed062558 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 18 Oct 2023 17:05:03 +0200 Subject: [PATCH 1/4] Add `Foundation` and `Dispatch` to linux --- ...-linux-compilation-with-swift-parser.patch | 52 ------------------- swift-build-presets | 4 ++ 2 files changed, 4 insertions(+), 52 deletions(-) delete mode 100644 patches/swift/fix-linux-compilation-with-swift-parser.patch diff --git a/patches/swift/fix-linux-compilation-with-swift-parser.patch b/patches/swift/fix-linux-compilation-with-swift-parser.patch deleted file mode 100644 index d6a960c..0000000 --- a/patches/swift/fix-linux-compilation-with-swift-parser.patch +++ /dev/null @@ -1,52 +0,0 @@ -diff --git a/cmake/modules/AddSwift.cmake b/cmake/modules/AddSwift.cmake -index 58c7eb1bd4f..4f4d5b7edea 100644 ---- a/cmake/modules/AddSwift.cmake -+++ b/cmake/modules/AddSwift.cmake -@@ -912,17 +912,22 @@ function(add_swift_host_tool executable) - endif() - - if(SWIFT_SWIFT_PARSER) -- set(extra_relative_rpath "") -- if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "") -- if (${executable} MATCHES "-bootstrapping") -- set(extra_relative_rpath "../") -+ if (SWIFT_HOST_VARIANT_SDK STREQUAL LINUX) -+ if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "" AND ${executable} MATCHES "-bootstrapping") -+ set_property(TARGET ${executable} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../lib/swift/host") -+ else() -+ set_property(TARGET ${executable} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../lib/swift/host") -+ endif() -+ else() -+ set(extra_relative_rpath "") -+ if(NOT ${ASHT_BOOTSTRAPPING} STREQUAL "" AND ${executable} MATCHES "-bootstrapping") -+ set(extra_relative_rpath "../") - endif() -+ set_property( -+ TARGET ${executable} -+ APPEND PROPERTY INSTALL_RPATH -+ "@executable_path/../${extra_relative_rpath}lib/swift/host") - endif() -- -- set_property( -- TARGET ${executable} -- APPEND PROPERTY INSTALL_RPATH -- "@executable_path/../${extra_relative_rpath}lib/swift/host") - endif() - - if(ASHT_THINLTO_LD64_ADD_FLTO_CODEGEN_ONLY) -diff --git a/lib/ASTGen/CMakeLists.txt b/lib/ASTGen/CMakeLists.txt -index c7334a6da0b..2a0cb80b743 100644 ---- a/lib/ASTGen/CMakeLists.txt -+++ b/lib/ASTGen/CMakeLists.txt -@@ -1,4 +1,11 @@ - if (SWIFT_SWIFT_PARSER) -+ if (SWIFT_HOST_VARIANT_SDK STREQUAL "LINUX") -+ # including libdispatch leads to multiple module definition problems, as it seems -+ # it is already available to the swift toolchain -+ get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) -+ list(REMOVE_ITEM dirs "${SWIFT_PATH_TO_LIBDISPATCH_SOURCE}") -+ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES "${dirs}") -+ endif() - # Ensure that we do not link the _StringProcessing module. But we can - # only pass this flag for new-enough compilers that support it. - file(WRITE "${CMAKE_BINARY_DIR}/tmp/empty-check-string-processing.swift" "") diff --git a/swift-build-presets b/swift-build-presets index 6393dd2..22d90ff 100644 --- a/swift-build-presets +++ b/swift-build-presets @@ -36,6 +36,10 @@ build-subdir=codeql [preset: codeql-Linux] mixin-preset=codeql-release bootstrapping=hosttools +foundation +libdispatch +install-foundation +install-libdispatch [preset: codeql-macOS] mixin-preset=codeql-release From f5be62f5c4cafec04ca5ffbe62f0e82187011218 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Tue, 24 Oct 2023 15:50:53 +0200 Subject: [PATCH 2/4] Add swiftpm to linux toolchain --- swift-build-presets | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swift-build-presets b/swift-build-presets index 22d90ff..cc6a6b8 100644 --- a/swift-build-presets +++ b/swift-build-presets @@ -38,8 +38,10 @@ mixin-preset=codeql-release bootstrapping=hosttools foundation libdispatch +swiftpm install-foundation install-libdispatch +install-swiftpm [preset: codeql-macOS] mixin-preset=codeql-release From 15300490179c981d0f9c45dbe2d1aa7dcfc97f76 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 25 Oct 2023 11:09:57 +0200 Subject: [PATCH 3/4] Add clang to installation --- swift-build-presets | 3 +++ 1 file changed, 3 insertions(+) diff --git a/swift-build-presets b/swift-build-presets index cc6a6b8..6d816a2 100644 --- a/swift-build-presets +++ b/swift-build-presets @@ -42,6 +42,9 @@ swiftpm install-foundation install-libdispatch install-swiftpm +llvm-install-components=clang;clang-resource-headers;compiler-rt +install-llvm +xctest [preset: codeql-macOS] mixin-preset=codeql-release From 8b7b2b31a56c123f37f3bb2eb99aec2fde3ced37 Mon Sep 17 00:00:00 2001 From: Paolo Tranquilli Date: Wed, 25 Oct 2023 15:06:08 +0200 Subject: [PATCH 4/4] Pull in most of the upstream Linux preset --- swift-build-presets | 125 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 117 insertions(+), 8 deletions(-) diff --git a/swift-build-presets b/swift-build-presets index 6d816a2..9b7e23a 100644 --- a/swift-build-presets +++ b/swift-build-presets @@ -33,18 +33,127 @@ mixin-preset=codeql-baseline release build-subdir=codeql -[preset: codeql-Linux] -mixin-preset=codeql-release -bootstrapping=hosttools +#===------------------------------------------------------------------------===# +# Linux Builders +#===------------------------------------------------------------------------===# +[preset: mixin_linux_install_components_with_clang] + +swift-install-components=autolink-driver;compiler;stdlib +llvm-install-components=clang;clang-resource-headers;compiler-rt;clang-features-file + +[preset: mixin_linux_installation] +mixin-preset= + mixin_linux_install_components_with_clang + +llbuild +swiftpm +swift-driver +xctest +libicu +# swiftdocc + +# build-ninja +install-llvm +install-swift +# install-lldb +# install-llbuild +install-swiftpm +install-swift-driver +install-swiftsyntax +install-xctest +install-libicu +install-prefix=/usr +install-sourcekit-lsp +# install-swiftformat +# install-swiftdocc +# build-swift-static-stdlib +# build-swift-static-sdk-overlay +# build-swift-stdlib-unittest-extra + +# Executes the lit tests for the installable package that is created +# Assumes the swift-integration-tests repo is checked out + +# test-installable-package + +# Build the benchmarks against the toolchain. +# toolchain-benchmarks + +# This ensures the default module cache +# location is local to this run, allowing +# to schedule multiple builds safely +# in Linux CI bots +# relocate-xdg-cache-home-under-build-subdir + + +[preset: buildbot_linux_base] +mixin-preset= + mixin_linux_installation +build-subdir=buildbot_linux +lldb +release +# test +# validation-test +# long-test +# stress-test +# test-optimized foundation libdispatch -swiftpm +indexstore-db +sourcekit-lsp +swiftdocc +# lit-args=-v --time-tests + +# rdar://problem/31454823 +# lldb-test-swift-only + install-foundation install-libdispatch -install-swiftpm -llvm-install-components=clang;clang-resource-headers;compiler-rt -install-llvm -xctest +reconfigure + +[preset: buildbot_linux] +mixin-preset= + mixin_lightweight_assertions,no-stdlib-asserts + buildbot_linux_base + +[preset: buildbot_linux,no_assertions] +mixin-preset=buildbot_linux_base + +no-assertions + + +[preset: mixin_buildbot_linux,no_test] +skip-test-cmark +skip-test-lldb +skip-test-swift +skip-test-llbuild +skip-test-swiftpm +skip-test-swift-driver +skip-test-xctest +skip-test-foundation +skip-test-libdispatch +skip-test-playgroundsupport +skip-test-libicu +skip-test-indexstore-db +skip-test-sourcekit-lsp +skip-test-swiftdocc + +# Linux package with out test +[preset: buildbot_linux,no_test] +mixin-preset= + buildbot_linux + mixin_buildbot_linux,no_test + + +[preset: buildbot_linux,no_assertions,no_test] +mixin-preset= + buildbot_linux,no_assertions + mixin_buildbot_linux,no_test + +[preset: codeql-Linux] +mixin-preset= + buildbot_linux,no_assertions,no_test + codeql-release +bootstrapping=bootstrapping [preset: codeql-macOS] mixin-preset=codeql-release