From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner 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 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 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 834f5e1bf6ddb080127a9e17e566571a39b8fef3..9e18425d018866a0590e5205258ba4b2b099f6ec 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. } } @@ -391,6 +392,7 @@ local rule compile-link-flags ( * ) threading-flags cygwin/pthread : -pthread ; threading-flags solaris : -pthreads : rt ; threading-flags qnx : -pthread ; + threading-flags serenity ; local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ; threading-flags $(bsd) : -pthread ; @@ -398,7 +400,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 $(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 rt ; case *bsd : return pthread gcc:util ;