ladybird/Ports/boost/patches/0001-Add-platform-support-for-SerenityOS.patch
Gunnar Beutner 8cc952b3dc Ports: Add port for the Boost C++ libraries
This currently requires GCC.
2022-10-24 15:49:39 +02:00

133 lines
5.8 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Gunnar Beutner <gunnar@beutner.name>
Date: Sun, 23 Oct 2022 10:04:53 +0200
Subject: [PATCH] Add platform support for SerenityOS
---
.../config/detail/select_platform_config.hpp | 5 ++++
boost/config/platform/serenity.hpp | 26 +++++++++++++++++++
tools/build/src/tools/features/os-feature.jam | 4 +--
tools/build/src/tools/gcc.jam | 4 ++-
tools/build/src/tools/python.jam | 1 +
5 files changed, 37 insertions(+), 3 deletions(-)
create mode 100644 boost/config/platform/serenity.hpp
diff --git a/boost/config/detail/select_platform_config.hpp b/boost/config/detail/select_platform_config.hpp
index dbff74aaf74ea59eaf204f463bf2b37df9c432a5..d280ed5c02ff90b5eb0dfef3948d17a2d4310109 100644
--- a/boost/config/detail/select_platform_config.hpp
+++ b/boost/config/detail/select_platform_config.hpp
@@ -93,6 +93,10 @@
// Web assembly:
# define BOOST_PLATFORM_CONFIG "boost/config/platform/wasm.hpp"
+#elif defined (__serenity__)
+// SerenityOS:
+# define BOOST_PLATFORM_CONFIG "boost/config/platform/serenity.hpp"
+
#else
# if defined(unix) \
@@ -139,6 +143,7 @@
# include "boost/config/platform/symbian.hpp"
# include "boost/config/platform/cray.hpp"
# include "boost/config/platform/vms.hpp"
+# include "boost/config/platform/serenity.hpp"
# include <boost/config/detail/posix_features.hpp>
diff --git a/boost/config/platform/serenity.hpp b/boost/config/platform/serenity.hpp
new file mode 100644
index 0000000000000000000000000000000000000000..ecde1fe0e4adf068aaf44aee75757a26df5e1af9
--- /dev/null
+++ b/boost/config/platform/serenity.hpp
@@ -0,0 +1,26 @@
+// (C) Copyright 2022 Gunnar Beutner
+// Use, modification and distribution are subject to the
+// Boost Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org for most recent version.
+
+// SerenityOS specific config options:
+
+#define BOOST_PLATFORM "SerenityOS"
+
+#define BOOST_HAS_UNISTD_H
+#define BOOST_HAS_STDINT_H
+
+#ifndef BOOST_DISABLE_THREADS
+# define BOOST_HAS_THREADS
+#endif
+
+//
+// thread API's not auto detected:
+//
+#define BOOST_HAS_SCHED_YIELD
+#define BOOST_HAS_GETTIMEOFDAY
+
+// boilerplate code:
+#include <boost/config/detail/posix_features.hpp>
diff --git a/tools/build/src/tools/features/os-feature.jam b/tools/build/src/tools/features/os-feature.jam
index ced1fc1ff803383138e755efebef95983b85e0bd..5e0fc3998b86313a873a0549c95394e7723a9713 100644
--- a/tools/build/src/tools/features/os-feature.jam
+++ b/tools/build/src/tools/features/os-feature.jam
@@ -10,7 +10,7 @@ import os ;
.os-names =
aix android appletv bsd cygwin darwin freebsd haiku hpux iphone linux
netbsd openbsd osf qnx qnxnto sgi solaris unix unixware windows vms vxworks
- freertos
+ freertos serenity
# Not actually an OS -- used for targeting bare metal where object
# format is ELF. This catches both -elf and -eabi gcc targets as well
@@ -79,7 +79,7 @@ feature.set-default host-os : [ default-host-os ] ;
*Allowed values:* `aix`, `android`, `appletv`, `bsd`, `cygwin`, `darwin`,
`freebsd`, `haiku`, `hpux`, `iphone`, `linux`, `netbsd`, `openbsd`, `osf`,
`qnx`, `qnxnto`, `sgi`, `solaris`, `unix`, `unixware`, `windows`, `vms`,
-`vxworks`, `freertos`.
+`vxworks`, `freertos`, `serenity`.
+
Specifies the operating system for which the code is to be generated. The
compiler you used should be the compiler for that operating system. This option
diff --git a/tools/build/src/tools/gcc.jam b/tools/build/src/tools/gcc.jam
index 7265553692172482a77407c715c905d4b880a1ca..58feebab4f78153095bdc097918c60a3a0655c01 100644
--- a/tools/build/src/tools/gcc.jam
+++ b/tools/build/src/tools/gcc.jam
@@ -203,6 +203,7 @@ rule init ( version ? : command * : options * : requirement * )
case *mingw* : target-os ?= windows ;
case *cygwin* : target-os ?= cygwin ;
case *linux* : target-os ?= linux ;
+ case *serenity* : target-os ?= serenity ;
# TODO: finish this list.
}
}
@@ -389,6 +390,7 @@ local rule compile-link-flags ( * )
threading-flags <target-os>cygwin : -mthreads ;
threading-flags <target-os>solaris : -pthreads : rt ;
threading-flags <target-os>qnx : -pthread ;
+ threading-flags <target-os>serenity ;
local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ;
threading-flags <target-os>$(bsd) : -pthread ;
@@ -396,7 +398,7 @@ local rule compile-link-flags ( * )
# iOS doesn't need pthread flag according to the https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man3/pthread.3.html
# The default system libraries include pthread functions. No additional libraries or CFLAGS are necessary to use this API.
local no-threading = android beos haiku sgi darwin vxworks iphone appletv ;
- local threading-generic-os = [ set.difference $(all-os) : $(no-threading) $(bsd) windows cygwin solaris qnx ] ;
+ local threading-generic-os = [ set.difference $(all-os) : $(no-threading) $(bsd) windows cygwin solaris qnx serenity ] ;
threading-flags <target-os>$(threading-generic-os) : -pthread : rt ;
}
diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam
index 0dfc750a220b82ad47d67d3f28bf5bdaf2fb2455..b0f6c2c6c29d03c1f86ff650158a4b04b1e0822c 100644
--- a/tools/build/src/tools/python.jam
+++ b/tools/build/src/tools/python.jam
@@ -654,6 +654,7 @@ local rule system-library-dependencies ( target-os )
case darwin : return ;
case windows : return ;
case haiku : return ;
+ case serenity : return ;
case hpux : return <library>rt ;
case *bsd : return <library>pthread <toolset>gcc:<library>util ;