Tidy up servo recipe

This commit is contained in:
Wildan M 2025-09-30 20:59:24 +07:00
parent 81bce6bf7c
commit f26fd8dee1
3 changed files with 79 additions and 35 deletions

View File

@ -1,6 +1,9 @@
[source]
git = "https://gitlab.redox-os.org/njskalski/servo.git"
branch = "redox_mods"
script = """
cp ../.servobuild ./
"""
[build]
template = "custom"
@ -13,6 +16,8 @@ dependencies = [
"libffi",
"libiconv",
"libx11",
"libxcursor",
"libxkbcommon-x11",
"libxcb",
"libpng",
"openssl1",
@ -26,49 +31,31 @@ dependencies = [
"libpthread-stubs",
"fontconfig",
"expat",
"relibc",
"gcc13",
]
script = """
cp "${COOKBOOK_RECIPE}/.servobuild" "${COOKBOOK_SOURCE}/.servobuild"
# Add wrapper to PATH
export PATH="${COOKBOOK_RECIPE}:${PATH}"
export TARGET=${TARGET}
# Force cargo to use the correct build target
export CARGO_BUILD_TARGET=${TARGET}
DYNAMIC_INIT
# jemalloc specific configuration
export JEMALLOC_SYS_WITH_LG_PAGE=16
export TARGET_CC=${TARGET}-gcc
export TARGET_CXX=${TARGET}-g++
export TARGET_AR=${TARGET}-ar
export TARGET_CC="$CC"
export TARGET_CXX="$CXX"
export TARGET_AR="$AR"
export PKG_CONFIG_ALLOW_CROSS=1
# this /usr/share/pkgconfig comes from x11proto, that stages pc files in wrong dir.
export PKG_CONFIG_PATH="${COOKBOOK_SYSROOT}/lib/pkgconfig"
#:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig:${COOKBOOK_SYSROOT}/usr/share/pkgconfig"
export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig"
#:${COOKBOOK_SYSROOT}/usr/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
export RUSTFLAGS="-C target-feature=-crt-static -C link-args=-lpng -C link-args=-lxcb -C link-args=-lexpat -C link-args=-lgcc_s -C link-args=-lz -C link-args=-lXau -C link-args=-no-pie"
rsync -a --delete "${COOKBOOK_SOURCE}/" ./
# I'm tired trying figure out why multiple pkgconfig paths are ignored by cargo building stuff
export PKG_CONFIG_PATH_x86_64_unknown_redox="${COOKBOOK_SYSROOT}/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR_x86_64_unknown_redox="${COOKBOOK_SYSROOT}/lib/pkgconfig"
rsync -a -v ${COOKBOOK_SYSROOT}/usr/share/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/
rsync -a -v ${COOKBOOK_SYSROOT}/usr/lib/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib/pkgconfig/
echo "listing ${COOKBOOK_SYSROOT}/lib/pkgconfig"
ls -al ${COOKBOOK_SYSROOT}/lib/pkgconfig
export RUSTFLAGS="$RUSTFLAGS -L native=${COOKBOOK_SYSROOT}/lib"
# -j 1 to lock down "which crate fails", because cargo tree -i doesn't work for gaol
cargo build --target ${TARGET} --release
#TODO: mozjs-sys/build.rs fork links to hardcoded /home/andrzej/.redoxer instead of prefix toolchain, plus wrongly added -nostdinc/-nostdinc++, here's the workaround
PREFIX_INCLUDE=$(realpath "$COOKBOOK_ROOT/../prefix/$TARGET/sysroot/x86_64-unknown-redox/include")
export CLANGFLAGS="-I $PREFIX_INCLUDE -I $PREFIX_INCLUDE/c++/13.2.0 -I $PREFIX_INCLUDE/c++/13.2.0/$TARGET -I $PREFIX_INCLUDE/c++/13.2.0/backward"
mkdir -pv "${COOKBOOK_STAGE}/usr/servo"
cp -r -v "target/${TARGET}/release/servo" "${COOKBOOK_STAGE}/usr/servo"
PACKAGE_PATH="ports/servoshell" cookbook_cargo
"""
# [package]
# dependencies = [
# "libxcursor",
# "libxkbcommon-x11",
# ]

View File

@ -0,0 +1,24 @@
# TODO: Conflict with libxkbcommon-x11
[source]
tar = "https://xkbcommon.org/download/libxkbcommon-1.7.0.tar.xz"
b3sum = "5001ca0b8562feeef2010bf16c05657e3875fda3ed5fdedbf48b9135e5cdfcbc"
patches = [ "redox.patch" ]
[build]
template = "custom"
dependencies = [
"libxml2",
"xz",
"zlib",
"libpthread-stubs",
"libxau",
"x11proto",
"xcb-proto",
"libxcb",
]
script = """
DYNAMIC_INIT
cookbook_meson \
-Denable-wayland=false \
-Denable-x11=true
"""

View File

@ -0,0 +1,33 @@
diff -ruwN source/meson.build source-new/meson.build
--- source/meson.build 2024-03-24 04:23:43.000000000 +0700
+++ source-new/meson.build 2025-09-30 17:40:34.433925985 +0700
@@ -637,8 +637,6 @@
libxkbcommon_x11_test_internal = static_library(
'xkbcommon-x11-internal',
libxkbcommon_x11_sources,
- 'test/xvfb-wrapper.c',
- 'test/xvfb-wrapper.h',
include_directories: include_directories('src', 'include'),
link_with: libxkbcommon_test_internal,
dependencies: [
@@ -768,20 +766,6 @@
dependencies: test_dep),
env: test_env,
)
-if get_option('enable-x11')
- test(
- 'x11',
- executable('test-x11', 'test/x11.c', dependencies: x11_test_dep),
- env: test_env,
- is_parallel : false,
- )
- test(
- 'x11comp',
- executable('test-x11comp', 'test/x11comp.c', dependencies: x11_test_dep),
- env: test_env,
- is_parallel : false,
- )
-endif
if get_option('enable-xkbregistry')
test(
'registry',