mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 05:35:52 +03:00
Ports: Make the CMake port use the LibUV port
Now that we've ported libuv, we can remove the libuv patches from cmake and make it use the ported libuv.
This commit is contained in:
parent
fcd56f2172
commit
67362b1f85
Notes:
sideshowbarker
2024-07-18 10:00:10 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/67362b1f850 Pull-request: https://github.com/SerenityOS/serenity/pull/8572
@ -4,13 +4,17 @@ version=3.19.4
|
||||
useconfigure=true
|
||||
files="https://github.com/Kitware/CMake/releases/download/v$version/cmake-$version.tar.gz cmake-$version.tar.gz 7d0232b9f1c57e8de81f38071ef8203e6820fe7eec8ae46a1df125d88dbcc2e1"
|
||||
auth_type=sha256
|
||||
depends="bash gcc make sed ncurses"
|
||||
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt"
|
||||
depends="bash make sed ncurses libuv"
|
||||
configopts="-DCMAKE_TOOLCHAIN_FILE=$SERENITY_SOURCE_DIR/Toolchain/CMake/CMakeToolchain.txt -DCMAKE_USE_SYSTEM_LIBRARY_LIBUV=1 -GNinja"
|
||||
|
||||
configure() {
|
||||
run cmake $configopts .
|
||||
}
|
||||
|
||||
install() {
|
||||
run make install
|
||||
build() {
|
||||
run ninja
|
||||
}
|
||||
|
||||
install() {
|
||||
run ninja install
|
||||
}
|
||||
|
@ -1,76 +0,0 @@
|
||||
From d8b3a1a970d92d5e66a7caa3805a56c186027f44 Mon Sep 17 00:00:00 2001
|
||||
From: AnotherTest <ali.mpfard@gmail.com>
|
||||
Date: Fri, 12 Feb 2021 03:12:38 +0330
|
||||
Subject: [PATCH 08/11] unix stuff
|
||||
|
||||
---
|
||||
Utilities/cmlibuv/src/unix/core.c | 26 +++++++++++++++++++++++++-
|
||||
1 file changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/Utilities/cmlibuv/src/unix/core.c b/Utilities/cmlibuv/src/unix/core.c
|
||||
index e6d61ee..f90d9a3 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/core.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/core.c
|
||||
@@ -578,6 +578,14 @@ int uv__close(int fd) {
|
||||
}
|
||||
|
||||
|
||||
+#if defined(_AIX) || \
|
||||
+ defined(__APPLE__) || \
|
||||
+ defined(__DragonFly__) || \
|
||||
+ defined(__FreeBSD__) || \
|
||||
+ defined(__FreeBSD_kernel__) || \
|
||||
+ defined(__linux__) || \
|
||||
+ defined(__OpenBSD__) || \
|
||||
+ defined(__NetBSD__)
|
||||
int uv__nonblock_ioctl(int fd, int set) {
|
||||
int r;
|
||||
|
||||
@@ -590,9 +598,18 @@ int uv__nonblock_ioctl(int fd, int set) {
|
||||
|
||||
return 0;
|
||||
}
|
||||
+#endif
|
||||
|
||||
|
||||
-#if !defined(__hpux) && !defined(__CYGWIN__) && !defined(__MSYS__) && !defined(__HAIKU__)
|
||||
+#if defined(_AIX) || \
|
||||
+ defined(__APPLE__) || \
|
||||
+ defined(__DragonFly__) || \
|
||||
+ defined(__FreeBSD__) || \
|
||||
+ defined(__FreeBSD_kernel__) || \
|
||||
+ defined(__linux__) || \
|
||||
+ defined(__OpenBSD__) || \
|
||||
+ defined(__NetBSD__)
|
||||
+
|
||||
int uv__cloexec_ioctl(int fd, int set) {
|
||||
int r;
|
||||
|
||||
@@ -1422,8 +1439,13 @@ int uv_os_getpriority(uv_pid_t pid, int* priority) {
|
||||
if (priority == NULL)
|
||||
return UV_EINVAL;
|
||||
|
||||
+ /*
|
||||
errno = 0;
|
||||
r = getpriority(PRIO_PROCESS, (int) pid);
|
||||
+ */
|
||||
+
|
||||
+ errno = 0;
|
||||
+ r = 1;
|
||||
|
||||
if (r == -1 && errno != 0)
|
||||
return UV__ERR(errno);
|
||||
@@ -1437,8 +1459,10 @@ int uv_os_setpriority(uv_pid_t pid, int priority) {
|
||||
if (priority < UV_PRIORITY_HIGHEST || priority > UV_PRIORITY_LOW)
|
||||
return UV_EINVAL;
|
||||
|
||||
+ /*
|
||||
if (setpriority(PRIO_PROCESS, (int) pid, priority) != 0)
|
||||
return UV__ERR(errno);
|
||||
+ */
|
||||
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.30.1
|
||||
|
@ -1,199 +0,0 @@
|
||||
From 6939797ada5dbf5545d857cc60cfd5a8ceddb0ae Mon Sep 17 00:00:00 2001
|
||||
From: AnotherTest <ali.mpfard@gmail.com>
|
||||
Date: Fri, 12 Feb 2021 04:49:01 +0330
|
||||
Subject: [PATCH 09/11] purge non-serenity syscalls
|
||||
|
||||
very breaky!
|
||||
---
|
||||
Utilities/cmlibuv/src/unix/fs.c | 31 ++++++++++++++++++++++++++++
|
||||
Utilities/cmlibuv/src/unix/poll.c | 2 ++
|
||||
Utilities/cmlibuv/src/unix/process.c | 2 ++
|
||||
Utilities/cmlibuv/src/unix/stream.c | 3 +--
|
||||
4 files changed, 36 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/Utilities/cmlibuv/src/unix/fs.c b/Utilities/cmlibuv/src/unix/fs.c
|
||||
index 48c0123..fd102a8 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/fs.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/fs.c
|
||||
@@ -85,6 +85,8 @@
|
||||
defined(__HAIKU__) || \
|
||||
defined(__QNX__)
|
||||
# include <sys/statvfs.h>
|
||||
+#elif defined(__serenity__)
|
||||
+// No statfs
|
||||
#else
|
||||
# include <sys/statfs.h>
|
||||
#endif
|
||||
@@ -540,7 +542,11 @@ static ssize_t uv__fs_scandir(uv_fs_t* req) {
|
||||
int n;
|
||||
|
||||
dents = NULL;
|
||||
+#ifndef __serenity__
|
||||
n = scandir(req->path, &dents, uv__fs_scandir_filter, uv__fs_scandir_sort);
|
||||
+#else
|
||||
+ n = 0;
|
||||
+#endif
|
||||
|
||||
/* NOTE: We will use nbufs as an index field */
|
||||
req->nbufs = 0;
|
||||
@@ -651,6 +657,9 @@ static int uv__fs_statfs(uv_fs_t* req) {
|
||||
struct statvfs buf;
|
||||
|
||||
if (0 != statvfs(req->path, &buf))
|
||||
+#elif defined(__serenity__)
|
||||
+ char buf = 0;
|
||||
+ if (1)
|
||||
#else
|
||||
struct statfs buf;
|
||||
|
||||
@@ -658,6 +667,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
|
||||
#endif /* defined(__sun) */
|
||||
return -1;
|
||||
|
||||
+#if !defined(__serenity__)
|
||||
stat_fs = uv__malloc(sizeof(*stat_fs));
|
||||
if (stat_fs == NULL) {
|
||||
errno = ENOMEM;
|
||||
@@ -681,6 +691,7 @@ static int uv__fs_statfs(uv_fs_t* req) {
|
||||
stat_fs->f_files = buf.f_files;
|
||||
stat_fs->f_ffree = buf.f_ffree;
|
||||
req->ptr = stat_fs;
|
||||
+#endif // !defined(__serenity__)
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1107,7 +1118,11 @@ static ssize_t uv__fs_write(uv_fs_t* req) {
|
||||
r = writev(req->file, (struct iovec*) req->bufs, req->nbufs);
|
||||
} else {
|
||||
if (req->nbufs == 1) {
|
||||
+# if defined(__serenity__)
|
||||
+ r = -1;
|
||||
+# else
|
||||
r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off);
|
||||
+# endif
|
||||
goto done;
|
||||
}
|
||||
#if HAVE_PREADV
|
||||
@@ -1117,7 +1132,11 @@ static ssize_t uv__fs_write(uv_fs_t* req) {
|
||||
if (no_pwritev) retry:
|
||||
# endif
|
||||
{
|
||||
+# if defined(__serenity__)
|
||||
+ r = -1;
|
||||
+# else
|
||||
r = pwrite(req->file, req->bufs[0].base, req->bufs[0].len, req->off);
|
||||
+# endif
|
||||
}
|
||||
# if defined(__linux__)
|
||||
else {
|
||||
@@ -1604,7 +1623,9 @@ static void uv__fs_work(struct uv__work* w) {
|
||||
X(COPYFILE, uv__fs_copyfile(req));
|
||||
X(FCHMOD, fchmod(req->file, req->mode));
|
||||
X(FCHOWN, fchown(req->file, req->uid, req->gid));
|
||||
+#ifndef __serenity__
|
||||
X(LCHOWN, lchown(req->path, req->uid, req->gid));
|
||||
+#endif
|
||||
X(FDATASYNC, uv__fs_fdatasync(req));
|
||||
X(FSTAT, uv__fs_fstat(req->file, &req->statbuf));
|
||||
X(FSYNC, uv__fs_fsync(req));
|
||||
@@ -1618,7 +1639,9 @@ static void uv__fs_work(struct uv__work* w) {
|
||||
X(MKSTEMP, uv__fs_mkstemp(req));
|
||||
X(OPEN, uv__fs_open(req));
|
||||
X(READ, uv__fs_read(req));
|
||||
+#ifndef __serenity__
|
||||
X(SCANDIR, uv__fs_scandir(req));
|
||||
+#endif
|
||||
X(OPENDIR, uv__fs_opendir(req));
|
||||
X(READDIR, uv__fs_readdir(req));
|
||||
X(CLOSEDIR, uv__fs_closedir(req));
|
||||
@@ -1628,7 +1651,9 @@ static void uv__fs_work(struct uv__work* w) {
|
||||
X(RMDIR, rmdir(req->path));
|
||||
X(SENDFILE, uv__fs_sendfile(req));
|
||||
X(STAT, uv__fs_stat(req->path, &req->statbuf));
|
||||
+#ifndef __serenity__
|
||||
X(STATFS, uv__fs_statfs(req));
|
||||
+#endif
|
||||
X(SYMLINK, symlink(req->path, req->new_path));
|
||||
X(UNLINK, unlink(req->path));
|
||||
X(UTIME, uv__fs_utime(req));
|
||||
@@ -1743,7 +1768,9 @@ int uv_fs_lchown(uv_loop_t* loop,
|
||||
uv_uid_t uid,
|
||||
uv_gid_t gid,
|
||||
uv_fs_cb cb) {
|
||||
+#ifndef __serenity__
|
||||
INIT(LCHOWN);
|
||||
+#endif
|
||||
PATH;
|
||||
req->uid = uid;
|
||||
req->gid = gid;
|
||||
@@ -1912,7 +1939,9 @@ int uv_fs_scandir(uv_loop_t* loop,
|
||||
const char* path,
|
||||
int flags,
|
||||
uv_fs_cb cb) {
|
||||
+#ifndef __serenity__
|
||||
INIT(SCANDIR);
|
||||
+#endif
|
||||
PATH;
|
||||
req->flags = flags;
|
||||
POST;
|
||||
@@ -2134,7 +2163,9 @@ int uv_fs_statfs(uv_loop_t* loop,
|
||||
uv_fs_t* req,
|
||||
const char* path,
|
||||
uv_fs_cb cb) {
|
||||
+#ifndef __serenity__
|
||||
INIT(STATFS);
|
||||
+#endif
|
||||
PATH;
|
||||
POST;
|
||||
}
|
||||
diff --git a/Utilities/cmlibuv/src/unix/poll.c b/Utilities/cmlibuv/src/unix/poll.c
|
||||
index 3d5022b..721423f 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/poll.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/poll.c
|
||||
@@ -79,9 +79,11 @@ int uv_poll_init(uv_loop_t* loop, uv_poll_t* handle, int fd) {
|
||||
* Workaround for e.g. kqueue fds not supporting ioctls.
|
||||
*/
|
||||
err = uv__nonblock(fd, 1);
|
||||
+#ifndef __serenity__
|
||||
if (err == UV_ENOTTY)
|
||||
if (uv__nonblock == uv__nonblock_ioctl)
|
||||
err = uv__nonblock_fcntl(fd, 1);
|
||||
+#endif
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
diff --git a/Utilities/cmlibuv/src/unix/process.c b/Utilities/cmlibuv/src/unix/process.c
|
||||
index 08aa2f3..135260f 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/process.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/process.c
|
||||
@@ -129,6 +129,8 @@ static int uv__make_socketpair(int fds[2]) {
|
||||
return UV__ERR(errno);
|
||||
|
||||
return 0;
|
||||
+#elif defined(__serenity__)
|
||||
+ return UV__ERR(ENOTSUP);
|
||||
#else
|
||||
int err;
|
||||
|
||||
diff --git a/Utilities/cmlibuv/src/unix/stream.c b/Utilities/cmlibuv/src/unix/stream.c
|
||||
index 3b6da8d..3e2ed5e 100644
|
||||
--- a/Utilities/cmlibuv/src/unix/stream.c
|
||||
+++ b/Utilities/cmlibuv/src/unix/stream.c
|
||||
@@ -985,13 +985,12 @@ uv_handle_type uv__handle_type(int fd) {
|
||||
case AF_UNIX:
|
||||
return UV_NAMED_PIPE;
|
||||
case AF_INET:
|
||||
- case AF_INET6:
|
||||
return UV_TCP;
|
||||
}
|
||||
}
|
||||
|
||||
if (type == SOCK_DGRAM &&
|
||||
- (ss.ss_family == AF_INET || ss.ss_family == AF_INET6))
|
||||
+ (ss.ss_family == AF_INET))
|
||||
return UV_UDP;
|
||||
|
||||
return UV_UNKNOWN_HANDLE;
|
||||
--
|
||||
2.30.1
|
||||
|
@ -1,22 +0,0 @@
|
||||
--- a/Utilities/cmlibuv/src/unix/tcp.c 2021-02-12 22:52:26.980780866 +0330
|
||||
+++ b/Utilities/cmlibuv/src/unix/tcp.c 2021-02-12 22:54:10.670863712 +0330
|
||||
@@ -310,15 +310,19 @@ int uv_tcp_getpeername(const uv_tcp_t* h
|
||||
|
||||
int uv_tcp_close_reset(uv_tcp_t* handle, uv_close_cb close_cb) {
|
||||
int fd;
|
||||
+#ifndef __serenity__
|
||||
struct linger l = { 1, 0 };
|
||||
+#endif
|
||||
|
||||
/* Disallow setting SO_LINGER to zero due to some platform inconsistencies */
|
||||
if (handle->flags & UV_HANDLE_SHUTTING)
|
||||
return UV_EINVAL;
|
||||
|
||||
fd = uv__stream_fd(handle);
|
||||
+#ifndef __serenity__
|
||||
if (0 != setsockopt(fd, SOL_SOCKET, SO_LINGER, &l, sizeof(l)))
|
||||
return UV__ERR(errno);
|
||||
+#endif
|
||||
|
||||
uv_close((uv_handle_t*) handle, close_cb);
|
||||
return 0;
|
@ -1,23 +0,0 @@
|
||||
diff --git a/Utilities/cmlibuv/CMakeLists.txt b/Utilities/cmlibuv/CMakeLists.txt
|
||||
index 92d2411..e6bf241 100644
|
||||
--- a/Utilities/cmlibuv/CMakeLists.txt
|
||||
+++ b/Utilities/cmlibuv/CMakeLists.txt
|
||||
@@ -354,6 +354,18 @@ if(CMAKE_SYSTEM_NAME STREQUAL "QNX")
|
||||
)
|
||||
endif()
|
||||
|
||||
+if (CMAKE_SYSTEM_NAME STREQUAL "SerenityOS")
|
||||
+ list(APPEND uv_headers
|
||||
+ include/uv/posix.h
|
||||
+ )
|
||||
+ list(APPEND uv_sources
|
||||
+ src/unix/posix-hrtime.c
|
||||
+ src/unix/posix-poll.c
|
||||
+ src/unix/no-fsevents.c
|
||||
+ src/unix/no-proctitle.c
|
||||
+ )
|
||||
+endif()
|
||||
+
|
||||
include_directories(
|
||||
${uv_includes}
|
||||
${KWSYS_HEADER_ROOT}
|
@ -1,13 +0,0 @@
|
||||
diff --git a/Utilities/cmlibuv/include/uv/unix.h b/Utilities/cmlibuv/include/uv/unix.h
|
||||
index fb3e97d..a59192f 100644
|
||||
--- a/Utilities/cmlibuv/include/uv/unix.h
|
||||
+++ b/Utilities/cmlibuv/include/uv/unix.h
|
||||
@@ -78,6 +78,8 @@
|
||||
# include "posix.h"
|
||||
#elif defined(__QNX__)
|
||||
# include "posix.h"
|
||||
+#elif defined(__serenity__)
|
||||
+# include "posix.h"
|
||||
#endif
|
||||
|
||||
#ifndef NI_MAXHOST
|
@ -11,27 +11,6 @@ This patch is a big hack to wipe wide strings out of the codebase; naturally, it
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0008-unix-stuff.patch`
|
||||
|
||||
This patch removes the use of `{get,set}priority()` as we do not support it.
|
||||
it also removes two functions with the correct conditions (the same conditions as their dependents are removed with).
|
||||
|
||||
### Status
|
||||
- [X] Local?
|
||||
- [X] Should be merged to upstream? Partially.
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0009-purge-non-serenity-syscalls.patch`
|
||||
|
||||
This patch removes syscalls and options not defined in serenity.
|
||||
|
||||
### Status
|
||||
- [X] Local?
|
||||
- [ ] Should be merged to upstream?
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0010-don-t-use-siginfo.patch`
|
||||
|
||||
We don't support SIGINFO. This patch removes uses of SIGINFO.
|
||||
@ -91,26 +70,6 @@ These two defines make GCC very sad. reasons are unknown at this time.
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0019-libuv-so_linger.patch`
|
||||
|
||||
We don't have `SO_LINGER` or its associated struct. This patch removes them.
|
||||
|
||||
### Status
|
||||
- [X] Local?
|
||||
- [ ] Should be merged to upstream?
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0025-uv-platform.patch`
|
||||
|
||||
This patch adds the definitions necessary to compile libuv on Serenity.
|
||||
|
||||
### Status
|
||||
- [ ] Local?
|
||||
- [X] Should be merged to upstream? If we want to have cmake support serenity out of the box.
|
||||
- [ ] Resolves issue(s) with our side of things
|
||||
- [ ] Hack
|
||||
|
||||
## `0026-curl-struct-stat.patch`
|
||||
|
||||
For unknown reasons, `curl_setup_once.h` does not include `sys/stat.h`. this patch includes `sys/stat.h`.
|
||||
@ -121,16 +80,6 @@ For unknown reasons, `curl_setup_once.h` does not include `sys/stat.h`. this pat
|
||||
- [X] Resolves issue(s) with our side of things
|
||||
- [X] Hack
|
||||
|
||||
## `0027-libuv-platform-serenity.patch`
|
||||
|
||||
This patch adds a platform-specific conditional include to `uv/unix.h`.
|
||||
|
||||
### Status
|
||||
- [ ] Local?
|
||||
- [X] Should be merged to upstream?
|
||||
- [ ] Resolves issue(s) with our side of things
|
||||
- [ ] Hack
|
||||
|
||||
## `0028-cmake-disable-tests.patch`
|
||||
|
||||
We don't care about building tests for now, and it makes the compilation much faster.
|
||||
|
Loading…
Reference in New Issue
Block a user