From 72473b7d013a70845ed730d6367d1ce49e091220 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sun, 31 May 2026 18:55:29 +0200 Subject: [PATCH] Fix compile for webkit, nodejs, neovim --- recipes/wip/dev/lang/nodejs-21/redox.patch | 2 +- .../wip/libs/other/tree-sitter/recipe.toml | 4 +- .../wip/libs/other/tree-sitter/redox.patch | 196 +++++++----------- recipes/wip/text/neovim/recipe.toml | 24 +-- recipes/wip/web/webkitgtk3/recipe.toml | 3 +- 5 files changed, 85 insertions(+), 144 deletions(-) diff --git a/recipes/wip/dev/lang/nodejs-21/redox.patch b/recipes/wip/dev/lang/nodejs-21/redox.patch index 4aedc563..8a96055f 100644 --- a/recipes/wip/dev/lang/nodejs-21/redox.patch +++ b/recipes/wip/dev/lang/nodejs-21/redox.patch @@ -476,7 +476,7 @@ diff -ruwN source/tools/gyp/pylib/gyp/generator/make.py source-new/tools/gyp/pyl libraries = self.xcode_settings.AdjustLibraries(libraries) - self.WriteList(libraries, "LIBS") + # patch out unneeded libraries for host toolchain (js2c) -+ self.WriteList(libraries if self.toolset != "host" else ['-luv', '-L%s/usr/lib' % os.environ['COOKBOOK_TOOLCHAIN']], "LIBS") ++ self.WriteList(libraries if self.toolset != "host" else ['-luv', '-lz', '-L%s/usr/lib' % os.environ['COOKBOOK_TOOLCHAIN']], "LIBS") self.WriteLn( "%s: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))" % QuoteSpaces(self.output_binary) diff --git a/recipes/wip/libs/other/tree-sitter/recipe.toml b/recipes/wip/libs/other/tree-sitter/recipe.toml index fc5b0bad..cefaed89 100644 --- a/recipes/wip/libs/other/tree-sitter/recipe.toml +++ b/recipes/wip/libs/other/tree-sitter/recipe.toml @@ -1,6 +1,6 @@ [source] -tar = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.26.8.tar.gz" -blake3 = "c2312d7371fb5b814ed92d0a0ffa4efbae5800b3c1cccc4c9d88a1d810c87cff" +tar = "https://github.com/tree-sitter/tree-sitter/archive/refs/tags/v0.26.9.tar.gz" +blake3 = "3eb1abb42f4ae9d1ca30d978f5bda9cdb7e28dacdef131742b2274af996c4dee" patches = [ "redox.patch" ] diff --git a/recipes/wip/libs/other/tree-sitter/redox.patch b/recipes/wip/libs/other/tree-sitter/redox.patch index 6ecc5f3b..14394fd9 100644 --- a/recipes/wip/libs/other/tree-sitter/redox.patch +++ b/recipes/wip/libs/other/tree-sitter/redox.patch @@ -1,63 +1,24 @@ diff -ruwN source/Cargo.lock source-new/Cargo.lock ---- source/Cargo.lock 2026-04-01 00:31:10.000000000 +0700 -+++ source-new/Cargo.lock 2026-04-11 09:21:14.731631283 +0700 -@@ -71,7 +71,7 @@ - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" - dependencies = [ -- "windows-sys 0.61.2", -+ "windows-sys 0.60.2", - ] - - [[package]] -@@ -82,7 +82,7 @@ - dependencies = [ - "anstyle", - "once_cell_polyfill", -- "windows-sys 0.61.2", -+ "windows-sys 0.60.2", - ] - - [[package]] -@@ -621,7 +621,7 @@ - checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" - dependencies = [ - "libc", -- "windows-sys 0.61.2", -+ "windows-sys 0.60.2", - ] - - [[package]] -@@ -690,12 +690,11 @@ +--- source/Cargo.lock 2026-05-19 19:51:53.000000000 +0200 ++++ source-new/Cargo.lock 2026-05-31 18:13:28.410658931 +0200 +@@ -678,12 +678,12 @@ [[package]] name = "fs4" -version = "0.12.0" --source = "registry+https://github.com/rust-lang/crates.io-index" ++version = "1.1.0" + source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c29c30684418547d476f0b48e84f4821639119c483b1eccd566c8cd0cd05f521" -+version = "0.13.1" -+source = "git+https://github.com/al8n/fs4-rs#473289159ec3038a9e837913d13212118c57ab4c" ++checksum = "7e72ed92b67c146290f88e9c89d60ca163ea417a446f61ffd7b72df3e7f1dfd5" dependencies = [ - "rustix 0.38.44", - "windows-sys 0.52.0", + "rustix", -+ "windows-sys 0.59.0", ++ "windows-sys 0.61.2", ] [[package]] -@@ -1044,9 +1043,8 @@ - - [[package]] - name = "libc" --version = "0.2.180" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc" -+version = "0.2.184" -+source = "git+https://github.com/willnode/libc?branch=redox-sema-port#ccb27af35075003bf6ef157b9ef2707756ee78f6" - - [[package]] - name = "libloading" -@@ -1076,12 +1074,6 @@ +@@ -1124,12 +1124,6 @@ [[package]] name = "linux-raw-sys" @@ -67,31 +28,19 @@ diff -ruwN source/Cargo.lock source-new/Cargo.lock - -[[package]] -name = "linux-raw-sys" - version = "0.11.0" + version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" -@@ -1119,7 +1111,7 @@ + checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" +@@ -1167,7 +1161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ad38eb12aea514a0466ea40a80fd8cc83637065948eb4a426e4aa46261175227" dependencies = [ -- "rustix 1.1.3", +- "rustix 1.1.4", + "rustix", ] [[package]] -@@ -1148,9 +1140,8 @@ - - [[package]] - name = "nix" --version = "0.31.1" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "225e7cfe711e0ba79a68baeddb2982723e4235247aefce1482f2f16c27865b66" -+version = "0.31.2" -+source = "git+https://github.com/nix-rust/nix?rev=0708c8c#0708c8c321215147ef6fdd745ad6ddd5d8e83f71" - dependencies = [ - "bitflags 2.11.0", - "cfg-if", -@@ -1580,28 +1571,14 @@ +@@ -1637,19 +1631,6 @@ [[package]] name = "rustix" @@ -99,7 +48,7 @@ diff -ruwN source/Cargo.lock source-new/Cargo.lock -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" -dependencies = [ -- "bitflags 2.11.0", +- "bitflags", - "errno", - "libc", - "linux-raw-sys 0.4.15", @@ -108,64 +57,49 @@ diff -ruwN source/Cargo.lock source-new/Cargo.lock - -[[package]] -name = "rustix" - version = "1.1.3" --source = "registry+https://github.com/rust-lang/crates.io-index" --checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" -+source = "git+https://github.com/bytecodealliance/rustix?rev=8bf15a0#8bf15a0eb444087e4c3ed04e01ed488cc429af2d" - dependencies = [ - "bitflags 2.11.0", + version = "1.1.4" + source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "b6fe4565b9518b83ef4f91bb47ce29620ca828bd32cb7e408f0062e9930ba190" +@@ -1657,7 +1638,7 @@ + "bitflags", "errno", "libc", -- "linux-raw-sys 0.11.0", -- "windows-sys 0.61.2", +- "linux-raw-sys 0.12.1", + "linux-raw-sys", -+ "windows-sys 0.59.0", + "windows-sys 0.61.2", ] - [[package]] -@@ -1803,8 +1780,8 @@ +@@ -1882,7 +1863,7 @@ "fastrand", - "getrandom 0.4.1", + "getrandom 0.4.2", "once_cell", -- "rustix 1.1.3", -- "windows-sys 0.61.2", +- "rustix 1.1.4", + "rustix", -+ "windows-sys 0.60.2", + "windows-sys 0.61.2", ] - [[package]] -@@ -2348,7 +2325,7 @@ +@@ -2427,7 +2408,7 @@ "once_cell", "postcard", "pulley-interpreter", -- "rustix 1.1.3", +- "rustix 1.1.4", + "rustix", "serde", "serde_derive", "smallvec", -@@ -2460,7 +2437,7 @@ +@@ -2539,7 +2520,7 @@ "cc", "cfg-if", "libc", -- "rustix 1.1.3", +- "rustix 1.1.4", + "rustix", "wasmtime-internal-asm-macros", "wasmtime-internal-versioned-export-macros", "windows-sys 0.60.2", -@@ -2582,7 +2559,7 @@ - source = "registry+https://github.com/rust-lang/crates.io-index" - checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" - dependencies = [ -- "windows-sys 0.61.2", -+ "windows-sys 0.60.2", - ] +@@ -2692,15 +2673,6 @@ [[package]] -@@ -2621,15 +2598,6 @@ - ] - - [[package]] --name = "windows-sys" + name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" @@ -174,33 +108,25 @@ diff -ruwN source/Cargo.lock source-new/Cargo.lock -] - -[[package]] - name = "windows-sys" +-name = "windows-sys" version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" diff -ruwN source/Cargo.toml source-new/Cargo.toml ---- source/Cargo.toml 2026-04-01 00:31:10.000000000 +0700 -+++ source-new/Cargo.toml 2026-04-11 08:47:06.487627130 +0700 +--- source/Cargo.toml 2026-05-19 19:51:53.000000000 +0200 ++++ source-new/Cargo.toml 2026-05-31 18:08:35.420476183 +0200 @@ -122,7 +122,7 @@ ctrlc = { version = "3.5.0", features = ["termination"] } dialoguer = { version = "0.11.0", features = ["fuzzy-select"] } etcetera = "0.11.0" -fs4 = "0.12.0" -+fs4 = { git = "https://github.com/al8n/fs4-rs" } # for redox support, still not published yet ++fs4 = "1" glob = "0.3.3" heck = "0.5.0" html-escape = "0.2.13" -@@ -161,3 +161,8 @@ - tree-sitter-tags = { version = "0.26.8", path = "./crates/tags" } - - tree-sitter-language = { version = "0.1", path = "./crates/language" } -+ -+[patch.crates-io] -+rustix = { git = "https://github.com/bytecodealliance/rustix", rev = "8bf15a0" } -+nix = { git = "https://github.com/nix-rust/nix", rev = "0708c8c" } -+libc = { git = "https://github.com/willnode/libc", branch = "redox-sema-port" } diff -ruwN source/crates/cli/src/fuzz/allocations.rs source-new/crates/cli/src/fuzz/allocations.rs ---- source/crates/cli/src/fuzz/allocations.rs 2026-04-01 00:31:10.000000000 +0700 -+++ source-new/crates/cli/src/fuzz/allocations.rs 2026-04-11 08:47:06.487741558 +0700 +--- source/crates/cli/src/fuzz/allocations.rs 2026-05-19 19:51:53.000000000 +0200 ++++ source-new/crates/cli/src/fuzz/allocations.rs 2026-05-31 18:01:16.326230476 +0200 @@ -7,6 +7,7 @@ }, }; @@ -209,14 +135,38 @@ diff -ruwN source/crates/cli/src/fuzz/allocations.rs source-new/crates/cli/src/f #[ctor::ctor] unsafe fn initialize_allocation_recording() { tree_sitter::set_allocator( -diff -ruwN source/lib/src/portable/endian.h source-new/lib/src/portable/endian.h ---- source/lib/src/portable/endian.h 2026-04-01 00:31:10.000000000 +0700 -+++ source-new/lib/src/portable/endian.h 2026-04-11 08:47:06.487835899 +0700 -@@ -23,6 +23,7 @@ - defined(__redox__) || \ - defined(__NetBSD__) || \ - defined(__OpenBSD__) || \ -+ defined(__redox__) || \ - defined(__CYGWIN__) || \ - defined(__MSYS__) || \ - defined(__EMSCRIPTEN__) || \ +diff -ruwN source/crates/loader/src/loader.rs source-new/crates/loader/src/loader.rs +--- source/crates/loader/src/loader.rs 2026-05-19 19:51:53.000000000 +0200 ++++ source-new/crates/loader/src/loader.rs 2026-05-31 18:12:57.216936008 +0200 +@@ -21,7 +21,7 @@ + }; + + use etcetera::BaseStrategy as _; +-use fs4::fs_std::FileExt; ++use fs4::FileExt; + use libloading::{Library, Symbol}; + use log::{error, info, warn}; + use once_cell::unsync::OnceCell; +@@ -1030,11 +1030,11 @@ + + if let Ok(lock_file) = fs::OpenOptions::new().write(true).open(&lock_path) { + recompile = false; +- if lock_file.try_lock_exclusive().is_err() { ++ if lock_file.try_lock().is_err() { + // if we can't acquire the lock, another process is compiling the parser, wait for + // it and don't recompile + lock_file +- .lock_exclusive() ++ .lock() + .map_err(|e| LoaderError::IO(IoError::new(e, Some(lock_path.as_path()))))?; + recompile = false; + } else { +@@ -1067,7 +1067,7 @@ + .open(&lock_path) + .map_err(|e| LoaderError::IO(IoError::new(e, Some(lock_path.as_path()))))?; + lock_file +- .lock_exclusive() ++ .lock() + .map_err(|e| LoaderError::IO(IoError::new(e, Some(lock_path.as_path()))))?; + + self.compile_parser_to_dylib(&config, &lock_file, &lock_path)?; diff --git a/recipes/wip/text/neovim/recipe.toml b/recipes/wip/text/neovim/recipe.toml index 9ffd4098..d278e05f 100644 --- a/recipes/wip/text/neovim/recipe.toml +++ b/recipes/wip/text/neovim/recipe.toml @@ -12,7 +12,7 @@ patches = [ template = "custom" dependencies = [ "libiconv", - "target:libuv", + "libuv", "luv", "lpeg", "tree-sitter", @@ -22,33 +22,23 @@ dependencies = [ ] dev-dependencies = [ "host:luajit", - "host:neovim", ] script = """ DYNAMIC_INIT # the only official way to cross compile in future is via zig # https://github.com/neovim/neovim/issues/19579 -# the code path below is very hacky, and our zig support is poor yet +# the only problem is to compile libnlua.so in host, so we do it here COOKBOOK_CMAKE_FLAGS+=(-DLUA_GEN_PRG=luajit) export DEPS_BUILD_DIR=$COOKBOOK_SYSROOT/usr -if [ "$TARGET" = "$COOKBOOK_HOST_TARGET" ]; then -cookbook_cmake +(export COOKBOOK_NINJA=true && cookbook_cmake) -# needed to workaround bootstrapping process -cp ./lib/libnlua0.so ${COOKBOOK_STAGE}/usr/lib/nvim/ -patchelf --replace-needed \ - "${COOKBOOK_SYSROOT}/usr/lib/liblpeg.so" \ - 'liblpeg.so.1' ${COOKBOOK_STAGE}/usr/lib/nvim/libnlua0.so +${CC_WRAPPER} gcc -shared -I${COOKBOOK_SOURCE}/src ${COOKBOOK_SOURCE}/src/nlua0.c \ + -o ./libnlua0.so -lluajit-5.1 -I${COOKBOOK_TOOLCHAIN}/include/luajit-2.1 -L${COOKBOOK_TOOLCHAIN}/lib -else - -# this is a very ugly workaround -cookbook_cmake || true -cp ${COOKBOOK_TOOLCHAIN}/usr/lib/nvim/libnlua0.so ./lib/libnlua0.so -cookbook_cmake -fi +"${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}" +DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install -j"${COOKBOOK_MAKE_JOBS}" # Lpeg is absolute path https://github.com/neovim/neovim/issues/23395 patchelf --replace-needed \ diff --git a/recipes/wip/web/webkitgtk3/recipe.toml b/recipes/wip/web/webkitgtk3/recipe.toml index 79115e3d..2c44b551 100644 --- a/recipes/wip/web/webkitgtk3/recipe.toml +++ b/recipes/wip/web/webkitgtk3/recipe.toml @@ -16,7 +16,8 @@ dependencies = [ "sqlite3", ] dev-dependencies = [ - "host:gperf" + "host:gperf", + "libstdcxx", ] script = """ DYNAMIC_INIT