fix: preserve relibc and wayland build surfaces
This commit is contained in:
@@ -1,18 +1,3 @@
|
|||||||
--- a/src/connection.c
|
|
||||||
+++ b/src/connection.c
|
|
||||||
@@ -40,6 +40,12 @@
|
|
||||||
#include <time.h>
|
|
||||||
#include <ffi.h>
|
|
||||||
|
|
||||||
+#ifndef MSG_NOSIGNAL
|
|
||||||
+#define MSG_NOSIGNAL 0
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+extern FILE *open_memstream(char **bufp, size_t *sizep);
|
|
||||||
+
|
|
||||||
#include "wayland-util.h"
|
|
||||||
#include "wayland-private.h"
|
|
||||||
#include "wayland-os.h"
|
|
||||||
--- a/src/meson.build
|
--- a/src/meson.build
|
||||||
+++ b/src/meson.build
|
+++ b/src/meson.build
|
||||||
@@ -81,8 +81,7 @@
|
@@ -81,8 +81,7 @@
|
||||||
|
|||||||
@@ -0,0 +1,106 @@
|
|||||||
|
diff --git a/include/features.h b/include/features.h
|
||||||
|
index 6d0a0d6..d14516f 100644
|
||||||
|
--- a/include/features.h
|
||||||
|
+++ b/include/features.h
|
||||||
|
@@ -14,6 +14,11 @@
|
||||||
|
#define __RELIBC__MAJOR 0
|
||||||
|
#define __RELIBC__MINOR 2
|
||||||
|
|
||||||
|
+#ifndef __RELIBC_C_LONGDOUBLE_DEFINED
|
||||||
|
+#define __RELIBC_C_LONGDOUBLE_DEFINED 1
|
||||||
|
+typedef long double c_longdouble;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Sources:
|
||||||
|
* https://en.cppreference.com/w/c/language/attributes
|
||||||
|
diff --git a/include/stddef.h b/include/stddef.h
|
||||||
|
index 334267f..bb58d55 100644
|
||||||
|
--- a/include/stddef.h
|
||||||
|
+++ b/include/stddef.h
|
||||||
|
@@ -11,6 +11,11 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
|
||||||
|
|
||||||
|
typedef long unsigned int size_t;
|
||||||
|
|
||||||
|
+#ifndef __RELIBC_C_LONGDOUBLE_DEFINED
|
||||||
|
+#define __RELIBC_C_LONGDOUBLE_DEFINED 1
|
||||||
|
+typedef long double c_longdouble;
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
typedef struct { long long __ll; long double __ld; } max_align_t;
|
||||||
|
|
||||||
|
#define offsetof(type, member) __builtin_offsetof(type, member)
|
||||||
|
diff --git a/src/c/stdlib.c b/src/c/stdlib.c
|
||||||
|
index 62e9810..4040655 100644
|
||||||
|
--- a/src/c/stdlib.c
|
||||||
|
+++ b/src/c/stdlib.c
|
||||||
|
@@ -1,9 +1,5 @@
|
||||||
|
double strtod(const char *nptr, char **endptr);
|
||||||
|
|
||||||
|
-long double strtold(const char *nptr, char **endptr) {
|
||||||
|
- return (long double)strtod(nptr, endptr);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
double relibc_ldtod(const long double* val) {
|
||||||
|
return (double)(*val);
|
||||||
|
}
|
||||||
|
diff --git a/src/header/stdlib/cbindgen.toml b/src/header/stdlib/cbindgen.toml
|
||||||
|
index c105da5..d5bcb23 100644
|
||||||
|
--- a/src/header/stdlib/cbindgen.toml
|
||||||
|
+++ b/src/header/stdlib/cbindgen.toml
|
||||||
|
@@ -1,21 +1,5 @@
|
||||||
|
sys_includes = ["stddef.h", "alloca.h", "wchar.h", "features.h"]
|
||||||
|
include_guard = "_RELIBC_STDLIB_H"
|
||||||
|
-trailer = """
|
||||||
|
-#ifndef _RELIBC_STDLIB_EXTRA_H
|
||||||
|
-#define _RELIBC_STDLIB_EXTRA_H
|
||||||
|
-
|
||||||
|
-#ifdef __cplusplus
|
||||||
|
-extern "C" {
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-long double strtold(const char *nptr, char **endptr);
|
||||||
|
-
|
||||||
|
-#ifdef __cplusplus
|
||||||
|
-}
|
||||||
|
-#endif
|
||||||
|
-
|
||||||
|
-#endif
|
||||||
|
-"""
|
||||||
|
language = "C"
|
||||||
|
style = "Type"
|
||||||
|
no_includes = true
|
||||||
|
diff --git a/src/header/stdlib/mod.rs b/src/header/stdlib/mod.rs
|
||||||
|
index 423ee95..43bc912 100644
|
||||||
|
--- a/src/header/stdlib/mod.rs
|
||||||
|
+++ b/src/header/stdlib/mod.rs
|
||||||
|
@@ -31,7 +31,7 @@ use crate::{
|
||||||
|
platform::{
|
||||||
|
self, Pal, Sys,
|
||||||
|
types::{
|
||||||
|
- c_char, c_double, c_float, c_int, c_long, c_longlong, c_uint, c_ulong, c_ulonglong,
|
||||||
|
+ c_char, c_double, c_float, c_int, c_long, c_longdouble, c_longlong, c_uint, c_ulong, c_ulonglong,
|
||||||
|
c_ushort, c_void, size_t, ssize_t, uintptr_t, wchar_t,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
@@ -1490,12 +1494,19 @@ pub unsafe extern "C" fn strtod(s: *const c_char, endptr: *mut *mut c_char) -> c
|
||||||
|
strto_float_impl!(c_double, s, endptr)
|
||||||
|
}
|
||||||
|
|
||||||
|
-/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtod.html>.
|
||||||
|
+/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtof.html>.
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub unsafe extern "C" fn strtof(s: *const c_char, endptr: *mut *mut c_char) -> c_float {
|
||||||
|
strto_float_impl!(c_float, s, endptr)
|
||||||
|
}
|
||||||
|
|
||||||
|
+/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtod.html>.
|
||||||
|
+#[unsafe(no_mangle)]
|
||||||
|
+pub unsafe extern "C" fn strtold(s: *const c_char, endptr: *mut *mut c_char) -> c_longdouble {
|
||||||
|
+ let result = unsafe { strtod(s, core::ptr::null_mut()) };
|
||||||
|
+ result as c_longdouble
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/// See <https://pubs.opengroup.org/onlinepubs/9799919799/functions/strtol.html>.
|
||||||
|
#[unsafe(no_mangle)]
|
||||||
|
pub unsafe extern "C" fn strtol(s: *const c_char, endptr: *mut *mut c_char, base: c_int) -> c_long {
|
||||||
@@ -26,7 +26,7 @@ new file mode 100644
|
|||||||
index 0000000..9ab9496
|
index 0000000..9ab9496
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/src/header/threads/mod.rs
|
+++ b/src/header/threads/mod.rs
|
||||||
@@ -0,0 +1,31 @@
|
@@ -0,0 +1,36 @@
|
||||||
+//! `threads.h` implementation — C11 threads type definitions and constants.
|
+//! `threads.h` implementation — C11 threads type definitions and constants.
|
||||||
+//!
|
+//!
|
||||||
+//! Full C11 threads API (thrd_create, mtx_lock, cnd_wait, etc.) requires
|
+//! Full C11 threads API (thrd_create, mtx_lock, cnd_wait, etc.) requires
|
||||||
@@ -58,3 +58,8 @@ index 0000000..9ab9496
|
|||||||
+
|
+
|
||||||
+#[unsafe(no_mangle)]
|
+#[unsafe(no_mangle)]
|
||||||
+pub unsafe extern "C" fn thrd_yield() {}
|
+pub unsafe extern "C" fn thrd_yield() {}
|
||||||
|
+
|
||||||
|
+#[unsafe(no_mangle)]
|
||||||
|
+pub unsafe extern "C" fn thrd_exit(_ret: *mut c_int) -> ! {
|
||||||
|
+ loop {}
|
||||||
|
+}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#TODO: Requires Redox compatibility patching for missing Linux header paths and
|
#TODO: Requires a narrow Redox delta for native scanner discovery during
|
||||||
# some POSIX/Linux-only flags during cross-builds.
|
# cross-builds and a userspace eventfd fallback because relibc lacks sys/eventfd.h.
|
||||||
# redox.patch restores the Redox compatibility stubs plus Meson scanner detection.
|
# redox.patch keeps only the active scanner/eventfd compatibility surface.
|
||||||
[source]
|
[source]
|
||||||
tar = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.24.0/downloads/wayland-1.24.0.tar.xz"
|
tar = "https://gitlab.freedesktop.org/wayland/wayland/-/releases/1.24.0/downloads/wayland-1.24.0.tar.xz"
|
||||||
patches = ["redox.patch"]
|
patches = ["redox.patch"]
|
||||||
@@ -26,7 +26,12 @@ COOKBOOK_MESON_FLAGS=(
|
|||||||
-Ddefault_library=static
|
-Ddefault_library=static
|
||||||
-Dprefix=/usr
|
-Dprefix=/usr
|
||||||
)
|
)
|
||||||
cookbook_meson -Ddocumentation=false -Dtests=false -Ddtd_validation=false -Dscanner=false -Dc_args=-Wno-error
|
cookbook_meson \
|
||||||
|
-Ddocumentation=false \
|
||||||
|
-Dtests=false \
|
||||||
|
-Ddtd_validation=false \
|
||||||
|
-Dscanner=false \
|
||||||
|
-Dc_args="['-I${COOKBOOK_SYSROOT}/include','-Wno-error']"
|
||||||
|
|
||||||
for pc in "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-client.pc" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-server.pc"; do
|
for pc in "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-client.pc" "${COOKBOOK_STAGE}/usr/lib/pkgconfig/wayland-server.pc"; do
|
||||||
if [ -f "$pc" ]; then
|
if [ -f "$pc" ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user