Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0677ffbc65a4ef32358aadefd302f888f1615351
      
https://github.com/WebKit/WebKit/commit/0677ffbc65a4ef32358aadefd302f888f1615351
  Author: Adrian Taylor <[email protected]>
  Date:   2026-04-26 (Sun, 26 Apr 2026)

  Changed paths:
    M Source/WebCore/PAL/pal/CMakeLists.txt
    M Source/WebKit/Shared/Cocoa/WKObject.h
    M Source/WebKit/Shared/WebKit-Swift.h
    M Source/cmake/WebKitFeatures.cmake
    M Source/cmake/WebKitMacros.cmake
    M Tools/Scripts/swift/swiftc-wrapper.sh

  Log Message:
  -----------
  Linux Swift build fixes
https://bugs.webkit.org/show_bug.cgi?id=312865
rdar://175232650

Reviewed by Geoffrey Garen and Richard Robinson.

There are a selection of changes here required to get
ENABLE_SWIFT_DEMO_URI_SCHEME working again on Linux/GTK builds.
This is the option we added to allow WebKit embedders to test whether Swift
works well in their environments and to make any fixes required, in advance of
potentially more widespread use of Swift within WebKit. That option has
unfortunately become broken lately due to unrelated cmake work; this fixes it.

The changes are:
- Add Cocoa platform guards around WKObject.h, which is included in
  a modulemap (so swiftc aims to compile it on all platforms)
- Suppress #warning warnings where swift's libstdc++ modulemap
  includes a deprecated cstdbool header.
- Where swiftc was being passed -DFOO, also arrange for swiftc to
  be given -Xcc -DFOO, so that the option is passed to the internal
  clang that's used to interpret C++ header files.
- Previously, all WebKit config options were being given to
  swiftc as -DFOO. This was always wrong - it should only have been passed
  the options which were turned on. Fix this behavior.
- Pass options such as -DBUILDING_GTK=1 through to swiftc when it's
  in header-emission mode.

Together, these options get us almost back to the point where
the Linux build works (at least on top of main@311666 though this remains a
fluid situation). Full build instructions are:

1. Ubuntu 25.10 (I installed in a virtual machine, it works nicely - I gave it
32GB and 6 cores). Ubuntu 25.04 has previously worked too. (It may be worth
trying the WebKit build container but I have not).
2. apt-get install libgxr-dev libopenxr-dev libbacktrace-dev
3. Install Swift using the standard swiftly recipe from the Swift website.
https://www.swift.org/install/linux/
4. swiftly install 6.3-snapshot
5. swiftly use 6.3-snapshot-2026-03-05
6. Patch
~/./share/swiftly/toolchains/6.3-snapshot-2026-03-05/usr/lib/swift/linux/libstdcxx.modulemap
with the fix from
https://github.com/swiftlang/swift/pull/88521/changes#diff-869f2f1071ee46a3980bd732812908571546a583139e7a5b55e93ca4b9dd366fR87
7. Set SWIFTC to point to that
8. Set CC to clang (n.b. a clang is installed by swiftly)
9. Set CXX  to clang++
10. Tools/Scripts/build-webkit —gtk —debug --swift-demo-uri-scheme 
--no-encrypted-media '--cmakeargs=-DUSE_LIBRICE=OFF'

Minibrowser can then be used to browse to x-swift-demo://

* Source/WebCore/PAL/pal/CMakeLists.txt:
* Source/WebKit/Shared/Cocoa/WKObject.h:
* Source/WebKit/Shared/WebKit-Swift.h:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmake/WebKitMacros.cmake:
* Tools/Scripts/swift/swiftc-wrapper.sh:

Canonical link: https://commits.webkit.org/312067@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to