mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-09 05:10:05 +02:00
Ladybird: add recipe
This commit is contained in:
30
www-client/ladybird/additional-files/ladybird.rdef
Normal file
30
www-client/ladybird/additional-files/ladybird.rdef
Normal file
@@ -0,0 +1,30 @@
|
||||
|
||||
resource app_flags B_MULTIPLE_LAUNCH;
|
||||
|
||||
resource app_version {
|
||||
major = 0,
|
||||
middle = 0,
|
||||
minor = 0,
|
||||
variety = B_APPV_DEVELOPMENT,
|
||||
internal = 0,
|
||||
short_info = "Ladybird",
|
||||
long_info = "The Ladybird Web Browser using the SerenityOS LibWeb engine with a Qt GUI"
|
||||
};
|
||||
|
||||
resource app_signature "application/x-vnd.ladybird";
|
||||
|
||||
resource vector_icon {
|
||||
$"6E6369660505010201060640600000000000000040300048400048000001FFC7"
|
||||
$"C774FB2A2A97FD1818BEFE0808DAFF0606F8DB2D0A04018D0200000250010000"
|
||||
$"80D0010000FF05FF0A02043D24C36524B9B624243A262E22C22237542B55C022"
|
||||
$"C7634D40C2C1C4B754300202372C3C2C322C373332333C3306033A3228523C4A"
|
||||
$"285631BFD7B34400024727C401B4F3402B2F542E4D305B04032E523E583BC84B"
|
||||
$"BE035C3A5E3E04032E4C4A524AC618C367574C565104032E42554755C1BF54C3"
|
||||
$"5756495B04032E2F2A2D262D292D22322304032E26382233B399BB5BB3FFB9C3"
|
||||
$"272E04032E26482345B4C745214521480C0A02010002402E8B0000000000003D"
|
||||
$"B13B4668BA4A02760A00010030222201178400040A0101002022220A00010310"
|
||||
$"01178300040A000101201C250A0001012016320A000101202C2E0A0001012024"
|
||||
$"390A030102000A040101023E29983C00CDBBD7AB3E12F5493938C565E20A0401"
|
||||
$"01023CD23C3DD777BDAF413CB4B44AB872C249950A0006040506070809100117"
|
||||
$"820004"
|
||||
};
|
||||
69
www-client/ladybird/ladybird-pre20220725.recipe
Normal file
69
www-client/ladybird/ladybird-pre20220725.recipe
Normal file
@@ -0,0 +1,69 @@
|
||||
SUMMARY="A browser using the SerenityOS LibWeb engine with a Qt GUI"
|
||||
DESCRIPTION="The Ladybird Web Browser is a browser using the SerenityOS LibWeb engine with a Qt GUI."
|
||||
HOMEPAGE="https://github.com/awesomekling/ladybird/"
|
||||
COPYRIGHT="2022 Andreas Kling"
|
||||
LICENSE="BSD (2-clause)"
|
||||
REVISION="1"
|
||||
srvGitRev="9e3a1f47d484cee6f23c4dae6c51750af155a8fc"
|
||||
SOURCE_URI="https://github.com/awesomekling/ladybird/archive/$srvGitRev.tar.gz"
|
||||
CHECKSUM_SHA256="65aa7fda09cbee902a4d8d59557f2d76d5fae047049328210a174cc846f49288"
|
||||
SOURCE_DIR="ladybird-$srvGitRev"
|
||||
srvGitRev2="c2a1817c704a2e7109c823c8b847731e12f647e9"
|
||||
SOURCE_URI_2="https://github.com/SerenityOS/serenity/archive/$srvGitRev2.tar.gz"
|
||||
CHECKSUM_SHA256_2="399f2c904fc8eb9e02658a9b82ecbe80cb0a5d772688dc550c76e84db4894fc6"
|
||||
SOURCE_DIR_2="serenity-$srvGitRev2"
|
||||
PATCHES="ladybird-$portVersion.patchset"
|
||||
PATCHES_2="serenity-$portVersion.patchset"
|
||||
ADDITIONAL_FILES="ladybird.rdef"
|
||||
|
||||
ARCHITECTURES="!x86_gcc2 x86_64"
|
||||
SECONDARY_ARCHITECTURES="?x86"
|
||||
|
||||
PROVIDES="
|
||||
ladybird$secondaryArchSuffix = $portVersion
|
||||
app:Ladybird = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libGL$secondaryArchSuffix
|
||||
lib:libQt6Core$secondaryArchSuffix
|
||||
lib:libQt6Gui$secondaryArchSuffix
|
||||
lib:libQt6Network$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libQt6Core$secondaryArchSuffix
|
||||
devel:libQt6Gui$secondaryArchSuffix
|
||||
devel:libQt6Network$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:cmake
|
||||
cmd:g++$secondaryArchSuffix
|
||||
cmd:ninja
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
cmake -GNinja -B Build \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DSERENITY_SOURCE_DIR=$sourceDir2
|
||||
|
||||
ninja -C Build
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
mkdir -p $appsDir/Ladibird/lib
|
||||
|
||||
cp -r Build/ladybird $appsDir/Ladibird/Ladibird
|
||||
cp -r Build/_deps/lagom-build/*.so* $appsDir/Ladibird/lib
|
||||
cp -r $sourceDir2/Base/res $appsDir/Ladibird
|
||||
|
||||
strip $appsDir/Ladibird/Ladibird
|
||||
strip $appsDir/Ladibird/lib/*.so*
|
||||
|
||||
addResourcesToBinaries $portDir/additional-files/ladybird.rdef $appsDir/Ladibird/Ladibird
|
||||
addAppDeskbarSymlink $appsDir/Ladibird/Ladibird
|
||||
}
|
||||
60
www-client/ladybird/patches/ladybird-pre20220725.patchset
Normal file
60
www-client/ladybird/patches/ladybird-pre20220725.patchset
Normal file
@@ -0,0 +1,60 @@
|
||||
From c895179ca2f9d9d8a87059cc5b70085dd7384681 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Fri, 22 Jul 2022 21:34:16 +1000
|
||||
Subject: Fix build for Haiku
|
||||
|
||||
|
||||
diff --git a/cmake/EnableLLD.cmake b/cmake/EnableLLD.cmake
|
||||
index ce0f107..60ba806 100644
|
||||
--- a/cmake/EnableLLD.cmake
|
||||
+++ b/cmake/EnableLLD.cmake
|
||||
@@ -3,14 +3,14 @@
|
||||
# SPDX-License-Identifier: BSD-2-Clause
|
||||
#
|
||||
option(LADYBIRD_USE_LLD "Use llvm lld to link application" ON)
|
||||
-if (LADYBIRD_USE_LLD AND NOT APPLE)
|
||||
+if (LADYBIRD_USE_LLD AND NOT APPLE AND NOT HAIKU)
|
||||
find_program(LLD_LINKER NAMES "ld.lld")
|
||||
if (NOT LLD_LINKER)
|
||||
message(INFO "LLD not found, cannot use to link. Disabling option...")
|
||||
set(LADYBIRD_USE_LLD OFF CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
-if (LADYBIRD_USE_LLD AND NOT APPLE)
|
||||
+if (LADYBIRD_USE_LLD AND NOT APPLE AND NOT HAIKU)
|
||||
add_link_options(-fuse-ld=lld)
|
||||
add_compile_options(-ggnu-pubnames)
|
||||
add_link_options(LINKER:--gdb-index)
|
||||
--
|
||||
2.36.1
|
||||
|
||||
|
||||
From 40e9da08790693d75bc4b1ee2c0e098e3e1b487b Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Fri, 22 Jul 2022 21:34:38 +1000
|
||||
Subject: Disable tooltips
|
||||
|
||||
|
||||
diff --git a/Tab.cpp b/Tab.cpp
|
||||
index 8f0d8cc..1b02266 100644
|
||||
--- a/Tab.cpp
|
||||
+++ b/Tab.cpp
|
||||
@@ -51,6 +51,7 @@ Tab::Tab(QMainWindow* window)
|
||||
m_toolbar->addAction(m_home_action);
|
||||
m_toolbar->addWidget(m_location_edit);
|
||||
|
||||
+#ifndef __HAIKU__
|
||||
QObject::connect(m_view, &WebView::linkHovered, [this](const QString& title) {
|
||||
const QPoint* pos = new QPoint(0, size().height() - 15);
|
||||
QToolTip::showText(*pos, title, this);
|
||||
@@ -58,6 +59,7 @@ Tab::Tab(QMainWindow* window)
|
||||
QObject::connect(m_view, &WebView::linkUnhovered, [] {
|
||||
QToolTip::hideText();
|
||||
});
|
||||
+#endif
|
||||
|
||||
QObject::connect(m_view, &WebView::loadStarted, [this](const URL& url) {
|
||||
m_location_edit->setText(url.to_string().characters());
|
||||
--
|
||||
2.36.1
|
||||
|
||||
433
www-client/ladybird/patches/serenity-pre20220725.patchset
Normal file
433
www-client/ladybird/patches/serenity-pre20220725.patchset
Normal file
@@ -0,0 +1,433 @@
|
||||
From b63ad85468c426e836d14b3cba93f55817321214 Mon Sep 17 00:00:00 2001
|
||||
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
||||
Date: Fri, 22 Jul 2022 21:35:26 +1000
|
||||
Subject: Fix build for Haiku
|
||||
|
||||
|
||||
diff --git a/AK/Random.h b/AK/Random.h
|
||||
index fe5961c..c987470 100644
|
||||
--- a/AK/Random.h
|
||||
+++ b/AK/Random.h
|
||||
@@ -17,6 +17,11 @@
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
+#if defined(__HAIKU__)
|
||||
+# include <unistd.h>
|
||||
+# include <fcntl.h>
|
||||
+#endif
|
||||
+
|
||||
#if defined(AK_OS_MACOS)
|
||||
# include <sys/random.h>
|
||||
#endif
|
||||
@@ -27,6 +32,10 @@ inline void fill_with_random([[maybe_unused]] void* buffer, [[maybe_unused]] siz
|
||||
{
|
||||
#if defined(__serenity__) || defined(AK_OS_ANDROID)
|
||||
arc4random_buf(buffer, length);
|
||||
+#elif defined(__HAIKU__)
|
||||
+ int fd = open("/dev/random", O_RDONLY);
|
||||
+ read(fd, buffer, length);
|
||||
+ close(fd);
|
||||
#elif defined(OSS_FUZZ)
|
||||
#elif defined(__unix__) or defined(AK_OS_MACOS)
|
||||
[[maybe_unused]] int rc = getentropy(buffer, length);
|
||||
diff --git a/AK/StackInfo.cpp b/AK/StackInfo.cpp
|
||||
index 4f53947..3b46bd7 100644
|
||||
--- a/AK/StackInfo.cpp
|
||||
+++ b/AK/StackInfo.cpp
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#ifdef __serenity__
|
||||
# include <serenity.h>
|
||||
-#elif defined(__linux__) or defined(AK_OS_MACOS)
|
||||
+#elif defined(__linux__) || defined(AK_OS_MACOS) || defined(__HAIKU__)
|
||||
# include <pthread.h>
|
||||
#elif defined(__FreeBSD__)
|
||||
# include <pthread.h>
|
||||
@@ -50,6 +50,18 @@ StackInfo::StackInfo()
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
pthread_attr_destroy(&attr);
|
||||
+#elif defined(__HAIKU__)
|
||||
+ int rc;
|
||||
+ pthread_attr_t attr;
|
||||
+ if ((rc = pthread_attr_init(&attr)) != 0) {
|
||||
+ fprintf(stderr, "pthread_attr_init: %s\n", strerror(-rc));
|
||||
+ VERIFY_NOT_REACHED();
|
||||
+ }
|
||||
+ if ((rc = pthread_attr_getstack(&attr, (void**)&m_base, &m_size)) != 0) {
|
||||
+ fprintf(stderr, "pthread_attr_getstack: %s\n", strerror(-rc));
|
||||
+ VERIFY_NOT_REACHED();
|
||||
+ }
|
||||
+ pthread_attr_destroy(&attr);
|
||||
#elif defined(AK_OS_MACOS)
|
||||
// NOTE: !! On MacOS, pthread_get_stackaddr_np gives the TOP of the stack, not the bottom!
|
||||
FlatPtr top_of_stack = (FlatPtr)pthread_get_stackaddr_np(pthread_self());
|
||||
diff --git a/AK/Time.cpp b/AK/Time.cpp
|
||||
index bb01b1e..ef4ceca 100644
|
||||
--- a/AK/Time.cpp
|
||||
+++ b/AK/Time.cpp
|
||||
@@ -16,6 +16,11 @@
|
||||
# include <time.h>
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+# define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
|
||||
+# define CLOCK_REALTIME_COARSE CLOCK_REALTIME
|
||||
+#endif
|
||||
+
|
||||
namespace AK {
|
||||
|
||||
int days_in_month(int year, unsigned month)
|
||||
diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt
|
||||
index 9e23947..06de2ad 100644
|
||||
--- a/Meta/Lagom/CMakeLists.txt
|
||||
+++ b/Meta/Lagom/CMakeLists.txt
|
||||
@@ -267,10 +267,14 @@ lagom_lib(Core core
|
||||
SOURCES ${AK_SOURCES} ${LIBCORE_SOURCES}
|
||||
LIBS Threads::Threads
|
||||
)
|
||||
-if (NOT APPLE AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
+if (NOT APPLE AND NOT HAIKU AND NOT ANDROID AND NOT ${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
|
||||
target_link_libraries(LibCore crypt) # LibCore::Account uses crypt() but it's not in libcrypt on macOS
|
||||
endif()
|
||||
|
||||
+if (HAIKU)
|
||||
+ target_link_libraries(LibCore network)
|
||||
+endif()
|
||||
+
|
||||
# LibMain
|
||||
file(GLOB LIBMAIN_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibMain/*.cpp")
|
||||
lagom_lib(Main main
|
||||
@@ -376,10 +380,14 @@ if (BUILD_LAGOM)
|
||||
|
||||
# GPU
|
||||
file(GLOB LIBGPU_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGPU/*.cpp")
|
||||
+ if (HAIKU)
|
||||
+ lagom_lib(GPU gpu SOURCES ${LIBGPU_SOURCES})
|
||||
+ else()
|
||||
lagom_lib(GPU gpu
|
||||
SOURCES ${LIBGPU_SOURCES}
|
||||
LIBS dl
|
||||
)
|
||||
+ endif()
|
||||
|
||||
# GL
|
||||
file(GLOB LIBGL_SOURCES CONFIGURE_DEPENDS "../../Userland/Libraries/LibGL/*.cpp")
|
||||
diff --git a/Userland/Libraries/LibC/regex.h b/Userland/Libraries/LibC/regex.h
|
||||
index a850a43..92f574c 100644
|
||||
--- a/Userland/Libraries/LibC/regex.h
|
||||
+++ b/Userland/Libraries/LibC/regex.h
|
||||
@@ -8,6 +8,10 @@
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
+#ifdef __HAIKU__
|
||||
+#include <size_t.h>
|
||||
+#include <sys/cdefs.h>
|
||||
+#endif
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
diff --git a/Userland/Libraries/LibCore/Account.cpp b/Userland/Libraries/LibCore/Account.cpp
|
||||
index a7e34e3..1fc7d29 100644
|
||||
--- a/Userland/Libraries/LibCore/Account.cpp
|
||||
+++ b/Userland/Libraries/LibCore/Account.cpp
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <errno.h>
|
||||
#include <grp.h>
|
||||
#include <pwd.h>
|
||||
-#ifndef AK_OS_BSD_GENERIC
|
||||
+#if !defined(AK_OS_BSD_GENERIC) && !defined(__HAIKU__)
|
||||
# include <crypt.h>
|
||||
# include <shadow.h>
|
||||
#endif
|
||||
diff --git a/Userland/Libraries/LibCore/AnonymousBuffer.cpp b/Userland/Libraries/LibCore/AnonymousBuffer.cpp
|
||||
index 2385b83..4044000 100644
|
||||
--- a/Userland/Libraries/LibCore/AnonymousBuffer.cpp
|
||||
+++ b/Userland/Libraries/LibCore/AnonymousBuffer.cpp
|
||||
@@ -11,6 +11,10 @@
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+# define MAP_FILE 0
|
||||
+#endif
|
||||
+
|
||||
namespace Core {
|
||||
|
||||
ErrorOr<AnonymousBuffer> AnonymousBuffer::create_with_size(size_t size)
|
||||
diff --git a/Userland/Libraries/LibCore/ElapsedTimer.cpp b/Userland/Libraries/LibCore/ElapsedTimer.cpp
|
||||
index d37398f..83b90b3 100644
|
||||
--- a/Userland/Libraries/LibCore/ElapsedTimer.cpp
|
||||
+++ b/Userland/Libraries/LibCore/ElapsedTimer.cpp
|
||||
@@ -10,6 +10,10 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+#define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC
|
||||
+#endif
|
||||
+
|
||||
namespace Core {
|
||||
|
||||
ElapsedTimer ElapsedTimer::start_new()
|
||||
diff --git a/Userland/Libraries/LibCore/Group.cpp b/Userland/Libraries/LibCore/Group.cpp
|
||||
index e38aace..8cb875d 100644
|
||||
--- a/Userland/Libraries/LibCore/Group.cpp
|
||||
+++ b/Userland/Libraries/LibCore/Group.cpp
|
||||
@@ -16,7 +16,7 @@ ErrorOr<void> Group::add_group(Group& group)
|
||||
{
|
||||
if (group.name().is_empty())
|
||||
return Error::from_string_literal("Group name can not be empty.");
|
||||
-
|
||||
+#ifndef __HAIKU__
|
||||
// A quick sanity check on group name
|
||||
if (strpbrk(group.name().characters(), "\\/!@#$%^&*()~+=`:\n"))
|
||||
return Error::from_string_literal("Group name has invalid characters.");
|
||||
@@ -55,7 +55,7 @@ ErrorOr<void> Group::add_group(Group& group)
|
||||
|
||||
if (putgrent(&gr, file) < 0)
|
||||
return Error::from_errno(errno);
|
||||
-
|
||||
+#endif
|
||||
return {};
|
||||
}
|
||||
#endif
|
||||
diff --git a/Userland/Libraries/LibCore/LocalServer.cpp b/Userland/Libraries/LibCore/LocalServer.cpp
|
||||
index 6430fd6..dd99908 100644
|
||||
--- a/Userland/Libraries/LibCore/LocalServer.cpp
|
||||
+++ b/Userland/Libraries/LibCore/LocalServer.cpp
|
||||
@@ -114,7 +114,7 @@ ErrorOr<NonnullOwnPtr<Stream::LocalSocket>> LocalServer::accept()
|
||||
VERIFY(m_listening);
|
||||
sockaddr_un un;
|
||||
socklen_t un_size = sizeof(un);
|
||||
-#ifndef AK_OS_MACOS
|
||||
+#if !defined(AK_OS_MACOS) && !defined(__HAIKU__)
|
||||
int accepted_fd = ::accept4(m_fd, (sockaddr*)&un, &un_size, SOCK_NONBLOCK | SOCK_CLOEXEC);
|
||||
#else
|
||||
int accepted_fd = ::accept(m_fd, (sockaddr*)&un, &un_size);
|
||||
diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp
|
||||
index 459ac94..070cb99 100644
|
||||
--- a/Userland/Libraries/LibCore/System.cpp
|
||||
+++ b/Userland/Libraries/LibCore/System.cpp
|
||||
@@ -19,7 +19,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/mman.h>
|
||||
+#ifndef __HAIKU__
|
||||
#include <sys/ptrace.h>
|
||||
+#endif
|
||||
#include <sys/time.h>
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
@@ -39,7 +41,7 @@ static int memfd_create(char const* name, unsigned int flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#if defined(__APPLE__)
|
||||
+#if defined(__APPLE__) || defined(__HAIKU__)
|
||||
# include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
@@ -208,7 +210,7 @@ ErrorOr<Optional<struct spwd>> getspnam(StringView name)
|
||||
}
|
||||
#endif
|
||||
|
||||
-#ifndef AK_OS_MACOS
|
||||
+#if !defined(AK_OS_MACOS) && !defined(__HAIKU__)
|
||||
ErrorOr<int> accept4(int sockfd, sockaddr* address, socklen_t* address_length, int flags)
|
||||
{
|
||||
auto fd = ::accept4(sockfd, address, address_length, flags);
|
||||
@@ -298,6 +300,33 @@ ErrorOr<int> anon_create([[maybe_unused]] size_t size, [[maybe_unused]] int opti
|
||||
TRY(close(fd));
|
||||
return Error::from_errno(saved_errno);
|
||||
}
|
||||
+#elif defined(__HAIKU__)
|
||||
+ struct timespec time;
|
||||
+ clock_gettime(CLOCK_REALTIME, &time);
|
||||
+ auto name = String::formatted("/tmp/shm-{}{}", (unsigned long)time.tv_sec, (unsigned long)time.tv_nsec);
|
||||
+ fd = shm_open(name.characters(), O_RDWR | O_CREAT | options, 0600);
|
||||
+
|
||||
+ if (shm_unlink(name.characters()) == -1) {
|
||||
+ auto saved_errno = errno;
|
||||
+ TRY(close(fd));
|
||||
+ return Error::from_errno(saved_errno);
|
||||
+ }
|
||||
+
|
||||
+ if (fd < 0)
|
||||
+ return Error::from_errno(errno);
|
||||
+
|
||||
+ if (::ftruncate(fd, size) < 0) {
|
||||
+ auto saved_errno = errno;
|
||||
+ TRY(close(fd));
|
||||
+ return Error::from_errno(saved_errno);
|
||||
+ }
|
||||
+
|
||||
+ void* addr = ::mmap(NULL, size, PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
+ if (addr == MAP_FAILED) {
|
||||
+ auto saved_errno = errno;
|
||||
+ TRY(close(fd));
|
||||
+ return Error::from_errno(saved_errno);
|
||||
+ }
|
||||
#elif defined(__APPLE__)
|
||||
struct timespec time;
|
||||
clock_gettime(CLOCK_REALTIME, &time);
|
||||
@@ -492,7 +521,7 @@ ErrorOr<void> ioctl(int fd, unsigned request, ...)
|
||||
va_start(ap, request);
|
||||
FlatPtr arg = va_arg(ap, FlatPtr);
|
||||
va_end(ap);
|
||||
- if (::ioctl(fd, request, arg) < 0)
|
||||
+ if (::ioctl(fd, request, (void*)arg) < 0)
|
||||
return Error::from_syscall("ioctl"sv, -errno);
|
||||
return {};
|
||||
}
|
||||
@@ -918,7 +947,7 @@ ErrorOr<struct utsname> uname()
|
||||
return uts;
|
||||
}
|
||||
|
||||
-#ifndef AK_OS_ANDROID
|
||||
+#if !defined(AK_OS_ANDROID) && !defined(__HAIKU__)
|
||||
ErrorOr<void> adjtime(const struct timeval* delta, struct timeval* old_delta)
|
||||
{
|
||||
# ifdef __serenity__
|
||||
diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h
|
||||
index d183682..a109681 100644
|
||||
--- a/Userland/Libraries/LibCore/System.h
|
||||
+++ b/Userland/Libraries/LibCore/System.h
|
||||
@@ -87,6 +87,10 @@ ErrorOr<Optional<struct spwd>> getspnam(StringView name);
|
||||
ErrorOr<int> accept4(int sockfd, struct sockaddr*, socklen_t*, int flags);
|
||||
#endif
|
||||
|
||||
+#ifdef __HAIKU__
|
||||
+typedef void (*sighandler_t)(int);
|
||||
+#endif
|
||||
+
|
||||
ErrorOr<void> sigaction(int signal, struct sigaction const* action, struct sigaction* old_action);
|
||||
#if defined(__APPLE__) || defined(__OpenBSD__) || defined(__FreeBSD__)
|
||||
ErrorOr<sig_t> signal(int signal, sig_t handler);
|
||||
@@ -157,7 +161,7 @@ ErrorOr<void> unlink(StringView path);
|
||||
ErrorOr<void> utime(StringView path, Optional<struct utimbuf>);
|
||||
ErrorOr<struct utsname> uname();
|
||||
ErrorOr<Array<int, 2>> pipe2(int flags);
|
||||
-#ifndef AK_OS_ANDROID
|
||||
+#if !defined(AK_OS_ANDROID) && !defined(__HAIKU__)
|
||||
ErrorOr<void> adjtime(const struct timeval* delta, struct timeval* old_delta);
|
||||
#endif
|
||||
ErrorOr<String> find_file_in_path(StringView filename);
|
||||
diff --git a/Userland/Libraries/LibCore/TCPServer.cpp b/Userland/Libraries/LibCore/TCPServer.cpp
|
||||
index 1402a00..e9d1a10 100644
|
||||
--- a/Userland/Libraries/LibCore/TCPServer.cpp
|
||||
+++ b/Userland/Libraries/LibCore/TCPServer.cpp
|
||||
@@ -73,7 +73,7 @@ ErrorOr<NonnullOwnPtr<Stream::TCPSocket>> TCPServer::accept()
|
||||
VERIFY(m_listening);
|
||||
sockaddr_in in;
|
||||
socklen_t in_size = sizeof(in);
|
||||
-#ifndef AK_OS_MACOS
|
||||
+#if !defined(AK_OS_MACOS) && !defined(__HAIKU__)
|
||||
int accepted_fd = TRY(Core::System::accept4(m_fd, (sockaddr*)&in, &in_size, SOCK_NONBLOCK | SOCK_CLOEXEC));
|
||||
#else
|
||||
int accepted_fd = TRY(Core::System::accept(m_fd, (sockaddr*)&in, &in_size));
|
||||
diff --git a/Userland/Libraries/LibLine/Editor.cpp b/Userland/Libraries/LibLine/Editor.cpp
|
||||
index c10c249..56516c2 100644
|
||||
--- a/Userland/Libraries/LibLine/Editor.cpp
|
||||
+++ b/Userland/Libraries/LibLine/Editor.cpp
|
||||
@@ -177,7 +177,7 @@ void Editor::set_default_keybinds()
|
||||
|
||||
// Register these last to all the user to override the previous key bindings
|
||||
// Normally ^W. `stty werase \^n` can change it to ^N (or something else).
|
||||
- register_key_input_callback(m_termios.c_cc[VWERASE], EDITOR_INTERNAL_FUNCTION(erase_word_backwards));
|
||||
+ //register_key_input_callback(m_termios.c_cc[VWERASE], EDITOR_INTERNAL_FUNCTION(erase_word_backwards));
|
||||
// Normally ^U. `stty kill \^n` can change it to ^N (or something else).
|
||||
register_key_input_callback(m_termios.c_cc[VKILL], EDITOR_INTERNAL_FUNCTION(kill_line));
|
||||
register_key_input_callback(m_termios.c_cc[VERASE], EDITOR_INTERNAL_FUNCTION(erase_character_backwards));
|
||||
diff --git a/Userland/Libraries/LibTest/CrashTest.cpp b/Userland/Libraries/LibTest/CrashTest.cpp
|
||||
index f77a1de..5fe0ef0 100644
|
||||
--- a/Userland/Libraries/LibTest/CrashTest.cpp
|
||||
+++ b/Userland/Libraries/LibTest/CrashTest.cpp
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
-#ifndef AK_OS_MACOS
|
||||
+#if !defined(AK_OS_MACOS) && !defined(__HAIKU__)
|
||||
# include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,7 @@ bool Crash::run(RunType run_type)
|
||||
perror("fork");
|
||||
VERIFY_NOT_REACHED();
|
||||
} else if (pid == 0) {
|
||||
-#ifndef AK_OS_MACOS
|
||||
+#if !defined(AK_OS_MACOS) && !defined(__HAIKU__)
|
||||
if (prctl(PR_SET_DUMPABLE, 0, 0) < 0)
|
||||
perror("prctl(PR_SET_DUMPABLE)");
|
||||
#endif
|
||||
diff --git a/Userland/Utilities/ntpquery.cpp b/Userland/Utilities/ntpquery.cpp
|
||||
index 11e8a47..8e7863e 100644
|
||||
--- a/Userland/Utilities/ntpquery.cpp
|
||||
+++ b/Userland/Utilities/ntpquery.cpp
|
||||
@@ -160,13 +160,13 @@ int main(int argc, char** argv)
|
||||
perror("setsockopt");
|
||||
return 1;
|
||||
}
|
||||
-
|
||||
+#ifndef __HAIKU__
|
||||
int enable = 1;
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_TIMESTAMP, &enable, sizeof(enable)) < 0) {
|
||||
perror("setsockopt");
|
||||
return 1;
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
sockaddr_in peer_address;
|
||||
memset(&peer_address, 0, sizeof(peer_address));
|
||||
peer_address.sin_family = AF_INET;
|
||||
@@ -213,7 +213,9 @@ int main(int argc, char** argv)
|
||||
|
||||
cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
|
||||
VERIFY(cmsg->cmsg_level == SOL_SOCKET);
|
||||
+#ifndef __HAIKU__
|
||||
VERIFY(cmsg->cmsg_type == SCM_TIMESTAMP);
|
||||
+#endif
|
||||
VERIFY(!CMSG_NXTHDR(&msg, cmsg));
|
||||
timeval kernel_receive_time;
|
||||
memcpy(&kernel_receive_time, CMSG_DATA(cmsg), sizeof(kernel_receive_time));
|
||||
@@ -247,7 +249,7 @@ int main(int argc, char** argv)
|
||||
|
||||
timeval kernel_to_userspace_latency;
|
||||
timersub(&userspace_receive_time, &kernel_receive_time, &kernel_to_userspace_latency);
|
||||
-
|
||||
+#ifndef __HAIKU__
|
||||
if (set_time) {
|
||||
// FIXME: Do all the time filtering described in 5905, or at least correct for time of flight.
|
||||
timeval t = timeval_from_ntp_timestamp(transmit_timestamp);
|
||||
@@ -256,7 +258,7 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
if (verbose) {
|
||||
outln("NTP response from {}:", inet_ntoa(peer_address.sin_addr));
|
||||
outln("Leap Information: {}", packet.leap_information());
|
||||
@@ -307,7 +309,7 @@ int main(int argc, char** argv)
|
||||
if (verbose)
|
||||
outln("Delay: {}", delay_s);
|
||||
outln("Offset: {}", offset_s);
|
||||
-
|
||||
+#ifndef __HAIKU__
|
||||
if (adjust_time) {
|
||||
long delta_us = static_cast<long>(round(offset_s * 1'000'000));
|
||||
timeval delta_timeval;
|
||||
@@ -322,6 +324,6 @@ int main(int argc, char** argv)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
-
|
||||
+#endif
|
||||
return 0;
|
||||
}
|
||||
--
|
||||
2.36.1
|
||||
|
||||
Reference in New Issue
Block a user