Make servo working

This commit is contained in:
Wildan M 2025-10-29 15:24:10 +07:00
parent 8f892754d1
commit 454ab2bf85
7 changed files with 195 additions and 29 deletions

View File

@ -0,0 +1,18 @@
[source]
same_as = "../../dev/gcc13"
[build]
template = "custom"
dependencies = [
"libgmp",
"libmpfr",
"mpc",
"zlib"
]
script = """
DYNAMIC_INIT
CPPINCLUDE="${COOKBOOK_HOST_SYSROOT}/$TARGET/include/c++/13.2.0"
export CPPFLAGS+=" -I${CPPINCLUDE} -I${CPPINCLUDE}/$TARGET/bits"
COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/libstdc++-v3/configure"
cookbook_configure
"""

View File

@ -31,6 +31,7 @@ dependencies = [
"libpsl",
"libpthread-stubs",
"libsoup",
"libstdcxx-v3",
"libtasn1",
"libwebp",
"libx11",
@ -89,6 +90,17 @@ COOKBOOK_CMAKE_FLAGS+=(
-DUSE_SYSTEM_MALLOC=OFF
-DUSE_SYSTEM_SYSPROF_CAPTURE=OFF
-DUSE_WOFF2=OFF
#TODO: remove these when runtime hangs solved
-DENABLE_JIT=OFF
-DENABLE_DFG_JIT=OFF
-DENABLE_FTL_JIT=OFF
-DENABLE_OPENGL=OFF
-DENABLE_WEBGL=OFF
-DENABLE_XSLT=OFF
-DENABLE_GEOLOCATION=OFF
-DENABLE_WEBDRIVER=OFF
-DENABLE_BUBBLEWRAP_SANDBOX=OFF
-DUSE_LCMS=OFF
)
cookbook_cmake

View File

@ -1,5 +1,5 @@
[source]
git = "github.com/servo/servo.git"
git = "https://github.com/servo/servo.git"
rev = "25fea1e086c46d611cf87db439430994e4f56cd5"
patches = [
"redox.patch"
@ -23,6 +23,7 @@ dependencies = [
"libx11",
"libxcb",
"libpng",
"libstdcxx-v3",
"openssl1",
"pcre",
"zlib",
@ -44,6 +45,7 @@ export TARGET_CC="$CC"
export TARGET_CXX="$CXX"
export TARGET_AR="$AR"
# pkg-config crate can only recognize one path to pkgconfig
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/
@ -51,13 +53,19 @@ rsync -a -v ${COOKBOOK_SYSROOT}/usr/share/pkgconfig/*.pc ${COOKBOOK_SYSROOT}/lib
export RUSTFLAGS="$RUSTFLAGS -L native=${COOKBOOK_SYSROOT}/lib -C link-arg=-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib"
#TODO: mozjs-sys and mozangle uses clang, it won't know our prefix C libraries, so here's the workaround
PREFIX_INCLUDE=$(realpath "$COOKBOOK_ROOT/../prefix/$TARGET/sysroot/x86_64-unknown-redox/include")
PREFIX_INCLUDE="$COOKBOOK_HOST_SYSROOT/$TARGET/include"
export CLANGFLAGS="-I $PREFIX_INCLUDE/c++/13.2.0 -I $PREFIX_INCLUDE/c++/13.2.0/$TARGET -I $PREFIX_INCLUDE/c++/13.2.0/backward -I $PREFIX_INCLUDE"
#Mozjs specifics
export CARGO_MAKEFLAGS="-j $COOKBOOK_MAKE_JOBS" CCACHE="sccache"
PACKAGE_PATH="ports/servoshell" cookbook_cargo
# resources packaging
mkdir -p ${COOKBOOK_STAGE}/usr/lib/servo/bin
mv ${COOKBOOK_STAGE}/usr/bin/servo ${COOKBOOK_STAGE}/usr/lib/servo/bin/
ln -s ../lib/servo/bin/servo ${COOKBOOK_STAGE}/usr/bin/servo
rsync -a -v ${COOKBOOK_SOURCE}/resources ${COOKBOOK_STAGE}/usr/lib/servo/
"""
[package]

View File

@ -380,6 +380,19 @@ index 51e81f6c085..fb85b1ea6b1 100644
webxr-api = { workspace = true, features = ["ipc"], optional = true }
wgpu-core = { workspace = true }
wgpu-types = { workspace = true }
diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs
index a271cad5643..551cf044eb2 100644
--- a/components/script/dom/bindings/buffer_source.rs
+++ b/components/script/dom/bindings/buffer_source.rs
@@ -887,7 +887,7 @@ impl DataBlock {
*cx,
range.end - range.start,
// SAFETY: This is safe because we have checked there is no overlapping view
- (*raw)[range.clone()].as_mut_ptr() as _,
+ (&mut (*raw))[range.clone()].as_mut_ptr() as _,
Some(free_func),
raw as _,
)
diff --git a/components/script/dom/navigatorinfo.rs b/components/script/dom/navigatorinfo.rs
index f3e6ddc109b..ee83d327df9 100644
--- a/components/script/dom/navigatorinfo.rs

View File

@ -1,7 +1,8 @@
# TODO: Conflict with libxkbcommon-x11
# TODO: Keyboard not working, see patches
[source]
tar = "https://xkbcommon.org/download/libxkbcommon-1.7.0.tar.xz"
b3sum = "5001ca0b8562feeef2010bf16c05657e3875fda3ed5fdedbf48b9135e5cdfcbc"
blake3 = "5001ca0b8562feeef2010bf16c05657e3875fda3ed5fdedbf48b9135e5cdfcbc"
patches = [ "redox.patch" ]
[build]

View File

@ -1,6 +1,6 @@
diff -ruwN source/meson.build source-new/meson.build
diff --color -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
+++ source-new/meson.build 2025-10-29 10:55:30.355297899 +0700
@@ -637,8 +637,6 @@
libxkbcommon_x11_test_internal = static_library(
'xkbcommon-x11-internal',
@ -31,3 +31,62 @@ diff -ruwN source/meson.build source-new/meson.build
if get_option('enable-xkbregistry')
test(
'registry',
diff --color -ruwN source/src/x11/util.c source-new/src/x11/util.c
--- source/src/x11/util.c 2024-03-24 04:23:43.000000000 +0700
+++ source-new/src/x11/util.c 2025-10-29 15:03:58.879274347 +0700
@@ -39,7 +39,7 @@
uint16_t server_major, server_minor;
if (flags & ~(XKB_X11_SETUP_XKB_EXTENSION_NO_FLAGS)) {
- /* log_err_func(ctx, "unrecognized flags: %#x\n", flags); */
+ printf("unrecognized flags: %#x\n", flags);
return 0;
}
@@ -47,12 +47,12 @@
const xcb_query_extension_reply_t *reply =
xcb_get_extension_data(conn, &xcb_xkb_id);
if (!reply) {
- /* log_err_func(ctx, "failed to query for XKB extension\n"); */
+ printf("failed to query for XKB extension\n");
return 0;
}
if (!reply->present) {
- /* log_err_func(ctx, "failed to start using XKB extension: not available in server\n"); */
+ printf("failed to start using XKB extension: not available in server\n");
return 0;
}
@@ -68,20 +68,21 @@
xcb_xkb_use_extension_reply(conn, cookie, &error);
if (!reply) {
- /* log_err_func(ctx, */
- /* "failed to start using XKB extension: error code %d\n", */
- /* error ? error->error_code : -1); */
+ printf(
+ "failed to start using XKB extension: error code %d\n",
+ error ? error->error_code : -1);
free(error);
return 0;
}
- if (!reply->supported) {
- /* log_err_func(ctx, */
- /* "failed to start using XKB extension: server doesn't support version %d.%d\n", */
- /* major_xkb_version, minor_xkb_version); */
- free(reply);
- return 0;
- }
+ // FIXME: Figure out why winit/servo throwing this
+ // if (!reply->supported) {
+ // printf(
+ // "failed to start using XKB extension: server doesn't support version %d.%d\n",
+ // major_xkb_version, minor_xkb_version);
+ // free(reply);
+ // return 0;
+ // }
server_major = reply->serverMajor;
server_minor = reply->serverMinor;

View File

@ -1,6 +1,6 @@
diff -ruwN xorg-server-21.1.16/hw/xfree86/common/xf86Xinput.c source/hw/xfree86/common/xf86Xinput.c
--- xorg-server-21.1.16/hw/xfree86/common/xf86Xinput.c 2025-02-25 11:56:05.000000000 -0700
+++ source/hw/xfree86/common/xf86Xinput.c 2025-05-03 11:28:37.266757877 -0600
diff -ruwN source/hw/xfree86/common/xf86Xinput.c source-new/hw/xfree86/common/xf86Xinput.c
--- source/hw/xfree86/common/xf86Xinput.c 2025-02-26 01:56:05.000000000 +0700
+++ source-new/hw/xfree86/common/xf86Xinput.c 2025-10-28 06:15:47.428141477 +0700
@@ -860,8 +860,10 @@
if (stat(path, &st) == -1)
return;
@ -12,9 +12,9 @@ diff -ruwN xorg-server-21.1.16/hw/xfree86/common/xf86Xinput.c source/hw/xfree86/
}
static inline InputDriverPtr
diff -ruwN xorg-server-21.1.16/hw/xfree86/loader/meson.build source/hw/xfree86/loader/meson.build
--- xorg-server-21.1.16/hw/xfree86/loader/meson.build 2025-02-25 11:56:05.000000000 -0700
+++ source/hw/xfree86/loader/meson.build 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/hw/xfree86/loader/meson.build source-new/hw/xfree86/loader/meson.build
--- source/hw/xfree86/loader/meson.build 2025-02-26 01:56:05.000000000 +0700
+++ source-new/hw/xfree86/loader/meson.build 2025-10-28 06:15:47.428567423 +0700
@@ -10,7 +10,7 @@
c_args: xorg_c_args,
)
@ -27,9 +27,9 @@ diff -ruwN xorg-server-21.1.16/hw/xfree86/loader/meson.build source/hw/xfree86/l
+# 'symbol-test.c',
+# dependencies: dl_dep,
+# )
diff -ruwN xorg-server-21.1.16/hw/xfree86/meson.build source/hw/xfree86/meson.build
--- xorg-server-21.1.16/hw/xfree86/meson.build 2025-02-25 11:56:05.000000000 -0700
+++ source/hw/xfree86/meson.build 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/hw/xfree86/meson.build source-new/hw/xfree86/meson.build
--- source/hw/xfree86/meson.build 2025-02-26 01:56:05.000000000 +0700
+++ source-new/hw/xfree86/meson.build 2025-10-28 06:15:47.428791657 +0700
@@ -171,13 +171,13 @@
)
endif
@ -51,9 +51,9 @@ diff -ruwN xorg-server-21.1.16/hw/xfree86/meson.build source/hw/xfree86/meson.bu
# For symbol presence testing only
xorgserver_lib = shared_library(
diff -ruwN xorg-server-21.1.16/hw/xfree86/os-support/shared/sigio.c source/hw/xfree86/os-support/shared/sigio.c
--- xorg-server-21.1.16/hw/xfree86/os-support/shared/sigio.c 2025-02-25 11:56:05.000000000 -0700
+++ source/hw/xfree86/os-support/shared/sigio.c 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/hw/xfree86/os-support/shared/sigio.c source-new/hw/xfree86/os-support/shared/sigio.c
--- source/hw/xfree86/os-support/shared/sigio.c 2025-02-26 01:56:05.000000000 +0700
+++ source-new/hw/xfree86/os-support/shared/sigio.c 2025-10-28 06:15:47.429003549 +0700
@@ -196,11 +196,12 @@
fd, strerror(errno));
}
@ -68,9 +68,9 @@ diff -ruwN xorg-server-21.1.16/hw/xfree86/os-support/shared/sigio.c source/hw/xf
installed = TRUE;
}
}
diff -ruwN xorg-server-21.1.16/hw/xfree86/os-support/xf86_OSlib.h source/hw/xfree86/os-support/xf86_OSlib.h
--- xorg-server-21.1.16/hw/xfree86/os-support/xf86_OSlib.h 2025-02-25 11:56:05.000000000 -0700
+++ source/hw/xfree86/os-support/xf86_OSlib.h 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/hw/xfree86/os-support/xf86_OSlib.h source-new/hw/xfree86/os-support/xf86_OSlib.h
--- source/hw/xfree86/os-support/xf86_OSlib.h 2025-02-26 01:56:05.000000000 +0700
+++ source-new/hw/xfree86/os-support/xf86_OSlib.h 2025-10-28 06:15:47.429244885 +0700
@@ -176,7 +176,7 @@
/**************************************************************************/
/* Linux or Glibc-based system */
@ -80,9 +80,51 @@ diff -ruwN xorg-server-21.1.16/hw/xfree86/os-support/xf86_OSlib.h source/hw/xfre
#include <sys/ioctl.h>
#include <signal.h>
#include <stdlib.h>
diff -ruwN xorg-server-21.1.16/include/meson.build source/include/meson.build
--- xorg-server-21.1.16/include/meson.build 2025-02-25 11:56:05.000000000 -0700
+++ source/include/meson.build 2025-09-15 08:40:00.484333455 -0600
diff -ruwN source/include/dix.h source-new/include/dix.h
--- source/include/dix.h 2025-02-26 01:56:05.000000000 +0700
+++ source-new/include/dix.h 2025-10-29 14:34:52.026472055 +0700
@@ -55,6 +55,7 @@
#include "geext.h"
#include "events.h"
#include <X11/extensions/XI.h>
+#include <stdio.h>
#define EARLIER -1
#define SAMETIME 0
@@ -69,14 +70,28 @@
#define REQUEST_SIZE_MATCH(req) \
do { \
- if ((sizeof(req) >> 2) != client->req_len) \
+ if ((sizeof(req) >> 2) != client->req_len) { \
+ fprintf(stderr, \
+ "REQUEST_SIZE_MATCH failed in %s:%d: " \
+ "Expected len %lu, got %d\n", \
+ __FILE__, __LINE__, \
+ (unsigned long)(sizeof(req) >> 2), \
+ client->req_len); \
return(BadLength); \
+ } \
} while (0)
#define REQUEST_AT_LEAST_SIZE(req) \
do { \
- if ((sizeof(req) >> 2) > client->req_len) \
+ if ((sizeof(req) >> 2) > client->req_len) { \
+ fprintf(stderr, \
+ "REQUEST_AT_LEAST_SIZE failed in %s:%d: " \
+ "Expected len %lu, got %d\n", \
+ __FILE__, __LINE__, \
+ (unsigned long)(sizeof(req) >> 2), \
+ client->req_len); \
return(BadLength); \
+ } \
} while (0)
#define REQUEST_AT_LEAST_EXTRA_SIZE(req, extra) \
diff -ruwN source/include/meson.build source-new/include/meson.build
--- source/include/meson.build 2025-02-26 01:56:05.000000000 +0700
+++ source-new/include/meson.build 2025-10-28 06:15:47.429576623 +0700
@@ -162,7 +162,7 @@
conf_data.set('HAVE_PORT_CREATE', cc.has_function('port_create') ? '1' : false)
conf_data.set('HAVE_REALLOCARRAY', cc.has_function('reallocarray', dependencies: libbsd_dep) ? '1' : false)
@ -121,9 +163,9 @@ diff -ruwN xorg-server-21.1.16/include/meson.build source/include/meson.build
endif
conf_data.set('HAS_SHM', build_mitshm ? '1' : false)
conf_data.set('MITSHM', build_mitshm ? '1' : false)
diff -ruwN xorg-server-21.1.16/meson.build source/meson.build
--- xorg-server-21.1.16/meson.build 2025-02-25 11:56:05.000000000 -0700
+++ source/meson.build 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/meson.build source-new/meson.build
--- source/meson.build 2025-02-26 01:56:05.000000000 +0700
+++ source-new/meson.build 2025-10-28 06:15:47.429860210 +0700
@@ -753,7 +753,7 @@
subdir('hw')
@ -133,9 +175,9 @@ diff -ruwN xorg-server-21.1.16/meson.build source/meson.build
endif
install_man(configure_file(
diff -ruwN xorg-server-21.1.16/os/access.c source/os/access.c
--- xorg-server-21.1.16/os/access.c 2025-02-25 11:56:05.000000000 -0700
+++ source/os/access.c 2025-05-03 11:28:37.267757875 -0600
diff -ruwN source/os/access.c source-new/os/access.c
--- source/os/access.c 2025-02-26 01:56:05.000000000 +0700
+++ source-new/os/access.c 2025-10-28 06:15:47.430186258 +0700
@@ -120,7 +120,7 @@
#include <sys/un.h>
#endif
@ -145,3 +187,16 @@ diff -ruwN xorg-server-21.1.16/os/access.c source/os/access.c
#include <sys/utsname.h>
#endif
#if defined(SYSV) && defined(__i386__)
diff -ruwN source/Xext/bigreq.c source-new/Xext/bigreq.c
--- source/Xext/bigreq.c 2025-02-26 01:56:05.000000000 +0700
+++ source-new/Xext/bigreq.c 2025-10-29 14:35:38.059611562 +0700
@@ -51,7 +51,8 @@
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
- REQUEST_SIZE_MATCH(xBigReqEnableReq);
+ // libxkbcommon sends incorrect size
+ REQUEST_AT_LEAST_SIZE(xBigReqEnableReq);
client->big_requests = TRUE;
rep = (xBigReqEnableReply) {
.type = X_Reply,