forked from SerenityOS/serenity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ports: Add port for the Boost C++ libraries
This currently requires GCC.
- Loading branch information
1 parent
de6048b
commit 8cc952b
Showing
7 changed files
with
294 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
132 changes: 132 additions & 0 deletions
132
Ports/boost/patches/0001-Add-platform-support-for-SerenityOS.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Gunnar Beutner <[email protected]> | ||
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:https://www.boost.org/LICENSE_1_0.txt) | ||
+ | ||
+// See http:https://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 ; |
22 changes: 22 additions & 0 deletions
22
Ports/boost/patches/0002-Fix-building-Boost.Interprocess.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Gunnar Beutner <[email protected]> | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Gunnar Beutner <[email protected]> | ||
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=) ; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Gunnar Beutner <[email protected]> | ||
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 <boost/system/detail/std_category_impl.hpp> | ||
+#ifndef BOOST_NO_CXX11_HDR_MUTEX | ||
#include <mutex> | ||
+#endif | ||
#include <new> | ||
|
||
namespace boost | ||
@@ -106,6 +108,7 @@ namespace boost | ||
namespace system | ||
{ | ||
|
||
+#ifndef BOOST_NO_CXX11_HDR_MUTEX | ||
namespace detail | ||
{ | ||
|
||
@@ -117,6 +120,7 @@ template<class = void> struct stdcat_mx_holder | ||
template<class T> std::mutex stdcat_mx_holder<T>::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<std::mutex> lk( boost::system::detail::stdcat_mx_holder<>::mx_ ); | ||
+#endif | ||
|
||
if( sc_init_.load( std::memory_order_acquire ) == 0 ) | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
||
|