Compare commits

..

11 commits

Author SHA1 Message Date
Link Dupont
f87d8e8579 Install versioned libIndexStore.so 2026-01-06 13:50:41 +00:00
Link Dupont
d4994e13a0 Install libIndexStore.so 2026-01-04 06:52:30 +00:00
Link Dupont
bd48589fa3 Refactor build procedure to entirely self-contained, multi-stage bootstrapping (RHBZ#2390031) 2025-12-21 23:56:19 +00:00
Link Dupont
5dad138aba Temporary workaround to bootstrap the compiler with the broken symlink 2025-12-11 21:45:32 +00:00
Zephyr Lykos
bd2c738a6d Install standalone SwiftDemangle headers 2025-12-11 21:45:32 +00:00
Zephyr Lykos
de7b8463a3 Fix libdir symlink installation 2025-12-09 17:36:49 +00:00
Link Dupont
a69f537916 Update to Swift 6.2-RELEASE 2025-09-22 21:32:18 -04:00
Link Dupont
0c46d403f5 Convert the 6.1.3 release to generated sources
Convert the existing 6.1.3 sources to use the script-generated macros.

[skip changelog]
2025-09-20 23:22:27 -04:00
Link Dupont
a467f34810 Add update-swift-version.sh script
This script retrieves the 'update-checkout-config.json' file from the
correct version of the swift repository and updates the versions of the
additional sources to the versions specified in the JSON.
It is designed to be run manually by a package maintainer to update the
forty-something source packages that make up this project.

[skip changelog]
2025-09-20 23:22:27 -04:00
Link Dupont
222f3a5c72 Refactor sources and patches
[skip changelog]
2025-09-18 05:57:23 -04:00
Link Dupont
cb9b383587 Convert to %autorelease and %autochangelog
[skip changelog]
2025-09-16 22:59:30 -04:00
3 changed files with 117 additions and 22 deletions

64
fedora-presets.ini Normal file
View file

@ -0,0 +1,64 @@
# Custom preset for Fedora packaging
# This preset builds the final production toolchain including swift-driver
# using the bootstrapped Swift compiler from bootstrap_stage2
[preset: fedora_final]
bootstrapping=hosttools
# Skip all tests (inlined from 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-indexstore-db
skip-test-sourcekit-lsp
skip-test-swiftdocc
skip-test-wasm-stdlib
skip-test-swiftformat
release
# Build additional components for production toolchain
llbuild
xctest
swift-testing
swift-testing-macros
swiftpm
swift-driver
indexstore-db
sourcekit-lsp
swiftformat
swift-include-tests=0
llvm-include-tests=0
foundation
libdispatch
skip-build-benchmarks
build-subdir=%(build_subdir)s
install-destdir=%(install_destdir)s
swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;sdk-overlay;toolchain-tools;license
llvm-install-components=llvm-ar;llvm-ranlib;clang;clang-resource-headers;compiler-rt;clang-features-file;lld;IndexStore
install-llvm
install-swift
install-foundation
install-libdispatch
install-llbuild
install-swiftpm
install-swift-driver
install-swiftsyntax
install-swift-testing
install-swift-testing-macros
install-xctest
install-sourcekit-lsp
install-swiftformat

View file

@ -230,6 +230,7 @@ for i = 0, 49 do
end
}
Source99: swiftlang.conf
Source100: fedora-presets.ini
# NOTE: The patch number corresponds to the source it's packaging. For example,
# Patch25 is patching Source25, swift-foundation.
@ -255,11 +256,11 @@ BuildRequires: libcurl-devel
BuildRequires: libuuid-devel
BuildRequires: libedit-devel
BuildRequires: perl-podlators
BuildRequires: swiftlang
BuildRequires: lld
BuildRequires: binutils-gold
Requires: glibc-devel
Requires: binutils-gold
Requires: lld
Requires: gcc
Recommends: libstdc++-devel
@ -315,12 +316,15 @@ end
%patch 44
%patch 15
%patch 5
%patch 7
%patch 7
%patch 13
%patch 25
%patch 24
%patch 9
# Install custom Fedora preset
cp %{SOURCE100} swift/utils/fedora-presets.ini
# Fix python to python3
%py3_shebang_fix swift/utils/api_checker/swift-api-checker.py
%py3_shebang_fix llvm-project/compiler-rt/lib/hwasan/scripts/hwasan_symbolize
@ -330,13 +334,53 @@ sed -i 's/swift-tools-version:999.0.0/swift-tools-version:6.1.3/' wasmkit/Packag
%global buildsubdir %{nil}
%build
# Work around broken symlink in BuildRequires swiftlang by ensuring PATH finds the versioned swift
export PATH=%{_libexecdir}/swift/%{version}/bin:$PATH
export VERBOSE=1
%{builddir}/swift/utils/build-script --preset=buildbot_linux,no_test \
skip-early-swiftsyntax=true \
# Four-stage bootstrap to build Swift from scratch without external Swift compiler
# Stage 0: Build minimal Swift toolchain from C++ using gold linker
# Produces: Swift compiler with C++ legacy driver (no SwiftPM, no swift-driver)
# Stage 0 clang defaults to gold
# Stage 1: Rebuild Swift compiler using Stage 0 with gold linker
# Produces: Swift compiler with macros support + Foundation + Dispatch
# Stage 1 clang is compiled with lld as its default linker
# Stage 2: Build Swift compiler using Stage 1 with lld linker
# Produces: Swift compiler + SwiftPM + basic tools (still no swift-driver)
# Stage 2 clang defaults to lld
# Stage 3: Build final production toolchain using Stage 2
# Produces: Complete toolchain with swift-driver, sourcekit-lsp, swift-format, etc.
# This matches upstream first-party distributions
echo "=== Bootstrap Stage 0: Building minimal Swift from C++ ==="
%{builddir}/swift/utils/build-script --preset=bootstrap_stage0 \
build_subdir=bootstrap_stage0 \
install_destdir=%{_builddir}/stage0 \
installable_package=%{_builddir}/swift-%{version}-stage0.tar.gz \
extra-cmake-options="-DLLVM_USE_LINKER=gold -DCLANG_DEFAULT_LINKER=gold"
echo "=== Bootstrap Stage 1: Rebuilding Swift with Stage 0 ==="
export PATH=%{_builddir}/stage0/usr/bin:$PATH
%{builddir}/swift/utils/build-script --preset=bootstrap_stage1 \
build_subdir=bootstrap_stage1 \
install_destdir=%{_builddir}/stage1 \
installable_package=%{_builddir}/swift-%{version}-stage1.tar.gz \
extra-cmake-options="-DLLVM_USE_LINKER=gold -DCLANG_DEFAULT_LINKER=lld"
echo "=== Bootstrap Stage 2: Building toolchain with SwiftPM ==="
export PATH=%{_builddir}/stage1/usr/bin:%{_builddir}/stage0/usr/bin:$PATH
%{builddir}/swift/utils/build-script --preset=bootstrap_stage2 \
build_subdir=bootstrap_stage2 \
install_destdir=%{_builddir}/stage2 \
installable_package=%{_builddir}/swift-%{version}-stage2.tar.gz \
extra-cmake-options="-DLLVM_USE_LINKER=lld -DCLANG_DEFAULT_LINKER=lld"
echo "=== Stage 3: Building final production toolchain with swift-driver ==="
export PATH=%{_builddir}/stage2/usr/bin:%{_builddir}/stage1/usr/bin:%{_builddir}/stage0/usr/bin:$PATH
%{builddir}/swift/utils/build-script --preset=fedora_final \
--preset-file=%{builddir}/swift/utils/fedora-presets.ini \
build_subdir=fedora_final \
install_destdir=%{_builddir} \
installable_package=%{_builddir}/swift-%{version}-f%{fedora}.tar.gz
installable_package=%{_builddir}/swift-%{version}-f%{fedora}.tar.gz \
extra-cmake-options="-DLLVM_USE_LINKER=lld -DCLANG_DEFAULT_LINKER=lld -DCMAKE_EXE_LINKER_FLAGS=-Wl,-z,relro,-z,now -DCMAKE_SHARED_LINKER_FLAGS=-Wl,-z,relro,-z,now"
%install
@ -354,7 +398,7 @@ mkdir -p %{buildroot}/usr/lib
ln -fs %{_libexecdir}/swift/%{version}/lib/swift %{buildroot}/usr/lib/swift
mkdir -p %{buildroot}%{_libdir}
ln -fs %{_libexecdir}/swift/%{version}/lib/libIndexStore.so %{buildroot}%{_libdir}/
ln -fs %{_libexecdir}/swift/%{version}/lib/libIndexStore.so.17 %{buildroot}%{_libdir}/
ln -fs %{_libexecdir}/swift/%{version}/lib/libIndexStore.so.17.0 %{buildroot}%{_libdir}/
ln -fs %{_libexecdir}/swift/%{version}/lib/libsourcekitdInProc.so %{buildroot}%{_libdir}/
ln -fs %{_libexecdir}/swift/%{version}/lib/libswiftDemangle.so %{buildroot}%{_libdir}/
mkdir -p %{buildroot}%{_includedir}/swift

View file

@ -22,19 +22,6 @@ index 56b9e606302..ca651fc8845 100644
#include <cstdlib>
#include <cstring>
#include <functional>
diff --git swift.orig/utils/build-presets.ini swift/utils/build-presets.ini
index 75043cb69a7..25aec6bc29a 100644
--- swift.orig/utils/build-presets.ini
+++ swift/utils/build-presets.ini
@@ -886,7 +886,7 @@ build-wasm-stdlib
# Executes the lit tests for the installable package that is created
# Assumes the swift-integration-tests repo is checked out
-test-installable-package
+# test-installable-package
# Build the benchmarks against the toolchain.
toolchain-benchmarks
diff --git swift.orig/utils/build-script-impl swift/utils/build-script-impl
index 3140c8bb545..32a0b502ae6 100755
--- swift.orig/utils/build-script-impl