diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index c604fc44bc6..6f3db3ed02e 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -19,6 +19,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`binutils`](binutils/) | GNU Binutils | 2.39 | https://www.gnu.org/software/binutils/ | | [`bison`](bison/) | GNU Bison | 1.25 | https://www.gnu.org/software/bison/ | | [`bochs`](bochs/) | Bochs x86 PC emulator | 2.7 | https://sourceforge.net/projects/bochs/ | +| [`boost`](boost/) | Boost C++ libraries | 1.80.0 | https://www.boost.org/ | | [`brogue`](brogue/) | BrogueCE | 1.11.1 | https://github.com/tmewett/BrogueCE | | [`byacc`](byacc/) | Berkeley Yacc | 20220128 | https://invisible-island.net/byacc/byacc.html | | [`bzip2`](bzip2/) | bzip2 | 1.0.8 | https://sourceware.org/bzip2/ | diff --git a/Ports/boost/package.sh b/Ports/boost/package.sh new file mode 100755 index 00000000000..fb31a889399 --- /dev/null +++ b/Ports/boost/package.sh @@ -0,0 +1,33 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='boost' +version='1.80.0' +useconfigure='true' +workdir="boost_${version//./_}" +depends=( + 'zlib' + 'bzip2' + 'zstd' + 'xz' + 'libicu' + 'python3' +) +files="https://boostorg.jfrog.io/artifactory/main/release/${version}/source/boost_${version//./_}.tar.bz2 boost_${version//./_}.tar.bz2 1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" +auth_type='sha256' +bjamopts=( + '--user-config=user-config.jam' + 'toolset=gcc' + 'target-os=serenity' +) + +configure() { + run ./bootstrap.sh --with-icu=${DESTDIR}/usr/local --prefix=${DESTDIR}/usr/local + echo "using gcc : : $CXX ;" >$workdir/user-config.jam +} + +build() { + run ./b2 "${bjamopts[@]}" +} + +install() { + run ./b2 "${bjamopts[@]}" install +} diff --git a/Ports/boost/patches/0001-Add-platform-support-for-SerenityOS.patch b/Ports/boost/patches/0001-Add-platform-support-for-SerenityOS.patch new file mode 100644 index 00000000000..86ab6ad9296 --- /dev/null +++ b/Ports/boost/patches/0001-Add-platform-support-for-SerenityOS.patch @@ -0,0 +1,132 @@ +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 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 cygwin : -mthreads ; + threading-flags solaris : -pthreads : rt ; + threading-flags qnx : -pthread ; ++ threading-flags serenity ; + + local bsd = [ MATCH ^(.*bsd)$ : $(all-os) ] ; + threading-flags $(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 $(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 ; diff --git a/Ports/boost/patches/0002-Fix-building-Boost.Interprocess.patch b/Ports/boost/patches/0002-Fix-building-Boost.Interprocess.patch new file mode 100644 index 00000000000..96219fc1d74 --- /dev/null +++ b/Ports/boost/patches/0002-Fix-building-Boost.Interprocess.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gunnar Beutner +Date: Sun, 23 Oct 2022 10:27:07 +0200 +Subject: [PATCH] Fix building Boost.Interprocess + +--- + boost/interprocess/detail/workaround.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boost/interprocess/detail/workaround.hpp b/boost/interprocess/detail/workaround.hpp +index 01b6c6eb05dddff8c8b6fbb0c5c279deb971b7c2..704456e290c9ad7b8c523769bdc68147d63e4536 100644 +--- a/boost/interprocess/detail/workaround.hpp ++++ b/boost/interprocess/detail/workaround.hpp +@@ -37,7 +37,7 @@ + ////////////////////////////////////////////////////// + //Check for XSI shared memory objects. They are available in nearly all UNIX platforms + ////////////////////////////////////////////////////// +- #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) ++ #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !defined(__serenity__) + #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + #endif + diff --git a/Ports/boost/patches/0003-Fix-building-Boost.Python.patch b/Ports/boost/patches/0003-Fix-building-Boost.Python.patch new file mode 100644 index 00000000000..6d44015931f --- /dev/null +++ b/Ports/boost/patches/0003-Fix-building-Boost.Python.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gunnar Beutner +Date: Sun, 23 Oct 2022 12:00:56 +0200 +Subject: [PATCH] Fix building Boost.Python + +--- + tools/build/src/tools/python.jam | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tools/build/src/tools/python.jam b/tools/build/src/tools/python.jam +index b0f6c2c6c29d03c1f86ff650158a4b04b1e0822c..824d1455dd086d36f9e561e961bab1fb73ece37c 100644 +--- a/tools/build/src/tools/python.jam ++++ b/tools/build/src/tools/python.jam +@@ -716,6 +716,7 @@ local rule configure ( version ? : cmd-or-prefix ? : includes * : libraries ? : + local interpreter-cmd ; + + local target-os = [ feature.get-values target-os : $(condition) ] ; ++ target-os = "serenity" ; # FIXME + target-os ?= [ feature.defaults target-os ] ; + target-os = $(target-os:G=) ; + diff --git a/Ports/boost/patches/0004-Fix-building-Boost.System.patch b/Ports/boost/patches/0004-Fix-building-Boost.System.patch new file mode 100644 index 00000000000..26ef577d93f --- /dev/null +++ b/Ports/boost/patches/0004-Fix-building-Boost.System.patch @@ -0,0 +1,63 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gunnar Beutner +Date: Sun, 23 Oct 2022 12:05:20 +0200 +Subject: [PATCH] Fix building Boost.System + +--- + boost/system/detail/config.hpp | 2 +- + boost/system/detail/error_category_impl.hpp | 6 ++++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/boost/system/detail/config.hpp b/boost/system/detail/config.hpp +index ad958bcabe2fa05c5242ff11dfcc07004885d86a..26e0a4cae88cb0f80c0532308b92446a04ddf243 100644 +--- a/boost/system/detail/config.hpp ++++ b/boost/system/detail/config.hpp +@@ -13,7 +13,7 @@ + + // BOOST_SYSTEM_HAS_SYSTEM_ERROR + +-#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_CXX11_HDR_ATOMIC) && !defined(BOOST_NO_CXX11_HDR_MUTEX) ++#if !defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_CXX11_HDR_ATOMIC) + # define BOOST_SYSTEM_HAS_SYSTEM_ERROR + #endif + +diff --git a/boost/system/detail/error_category_impl.hpp b/boost/system/detail/error_category_impl.hpp +index 982c667b3f0b8960aa6e3ecaf1dc15eb01e06436..0335f3504c77b5ea27f8df0d3ba7011389d13e33 100644 +--- a/boost/system/detail/error_category_impl.hpp ++++ b/boost/system/detail/error_category_impl.hpp +@@ -98,7 +98,9 @@ inline char const * error_category::message( int ev, char * buffer, std::size_t + #if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR) + + #include ++#ifndef BOOST_NO_CXX11_HDR_MUTEX + #include ++#endif + #include + + namespace boost +@@ -106,6 +108,7 @@ namespace boost + namespace system + { + ++#ifndef BOOST_NO_CXX11_HDR_MUTEX + namespace detail + { + +@@ -117,6 +120,7 @@ template struct stdcat_mx_holder + template std::mutex stdcat_mx_holder::mx_; + + } // namespace detail ++#endif + + inline void error_category::init_stdcat() const + { +@@ -130,7 +134,9 @@ inline void error_category::init_stdcat() const + + #endif + ++#ifndef BOOST_NO_CXX11_HDR_MUTEX + std::lock_guard lk( boost::system::detail::stdcat_mx_holder<>::mx_ ); ++#endif + + if( sc_init_.load( std::memory_order_acquire ) == 0 ) + { diff --git a/Ports/boost/patches/ReadMe.md b/Ports/boost/patches/ReadMe.md new file mode 100644 index 00000000000..365c53925a2 --- /dev/null +++ b/Ports/boost/patches/ReadMe.md @@ -0,0 +1,22 @@ +# Patches for boost on SerenityOS + +## `0001-Add-platform-support-for-SerenityOS.patch` + +Add platform support for SerenityOS + + +## `0002-Fix-building-Boost.Interprocess.patch` + +Fix building Boost.Interprocess + + +## `0003-Fix-building-Boost.Python.patch` + +Fix building Boost.Python + + +## `0004-Fix-building-Boost.System.patch` + +Fix building Boost.System + +