Skip to content

Commit fd7e6d2

Browse files
firefox/wasi-sdk: upgrade wasi-sdk 21->29
This update is an optional build-time requirement for Firefox 144+ to be able to build some sandboxed libraries. Since the build system was overhauled by upstream, the original recipe was split into two also: one recipe builds the toolchain (which is essentially a WebAssembly-only clang), and the second recipe populates the actual sysroot. Though they use the same main CMakeLists.txt file, the environment is quite different for the two steps, hence the split. One notable change is that building this recipe requires at least Clang 18, which is a bump from the previous Clang 14. Though Kirkstone can still build it, it requires switching to a new meta-clang branch. Signed-off-by: Gyorgy Sarvari <[email protected]>
1 parent 9886fb9 commit fd7e6d2

11 files changed

+177
-107
lines changed

meta-firefox/conf/post-whinlatter-s-config.inc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@ CORRECT_S = '${@bb.utils.contains_any("LAYERSERIES_CORENAMES", "whinlatter", d.g
1111

1212
S:pn-cbindgen = "${CORRECT_S}"
1313
S:pn-cbindgen-native = "${CORRECT_S}"
14-
S:pn-wasi-sdk-native = "${CORRECT_S}"
14+
S:pn-wasi-sdk-sysroot-native = "${CORRECT_S}"
15+
S:pn-wasi-sdk-toolchain-native = "${CORRECT_S}"
16+
S:pn-wasm-component-ld = "${CORRECT_S}"
17+
S:pn-wasm-component-ld-native = "${CORRECT_S}"

meta-firefox/recipes-browser/firefox/firefox.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ PACKAGECONFIG[system-pipewire] = "--with-system-pipewire,,pipewire,pipewire"
130130
PACKAGECONFIG[system-gbm] = "--with-system-gbm,,virtual/libgbm,libgbm"
131131
PACKAGECONFIG[system-libdrm] = "--with-system-libdrm,,libdrm,libdrm"
132132

133-
DEPENDS:append = '${@bb.utils.contains("PACKAGECONFIG", "disable-sandboxed-libraries", "", " wasi-sdk-native ", d)}'
133+
DEPENDS:append = '${@bb.utils.contains("PACKAGECONFIG", "disable-sandboxed-libraries", "", " wasi-sdk-sysroot-native ", d)}'
134134

135135
LDFLAGS:append = "${@bb.utils.contains('PACKAGECONFIG', 'system-av1', ' -Wl,--undefined-version ', '', d)}"
136136

meta-firefox/recipes-devtools/wasi-sdk/files/0001-allow-compiling-with-cmake-4.patch

Lines changed: 0 additions & 25 deletions
This file was deleted.

meta-firefox/recipes-devtools/wasi-sdk/files/0001-disable-exceptions-and-bulk-memory.patch

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
From 1fdbaaa58d6b816f4280db5de418112b9ff50c48 Mon Sep 17 00:00:00 2001
2+
From: Gyorgy Sarvari <[email protected]>
3+
Date: Wed, 26 Nov 2025 13:15:30 +0100
4+
Subject: [PATCH] don't build wasm-component-ld
5+
6+
wasm-component-ld is fetched from the internet. For OE, it is built
7+
with a separate recipe, no need to build it here also.
8+
9+
Signed-off-by: Gyorgy Sarvari <[email protected]>
10+
---
11+
cmake/wasi-sdk-toolchain.cmake | 20 --------------------
12+
1 file changed, 20 deletions(-)
13+
14+
diff --git a/cmake/wasi-sdk-toolchain.cmake b/cmake/wasi-sdk-toolchain.cmake
15+
index 61481e3..f68d288 100644
16+
--- a/cmake/wasi-sdk-toolchain.cmake
17+
+++ b/cmake/wasi-sdk-toolchain.cmake
18+
@@ -116,26 +116,6 @@ install(DIRECTORY ${wasi_tmp_install}/bin ${wasi_tmp_install}/lib ${wasi_tmp_ins
19+
USE_SOURCE_PERMISSIONS
20+
DESTINATION ${CMAKE_INSTALL_PREFIX})
21+
22+
-# Build logic for `wasm-component-ld` installed from Rust code.
23+
-set(wasm_component_ld_root ${CMAKE_CURRENT_BINARY_DIR}/wasm-component-ld)
24+
-set(wasm_component_ld ${wasm_component_ld_root}/bin/wasm-component-ld${CMAKE_EXECUTABLE_SUFFIX})
25+
-set(wasm_component_ld_version 0.5.19)
26+
-if(RUST_TARGET)
27+
- set(rust_target_flag --target=${RUST_TARGET})
28+
-endif()
29+
-add_custom_command(
30+
- OUTPUT ${wasm_component_ld}
31+
- COMMAND
32+
- cargo install --root ${wasm_component_ld_root} ${rust_target_flag}
33+
- wasm-component-ld@${wasm_component_ld_version}
34+
- COMMAND
35+
- cmake -E make_directory ${wasi_tmp_install}/bin
36+
- COMMAND
37+
- cmake -E copy ${wasm_component_ld} ${wasi_tmp_install}/bin
38+
- COMMENT "Building `wasm-component-ld` ...")
39+
-add_custom_target(wasm-component-ld DEPENDS ${wasm_component_ld})
40+
-add_dependencies(build wasm-component-ld)
41+
-
42+
# Setup installation logic for CMake support files.
43+
add_custom_target(misc-files)
44+
add_dependencies(build misc-files)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
From a4ef37515d280b0000de3f3b9a16a58aec91ab95 Mon Sep 17 00:00:00 2001
2+
From: Gyorgy Sarvari <[email protected]>
3+
Date: Wed, 26 Nov 2025 16:04:11 +0100
4+
Subject: [PATCH] don't strip symbols from binaries
5+
6+
By default the project is trying to shrink their footprint by
7+
stripping the debug symbols from the binaries, which however
8+
makes the relevant QA check complain.
9+
10+
This patch removes the stripping.
11+
12+
Upstream-Status: Inappropriate [oe-specific]
13+
Signed-off-by: Gyorgy Sarvari <[email protected]>
14+
---
15+
cmake/wasi-sdk-toolchain.cmake | 23 -----------------------
16+
1 file changed, 23 deletions(-)
17+
18+
diff --git a/cmake/wasi-sdk-toolchain.cmake b/cmake/wasi-sdk-toolchain.cmake
19+
index 61481e3..5f04af4 100644
20+
--- a/cmake/wasi-sdk-toolchain.cmake
21+
+++ b/cmake/wasi-sdk-toolchain.cmake
22+
@@ -90,9 +90,6 @@ ExternalProject_Add(llvm-build
23+
-DLLVM_DEFAULT_TARGET_TRIPLE=wasm32-wasi
24+
-DLLVM_INSTALL_BINUTILS_SYMLINKS=TRUE
25+
-DLLVM_ENABLE_LIBXML2=OFF
26+
- # Pass `-s` to strip symbols by default and shrink the size of the
27+
- # distribution
28+
- -DCMAKE_EXE_LINKER_FLAGS=-s
29+
${llvm_cmake_flags_list}
30+
# See https://www.scivision.dev/cmake-externalproject-list-arguments/ for
31+
# why this is in `CMAKE_CACHE_ARGS` instead of above
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
From 6c777445050d715512acd2ac0d419992bc224da7 Mon Sep 17 00:00:00 2001
2+
From: Gyorgy Sarvari <[email protected]>
3+
Date: Wed, 26 Nov 2025 13:06:22 +0100
4+
Subject: [PATCH] lower cmake requirement
5+
6+
Kirkstone has CMake 3.22, but the minimum is specified as 3.26.
7+
8+
Lower it, so it can be built on Kirkstone - the cmake files are
9+
fairly straightforward and simple, without very arcane options.
10+
11+
Upstream-Status: Inappropriate [oe-specific]
12+
Signed-off-by: Gyorgy Sarvari <[email protected]>
13+
---
14+
CMakeLists.txt | 2 +-
15+
1 file changed, 1 insertion(+), 1 deletion(-)
16+
17+
diff --git a/CMakeLists.txt b/CMakeLists.txt
18+
index a0d3fca..22ef298 100644
19+
--- a/CMakeLists.txt
20+
+++ b/CMakeLists.txt
21+
@@ -6,7 +6,7 @@
22+
# WASI sysroot build requires this previous compiler and must be runnable on
23+
# the host.
24+
25+
-cmake_minimum_required(VERSION 3.26)
26+
+cmake_minimum_required(VERSION 3.22)
27+
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
28+
project(wasi-sdk)
29+
include(ExternalProject)

meta-firefox/recipes-devtools/wasi-sdk/wasi-sdk-native_git.bb

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require wasi-sdk.inc
2+
3+
DEPENDS += "wasi-sdk-toolchain-native wasm-component-ld-native"
4+
RDEPENDS:${PN} = "wasi-sdk-toolchain-native wasm-component-ld-native"
5+
6+
EXTRA_OECMAKE += " \
7+
-DCMAKE_TOOLCHAIN_FILE=${RECIPE_SYSROOT_NATIVE}/usr/share/wasi-sysroot/share/cmake/wasi-sdk.cmake \
8+
-DCMAKE_C_COMPILER_WORKS=ON \
9+
-DCMAKE_CXX_COMPILER_WORKS=ON \
10+
"
11+
12+
BUILD_LD = "wasm-ld"
13+
14+
# wasi-sysroot is built for wasi target, not for host/target
15+
CFLAGS = ""
16+
CXXFLAGS = ""
17+
LDFLAGS = ""
18+
CMAKE_C_LINK_FLAGS = ""
19+
CMAKE_CXX_LINK_FLAGS = ""
20+
OECMAKE_C_LINK_FLAGS = ""
21+
OECMAKE_CXX_LINK_FLAGS = ""
22+
BUILD_CC = ""
23+
COMPILER_RT:remove = "-rtlib=libgcc"
24+
25+
do_install:append(){
26+
install -d ${D}${datadir}/wasi-sysroot/lib/clang/${WASI_CLANG_VERSION}
27+
mv ${D}${prefix}/clang-resource-dir/lib ${D}${datadir}/wasi-sysroot/lib/clang/${WASI_CLANG_VERSION}/
28+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require wasi-sdk.inc
2+
EXTRA_OECMAKE = "-DWASI_SDK_BUILD_TOOLCHAIN=ON"
3+
4+
do_install:append(){
5+
ln -s ../../../lib/libedit.so.0 ${D}${datadir}/wasi-sysroot/lib/libedit.so.0
6+
ln -s ../../../lib/libtinfo.so.5 ${D}${datadir}/wasi-sysroot/lib/libtinfo.so.5
7+
}
8+
9+
# Wasi-sdk builds its own sysroot
10+
prefix .= "/share/wasi-sysroot"

0 commit comments

Comments
 (0)