From ff590e9cfdcbb4fd58cac9847f838c4a5ed69c6f Mon Sep 17 00:00:00 2001 From: Bradley Walters Date: Wed, 7 Jan 2026 15:46:46 -0800 Subject: [PATCH] fix(cmake): fix include paths for local WebKit (#25815) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### What does this PR do? Without this change, building with `-DWEBKIT_LOCAL=ON` fails with: ``` /work/bun/src/bun.js/bindings/BunObject.cpp:12:10: fatal error: 'JavaScriptCore/JSBase.h' file not found 12 | #include | ^~~~~~~~~~~~~~~~~~~~~~~~~ 1 error generated. ``` The reason for this is because the directory structure differs between downloaded and local WebKit. Downloaded WebKit: ``` build/debug/cache/webkit-6d0f3aac0b817cc0/ └── include/ └── JavaScriptCore/ └── JSBase.h ← Direct path ``` Local WebKit: ``` vendor/WebKit/WebKitBuild/Debug/ └── JavaScriptCore/Headers/ └── JavaScriptCore/ └── JSBase.h ← Nested path ``` The include paths are thus configured differently for each build type. For Remote WebKit (when WEBKIT_LOCAL=OFF): - SetupWebKit.cmake line 22 sets: WEBKIT_INCLUDE_PATH = ${WEBKIT_PATH}/include - BuildBun.cmake line 1253 adds: include_directories(${WEBKIT_INCLUDE_PATH}) - This resolves to: build/debug/cache/webkit-6d0f3aac0b817cc0/include/ - So #include finds the file at include/JavaScriptCore/JSBase.h ✅ For Local WebKit (when WEBKIT_LOCAL=ON): - The original code only added: ${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore - This resolves to: vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/Headers/JavaScriptCore/ - So #include fails because there's no JavaScriptCore/ subdirectory at that level ❌ - The fix adds: ${WEBKIT_PATH}/JavaScriptCore/Headers - Now the include path includes: vendor/WebKit/WebKitBuild/Debug/JavaScriptCore/Headers/ - So #include finds the file at Headers/JavaScriptCore/JSBase.h ✅ ### How did you verify your code works? Built locally. Co-authored-by: Carl Smedstad --- cmake/tools/SetupWebKit.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/tools/SetupWebKit.cmake b/cmake/tools/SetupWebKit.cmake index 545f82dd68..4e31fbeb2c 100644 --- a/cmake/tools/SetupWebKit.cmake +++ b/cmake/tools/SetupWebKit.cmake @@ -28,6 +28,7 @@ if(WEBKIT_LOCAL) # make jsc-compile-debug jsc-copy-headers include_directories( ${WEBKIT_PATH} + ${WEBKIT_PATH}/JavaScriptCore/Headers ${WEBKIT_PATH}/JavaScriptCore/Headers/JavaScriptCore ${WEBKIT_PATH}/JavaScriptCore/PrivateHeaders ${WEBKIT_PATH}/bmalloc/Headers