diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 7c511bb4ffb..0f5f7dbc66b 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -6,6 +6,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | Port | Name | Version | Website | |-----------------------------------------------------|-----------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------| +| [`abseil`](abseil/) | Abseil Common Libraries | 20230802.0 | https://abseil.io/ | | [`aclock`](aclock/) | aclock | 2.3 | https://github.com/tenox7/aclock | | [`acpica-tools`](acpica-tools/) | ACPI Component Architecture Project Userspace Utilities | R06_28_23 | https://github.com/acpica/acpica | | [`alpine`](alpine/) | Alpine Email Client | 2.26 | https://alpineapp.email | @@ -257,6 +258,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`powdertoy`](powdertoy/) | The Powder Toy | 96.2.350 | https://powdertoy.co.uk/ | | [`prboom-plus`](prboom-plus/) | PrBoom+ | 2.6.2 | https://prboom-plus.sourceforge.io/ | | [`printf`](printf/) | printf (OpenBSD) | 6.6 | https://github.com/ibara/libpuffy | +| [`protobuf`](protobuf/) | Protocol Buffers | 24.3 | https://protobuf.dev/ | | [`pt2-clone`](pt2-clone/) | ProTracker 2 clone | 1.49 | https://github.com/8bitbubsy/pt2-clone | | [`pv`](pv/) | Pipe Viewer | 1.6.20 | http://www.ivarch.com/programs/pv.shtml | | [`python3`](python3/) | Python | 3.11.5 | https://www.python.org/ | diff --git a/Ports/abseil/package.sh b/Ports/abseil/package.sh new file mode 100755 index 00000000000..d0907e23626 --- /dev/null +++ b/Ports/abseil/package.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='abseil' +useconfigure='true' +version='20230802.0' +configopts=( + "-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt" + '-DABSL_PROPAGATE_CXX_STD=ON' + '-DABSL_ENABLE_INSTALL=ON' + '-DABSL_BUILD_TESTING=OFF' +) +files=( + "git+https://github.com/abseil/abseil-cpp.git#${version}" +) + +configure() { + run cmake . "${configopts[@]}" +} + +build() { + run cmake --build . +} + +install() { + run cmake --build . --target install +} diff --git a/Ports/abseil/patches/0001-Remove-strptime-support-on-Serenity.patch b/Ports/abseil/patches/0001-Remove-strptime-support-on-Serenity.patch new file mode 100644 index 00000000000..5dccce6c1d3 --- /dev/null +++ b/Ports/abseil/patches/0001-Remove-strptime-support-on-Serenity.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= +Date: Sat, 16 Sep 2023 11:08:54 +0200 +Subject: [PATCH] Remove strptime support on Serenity + +--- + absl/time/internal/cctz/src/time_zone_format.cc | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/absl/time/internal/cctz/src/time_zone_format.cc b/absl/time/internal/cctz/src/time_zone_format.cc +index 9b91f61cf09530fb3fc08c2a4091f61f86904a5e..d40858bc44c295a27efe4f9aa7da5241e5ba0381 100644 +--- a/absl/time/internal/cctz/src/time_zone_format.cc ++++ b/absl/time/internal/cctz/src/time_zone_format.cc +@@ -13,7 +13,7 @@ + // limitations under the License. + + #if !defined(HAS_STRPTIME) +-#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__VXWORKS__) ++#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(__VXWORKS__) && !defined(__serenity__) + #define HAS_STRPTIME 1 // Assume everyone else has strptime(). + #endif + #endif diff --git a/Ports/abseil/patches/0002-Remove-LibC-timezone-support-on-Serenity.patch b/Ports/abseil/patches/0002-Remove-LibC-timezone-support-on-Serenity.patch new file mode 100644 index 00000000000..78d6a4b4e77 --- /dev/null +++ b/Ports/abseil/patches/0002-Remove-LibC-timezone-support-on-Serenity.patch @@ -0,0 +1,37 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= +Date: Sat, 16 Sep 2023 11:09:17 +0200 +Subject: [PATCH] Remove LibC timezone support on Serenity + +--- + absl/time/internal/cctz/src/time_zone_libc.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/absl/time/internal/cctz/src/time_zone_libc.cc b/absl/time/internal/cctz/src/time_zone_libc.cc +index d01461222e9e60461384733162d1e042aa51147b..8ac1db60e61610bfbc2adc9c2f4658affd65712b 100644 +--- a/absl/time/internal/cctz/src/time_zone_libc.cc ++++ b/absl/time/internal/cctz/src/time_zone_libc.cc +@@ -91,6 +91,11 @@ auto tm_gmtoff(const std::tm& tm) -> decltype(tm.tm_gmtoff) { + auto tm_gmtoff(const std::tm& tm) -> decltype(tm.__tm_gmtoff) { + return tm.__tm_gmtoff; + } ++#elif defined(__serenity__) ++template ++auto tm_gmtoff(const T&) -> int { ++ return 0; ++} + #else + template + auto tm_gmtoff(const T& tm) -> decltype(tm.tm_gmtoff) { +@@ -107,6 +112,11 @@ auto tm_zone(const std::tm& tm) -> decltype(tm.tm_zone) { return tm.tm_zone; } + auto tm_zone(const std::tm& tm) -> decltype(tm.__tm_zone) { + return tm.__tm_zone; + } ++#elif defined(__serenity__) ++template ++auto tm_zone(const T&) -> char const* { ++ return "UTC"; ++} + #else + template + auto tm_zone(const T& tm) -> decltype(tm.tm_zone) { diff --git a/Ports/abseil/patches/0003-Only-check-error-codes-on-platforms-where-they-exist.patch b/Ports/abseil/patches/0003-Only-check-error-codes-on-platforms-where-they-exist.patch new file mode 100644 index 00000000000..725ef7cd918 --- /dev/null +++ b/Ports/abseil/patches/0003-Only-check-error-codes-on-platforms-where-they-exist.patch @@ -0,0 +1,56 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= +Date: Sat, 16 Sep 2023 11:09:57 +0200 +Subject: [PATCH] Only check error codes on platforms where they exist + +--- + absl/status/status.cc | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/absl/status/status.cc b/absl/status/status.cc +index 26e68294acf7dca9f112987972dc48016c381f4f..68277d5967b23b52f790f7f1f3f6a27f640924eb 100644 +--- a/absl/status/status.cc ++++ b/absl/status/status.cc +@@ -464,14 +464,18 @@ StatusCode ErrnoToStatusCode(int error_number) { + case EFAULT: // Bad address + case EILSEQ: // Illegal byte sequence + case ENOPROTOOPT: // Protocol not available ++#ifdef ENOSTR + case ENOSTR: // Not a STREAM ++#endif + case ENOTSOCK: // Not a socket + case ENOTTY: // Inappropriate I/O control operation + case EPROTOTYPE: // Protocol wrong type for socket + case ESPIPE: // Invalid seek + return StatusCode::kInvalidArgument; + case ETIMEDOUT: // Connection timed out ++#ifdef ETIME + case ETIME: // Timer expired ++#endif + return StatusCode::kDeadlineExceeded; + case ENODEV: // No such device + case ENOENT: // No such file or directory +@@ -530,9 +534,13 @@ StatusCode ErrnoToStatusCode(int error_number) { + case EMLINK: // Too many links + case ENFILE: // Too many open files in system + case ENOBUFS: // No buffer space available ++#ifdef ENODATA + case ENODATA: // No message is available on the STREAM read queue ++#endif + case ENOMEM: // Not enough space ++#ifdef ENOSR + case ENOSR: // No STREAM resources ++#endif + #ifdef EUSERS + case EUSERS: // Too many users + #endif +@@ -575,7 +583,9 @@ StatusCode ErrnoToStatusCode(int error_number) { + case ENETRESET: // Connection aborted by network + case ENETUNREACH: // Network unreachable + case ENOLCK: // No locks available ++#ifdef ENOLINK + case ENOLINK: // Link has been severed ++#endif + #ifdef ENONET + case ENONET: // Machine is not on the network + #endif diff --git a/Ports/abseil/patches/0004-Remove-elf_mem_image-support-on-Serenity.patch b/Ports/abseil/patches/0004-Remove-elf_mem_image-support-on-Serenity.patch new file mode 100644 index 00000000000..a5168c52433 --- /dev/null +++ b/Ports/abseil/patches/0004-Remove-elf_mem_image-support-on-Serenity.patch @@ -0,0 +1,22 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= +Date: Sat, 16 Sep 2023 11:11:05 +0200 +Subject: [PATCH] Remove elf_mem_image support on Serenity + +--- + absl/debugging/internal/elf_mem_image.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/absl/debugging/internal/elf_mem_image.h b/absl/debugging/internal/elf_mem_image.h +index e7fe6ab06e2ffdf78756f2fd3ebb2f9a78aa784c..565e8f6eb9b97c1dd7fc36b5a18c5f579fc40394 100644 +--- a/absl/debugging/internal/elf_mem_image.h ++++ b/absl/debugging/internal/elf_mem_image.h +@@ -34,7 +34,7 @@ + #if defined(__ELF__) && !defined(__OpenBSD__) && !defined(__QNX__) && \ + !defined(__native_client__) && !defined(__asmjs__) && \ + !defined(__wasm__) && !defined(__HAIKU__) && !defined(__sun) && \ +- !defined(__VXWORKS__) && !defined(__hexagon__) ++ !defined(__VXWORKS__) && !defined(__hexagon__) && !defined(__serenity__) + #define ABSL_HAVE_ELF_MEM_IMAGE 1 + #endif + diff --git a/Ports/abseil/patches/0005-Recognize-Serenity-as-having-mmap-pthread_getschedpa.patch b/Ports/abseil/patches/0005-Recognize-Serenity-as-having-mmap-pthread_getschedpa.patch new file mode 100644 index 00000000000..8471369743b --- /dev/null +++ b/Ports/abseil/patches/0005-Recognize-Serenity-as-having-mmap-pthread_getschedpa.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?kleines=20Filmr=C3=B6llchen?= +Date: Sat, 16 Sep 2023 11:39:18 +0200 +Subject: [PATCH] Recognize Serenity as having mmap, pthread_getschedparam, and + sched_yield + +--- + absl/base/config.h | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/absl/base/config.h b/absl/base/config.h +index 1de799300737100a4eb26e5f26fe8e75e6dcc010..8043049b7afa1f3423dc33a36ccc443b0dd49fbb 100644 +--- a/absl/base/config.h ++++ b/absl/base/config.h +@@ -412,7 +412,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + defined(__asmjs__) || defined(__wasm__) || defined(__Fuchsia__) || \ + defined(__sun) || defined(__ASYLO__) || defined(__myriad2__) || \ + defined(__HAIKU__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ +- defined(__QNX__) || defined(__VXWORKS__) || defined(__hexagon__) ++ defined(__QNX__) || defined(__VXWORKS__) || defined(__hexagon__) || defined(__serenity__) + #define ABSL_HAVE_MMAP 1 + #endif + +@@ -424,7 +424,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + #error ABSL_HAVE_PTHREAD_GETSCHEDPARAM cannot be directly set + #elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(_AIX) || defined(__ros__) || defined(__OpenBSD__) || \ +- defined(__NetBSD__) || defined(__VXWORKS__) ++ defined(__NetBSD__) || defined(__VXWORKS__) || defined(__serenity__) + #define ABSL_HAVE_PTHREAD_GETSCHEDPARAM 1 + #endif + +@@ -444,7 +444,7 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || + #ifdef ABSL_HAVE_SCHED_YIELD + #error ABSL_HAVE_SCHED_YIELD cannot be directly set + #elif defined(__linux__) || defined(__ros__) || defined(__native_client__) || \ +- defined(__VXWORKS__) ++ defined(__VXWORKS__) || defined(__serenity__) + #define ABSL_HAVE_SCHED_YIELD 1 + #endif + diff --git a/Ports/abseil/patches/ReadMe.md b/Ports/abseil/patches/ReadMe.md new file mode 100644 index 00000000000..e9fc5590dc6 --- /dev/null +++ b/Ports/abseil/patches/ReadMe.md @@ -0,0 +1,27 @@ +# Patches for abseil on SerenityOS + +## `0001-Remove-strptime-support-on-Serenity.patch` + +Remove strptime support on Serenity + + +## `0002-Remove-LibC-timezone-support-on-Serenity.patch` + +Remove LibC timezone support on Serenity + + +## `0003-Only-check-error-codes-on-platforms-where-they-exist.patch` + +Only check error codes on platforms where they exist + + +## `0004-Remove-elf_mem_image-support-on-Serenity.patch` + +Remove elf_mem_image support on Serenity + + +## `0005-Recognize-Serenity-as-having-mmap-pthread_getschedpa.patch` + +Recognize Serenity as having mmap, pthread_getschedparam, and sched_yield + + diff --git a/Ports/protobuf/package.sh b/Ports/protobuf/package.sh new file mode 100755 index 00000000000..1cef68139da --- /dev/null +++ b/Ports/protobuf/package.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='protobuf' +useconfigure='true' +version='24.3' +depends=( + 'abseil' + 'zlib' +) +configopts=( + "-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt" + '-Dprotobuf_BUILD_TESTS=OFF' + # Don't use Protobuf's internal abseil, which is missing from the archive anyways. + '-Dprotobuf_ABSL_PROVIDER=package' +) +files=( + "git+https://github.com/protocolbuffers/protobuf.git#v${version}" +) + +configure() { + run cmake -B build -G Ninja . "${configopts[@]}" +} + +build() { + run cmake --build build +} + +install() { + run cmake --install build +}