Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions extra/abseil-cpp/0002-abseil.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
Patch-Source: https://github.com/void-linux/void-packages/blob/master/srcpkgs/mozc/patches/abseil.patch

Ported from grpc's patches

An all-in-one patch that fixes several issues:

1) UnscaledCycleClock not fully implemented for ppc*-musl (disabled on musl)
2) powerpc stacktrace implementation only works on glibc (disabled on musl)
4) examine_stack.cpp makes glibc assumptions on powerpc (fixed)

diff -Nurp a/absl/base/internal/unscaledcycleclock_config.h b/absl/base/internal/unscaledcycleclock_config.h
--- a/absl/base/internal/unscaledcycleclock_config.h 2024-08-01 18:05:11.000000000 +0000
+++ b/absl/base/internal/unscaledcycleclock_config.h 2024-08-03 10:33:19.043425243 +0000
@@ -20,8 +20,8 @@
#endif

// The following platforms have an implementation of a hardware counter.
-#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
- defined(__powerpc__) || defined(__ppc__) || defined(_M_IX86) || \
+#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || \
+ ((defined(__powerpc__) || defined(__ppc__)) && defined(__GLIBC)) || defined(_M_IX86) || \
(defined(_M_X64) && !defined(_M_ARM64EC))
#define ABSL_HAVE_UNSCALED_CYCLECLOCK_IMPLEMENTATION 1
#else
diff -Nurp a/absl/debugging/internal/examine_stack.cc b/absl/debugging/internal/examine_stack.cc
--- a/absl/debugging/internal/examine_stack.cc 2024-08-01 18:05:11.000000000 +0000
+++ b/absl/debugging/internal/examine_stack.cc 2024-08-03 09:59:34.495023649 +0000
@@ -36,6 +36,10 @@
#include <csignal>
#include <cstdio>

+#if defined(__powerpc__)
+#include <asm/ptrace.h>
+#endif
+
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
@@ -177,8 +181,10 @@ void* GetProgramCounter(void* const vuc)
return reinterpret_cast<void*>(context->uc_mcontext.pc);
#elif defined(__powerpc64__)
return reinterpret_cast<void*>(context->uc_mcontext.gp_regs[32]);
+#elif defined(__powerpc__) && defined(__GLIBC__)
+ return reinterpret_cast<void*>(context->uc_mcontext.regs->nip);
#elif defined(__powerpc__)
- return reinterpret_cast<void*>(context->uc_mcontext.uc_regs->gregs[32]);
+ return reinterpret_cast<void*>(((struct pt_regs *)context->uc_regs)->nip);
#elif defined(__riscv)
return reinterpret_cast<void*>(context->uc_mcontext.__gregs[REG_PC]);
#elif defined(__s390__) && !defined(__s390x__)
diff -Nurp a/absl/debugging/internal/stacktrace_config.h b/absl/debugging/internal/stacktrace_config.h
--- a/absl/debugging/internal/stacktrace_config.h 2024-08-01 18:05:11.000000000 +0000
+++ b/absl/debugging/internal/stacktrace_config.h 2024-08-03 09:59:34.495023649 +0000
@@ -60,7 +60,7 @@
#elif defined(__i386__) || defined(__x86_64__)
#define ABSL_STACKTRACE_INL_HEADER \
"absl/debugging/internal/stacktrace_x86-inl.inc"
-#elif defined(__ppc__) || defined(__PPC__)
+#elif (defined(__ppc__) || defined(__PPC__)) && defined(__GLIBC__)
#define ABSL_STACKTRACE_INL_HEADER \
"absl/debugging/internal/stacktrace_powerpc-inl.inc"
#elif defined(__aarch64__)
13 changes: 13 additions & 0 deletions extra/abseil-cpp/001-qnx-sig-t.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/absl/time/clock_test.cc
+++ b/absl/time/clock_test.cc
@@ -18,8 +18,8 @@
#if defined(ABSL_HAVE_ALARM)
#include <signal.h>
#include <unistd.h>
-#ifdef _AIX
-// sig_t is not defined in AIX.
+#if defined(_AIX) || defined(__QNX__)
+// sig_t is not defined in AIX or QNX.
typedef void (*sig_t)(int);
#endif
#elif defined(__linux__) || defined(__APPLE__)
199 changes: 199 additions & 0 deletions extra/abseil-cpp/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,199 @@
# Alpine-Contributor: Bart Ribbers <bribbers@disroot.org>
# Alpine-Maintainer: Leon White <badfunkstripe@gmail.com>
# Maintainer: Elliott Mazzuca <emazzuca@qnx.com>
pkgname=abseil-cpp
pkgver=20250814.1
pkgrel=0
pkgdesc="Abseil Common Libraries (C++)"
url="https://abseil.io/"
arch="all"
license="Apache-2.0"
#depends_dev="linux-headers"
depends_dev=
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is empty please remove

makedepends="
$depends_dev
cmake
gtest-dev
samurai
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change this from samurai to ninja

"
checkdepends="tzdata"
subpackages="$pkgname-dev"
source="https://github.com/abseil/abseil-cpp/archive/$pkgver/abseil-cpp-$pkgver.tar.gz
001-qnx-sig-t.patch
0002-abseil.patch
test.patch
"

_libs="
base
city
civil_time
cord
cord_internal
cordz_functions
cordz_handle
cordz_info
cordz_sample_token
crc32c
crc_cord_state
crc_cpu_detect
crc_internal
decode_rust_punycode
debugging_internal
demangle_internal
demangle_rust
die_if_null
examine_stack
exception_safety_testing
exponential_biased
failure_signal_handler
flags_commandlineflag
flags_commandlineflag_internal
flags_config
flags_internal
flags_marshalling
flags_parse
flags_private_handle_accessor
flags_program_name
flags_reflection
flags_usage
flags_usage_internal
graphcycles_internal
hash
hash_generator_testing
hashtablez_sampler
hashtable_profiler
int128
kernel_timeout_internal
leak_check
log_entry
log_flags
log_globals
log_initialize
log_internal_check_op
log_internal_conditions
log_internal_fnmatch
log_internal_format
log_internal_globals
log_internal_log_sink_set
log_internal_message
log_internal_nullguard
log_internal_proto
log_internal_structured_proto
log_internal_test_actions
log_internal_test_helpers
log_internal_test_matchers
log_severity
log_sink
malloc_internal
per_thread_sem_test_common
periodic_sampler
poison
pow10_helper
profile_builder
random_distributions
random_internal_entropy_pool
random_internal_distribution_test_util
random_internal_platform
random_internal_randen
random_internal_randen_hwaes
random_internal_randen_hwaes_impl
random_internal_randen_slow
random_internal_seed_material
random_seed_gen_exception
random_seed_sequences
raw_hash_set
raw_logging_internal
scoped_mock_log
scoped_set_env
spinlock_test_common
spinlock_wait
stack_consumption
stacktrace
status
status_matchers
statusor
str_format_internal
strerror
string_view
strings
strings_internal
symbolize
synchronization
test_instance_tracker
throw_delegate
time
time_internal_test_util
time_zone
tracing_internal
utf8_for_code_point
vlog_config_internal
"

for _lib in $_libs; do
subpackages="$subpackages $pkgname-${_lib//_/-}:abseillib"
done

build() {
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=MinSizeRel \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_SKIP_INSTALL_RPATH=ON \
-DBUILD_SHARED_LIBS=ON \
-DABSL_BUILD_TESTING=ON \
-DABSL_BUILD_TEST_HELPERS=ON \
-DABSL_USE_EXTERNAL_GOOGLETEST=ON \
-DABSL_PROPAGATE_CXX_STD=ON \
-DABSL_FIND_GOOGLETEST=ON
cmake --build build
}

#check() {
# case "$CARCH" in
# s390x) local _extratest="|absl_stacktrace_test" ;;
# esac
# # https://github.com/abseil/abseil-cpp/pull/1888
# ctest --test-dir build -E "absl_str_format_convert_test|absl_raw_hash_set_test$_extratest"
#}
Comment on lines +152 to +158
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove old check function


check() {
case "$CARCH" in
s390x) local _extratest="|absl_stacktrace_test" ;;
esac

# Add all abseil library directories to LD_LIBRARY_PATH for tests
local libdirs=$(find "$builddir"/build/absl -name "*.so" -exec dirname {} \; | sort -u | tr '\n' ':')
export LD_LIBRARY_PATH="$libdirs:$LD_LIBRARY_PATH"

# QNX-specific test exclusions (floating-point precision and platform differences)
local qnx_exclude="absl_failure_signal_handler_test|absl_flags_flag_test|absl_flags_usage_test"
qnx_exclude="$qnx_exclude|absl_log_format_test|absl_log_sink_test|absl_scoped_mock_log_test"
qnx_exclude="$qnx_exclude|absl_log_stripping_test|absl_random_mock_distributions_test"
qnx_exclude="$qnx_exclude|absl_random_bernoulli_distribution_test|absl_random_beta_distribution_test"
qnx_exclude="$qnx_exclude|absl_random_poisson_distribution_test|absl_random_exponential_distribution_test"
qnx_exclude="$qnx_exclude|absl_random_gaussian_distribution_test|absl_random_uniform_real_distribution_test"
qnx_exclude="$qnx_exclude|absl_random_internal_iostream_state_saver_test"
qnx_exclude="$qnx_exclude|absl_numbers_test|absl_charconv_test|absl_blocking_counter_test"

# https://github.com/abseil/abseil-cpp/pull/1888
ctest --test-dir build -E "absl_str_format_convert_test|absl_raw_hash_set_test$_extratest|$qnx_exclude"
}

package() {
DESTDIR="$pkgdir" cmake --install build
}

abseillib() {
pkgdesc="Abseil Common C++ library: $subpkgname"

local libname="${subpkgname#"$pkgname"-}"
amove usr/lib/libabsl_${libname//-/_}.so.*
}

sha512sums="
7083b73c3cf763f6f7a7edb70a5171f44d27045a0f5e52ca043e0a86379af2c50cf85dbfea30ebaa22a7bb2929452581d26b1ba18945023b057267d4c3bad2f7 abseil-cpp-20250814.1.tar.gz
51803ded8de5039e6c323537db1c42cb65ede8f5a8eb2ae31f2beeb4ae893e7bfb0fb26f5be5974baec8059b0c9014aa3dd8626408d12240a3e6c002d6dee756 001-qnx-sig-t.patch
ddd2a5ce3f37230c3976a8c088670951ebaeee7f1a8275ab4f699cc24dc038bf23ae37abb1c050269161dcd4343e4a75f0570867e6b16a0050af7657f2282e9d 0002-abseil.patch
6aafc9e3e3f5fc51d3ea0ac45a0461bb4b499df58c434bca9d3f233cfe26dccf13f8599af6aa4bebb74f5f0f463f31fda682c495a892946a7706da694b0d0b3b test.patch
"
33 changes: 33 additions & 0 deletions extra/abseil-cpp/test.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
diff -Nurp a/absl/base/CMakeLists.txt b/absl/base/CMakeLists.txt
--- a/absl/base/CMakeLists.txt 2025-06-17 14:48:08.000000000 +0000
+++ b/absl/base/CMakeLists.txt 2025-06-21 11:06:06.062929442 +0000
@@ -340,28 +340,15 @@ absl_cc_test(
)

# Internal-only target, do not depend on directly.
-absl_cc_library(
- NAME
- atomic_hook_test_helper
- SRCS
- "internal/atomic_hook_test_helper.cc"
- COPTS
- ${ABSL_TEST_COPTS}
- DEPS
- absl::atomic_hook
- absl::core_headers
- TESTONLY
-)

absl_cc_test(
NAME
atomic_hook_test
SRCS
- "internal/atomic_hook_test.cc"
+ "internal/atomic_hook_test.cc" "internal/atomic_hook_test_helper.cc"
COPTS
${ABSL_TEST_COPTS}
DEPS
- absl::atomic_hook_test_helper
absl::atomic_hook
absl::core_headers
GTest::gmock