commit:     3b8e554a80837cc26ddb9f6915d03664f569911f
Author:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 31 20:08:33 2021 +0000
Commit:     Matthew Thode <prometheanfire <AT> gentoo <DOT> org>
CommitDate: Fri Dec 31 20:08:47 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3b8e554a

dev-libs/leatherman: fix builds with >=glibc-2.33

fixes upstream bug LTH-172
Closes: https://bugs.gentoo.org/830346
Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Matthew Thode <prometheanfire <AT> gentoo.org>

 .../files/leatherman-1.12.6-SIGSTKSZ.patch         | 45 ++++++++++++++++
 dev-libs/leatherman/leatherman-1.12.6-r2.ebuild    | 62 ++++++++++++++++++++++
 2 files changed, 107 insertions(+)

diff --git a/dev-libs/leatherman/files/leatherman-1.12.6-SIGSTKSZ.patch 
b/dev-libs/leatherman/files/leatherman-1.12.6-SIGSTKSZ.patch
new file mode 100644
index 000000000000..e6c7349e814b
--- /dev/null
+++ b/dev-libs/leatherman/files/leatherman-1.12.6-SIGSTKSZ.patch
@@ -0,0 +1,45 @@
+diff -Naur a/src/Catch-1.10.0/single_include/catch.hpp 
b/src/Catch-1.10.0/single_include/catch.hpp
+--- a/src/Catch-1.10.0/single_include/catch.hpp        2021-07-05 
07:30:43.000000000 -0500
++++ b/src/Catch-1.10.0/single_include/catch.hpp        2021-12-17 
01:34:41.000000000 -0600
+@@ -6447,6 +6447,14 @@
+ 
+ #  else // CATCH_CONFIG_POSIX_SIGNALS is defined
+ 
++#    if defined(_SC_SIGSTKSZ_SOURCE) || defined(_GNU_SOURCE)
++// on glibc > 2.33 this is no longer constant, see
++// 
https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD
++static constexpr std::size_t sigStackSize = 32768;
++#    else
++static constexpr std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : 
MINSIGSTKSZ;
++#    endif
++
+ #include <signal.h>
+ 
+ namespace Catch {
+@@ -6470,7 +6478,7 @@
+         static bool isSet;
+         static struct sigaction oldSigActions 
[sizeof(signalDefs)/sizeof(SignalDefs)];
+         static stack_t oldSigStack;
+-        static char altStackMem[SIGSTKSZ];
++        static char altStackMem[sigStackSize];
+ 
+         static void handleSignal( int sig ) {
+             std::string name = "<unknown signal>";
+@@ -6490,7 +6498,7 @@
+             isSet = true;
+             stack_t sigStack;
+             sigStack.ss_sp = altStackMem;
+-            sigStack.ss_size = SIGSTKSZ;
++            sigStack.ss_size = sigStackSize;
+             sigStack.ss_flags = 0;
+             sigaltstack(&sigStack, &oldSigStack);
+             struct sigaction sa = { 0 };
+@@ -6521,7 +6529,7 @@
+     bool FatalConditionHandler::isSet = false;
+     struct sigaction 
FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = 
{};
+     stack_t FatalConditionHandler::oldSigStack = {};
+-    char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
++    char FatalConditionHandler::altStackMem[sigStackSize] = {};
+ 
+ } // namespace Catch
+ 

diff --git a/dev-libs/leatherman/leatherman-1.12.6-r2.ebuild 
b/dev-libs/leatherman/leatherman-1.12.6-r2.ebuild
new file mode 100644
index 000000000000..3a12d519ae1c
--- /dev/null
+++ b/dev-libs/leatherman/leatherman-1.12.6-r2.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+DESCRIPTION="A C++ toolkit"
+HOMEPAGE="https://github.com/puppetlabs/leatherman";
+SRC_URI="https://github.com/puppetlabs/${PN}/archive/${PV}.tar.gz -> 
${P}.tar.gz"
+
+LICENSE="Apache-2.0"
+SLOT="0/${PV}"
+KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86"
+IUSE="debug static-libs test"
+#RESTRICT="!test? ( test )"
+RESTRICT="test"  # restricted til we don't need the shared_nowide patch
+
+RDEPEND=">=dev-libs/boost-1.73:=[nls]
+       net-misc/curl"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/portage-sandbox-test-fix.patch
+       "${FILESDIR}"/1.12.2-shared_nowide.patch
+)
+
+src_prepare() {
+       sed -i 's/\-Werror\ //g' "cmake/cflags.cmake" || die
+       # vendored boost lib conflicts with boost 1.73 and above
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DCMAKE_VERBOSE_MAKEFILE=ON
+               -DCMAKE_BUILD_TYPE=None
+               -DLEATHERMAN_ENABLE_TESTING=$(usex test)
+               # We depend on Boost with nls, so this is always true
+               -DLEATHERMAN_USE_ICU=ON
+
+               -DLEATHERMAN_SHARED=$(usex !static-libs)
+       )
+
+       if use debug; then
+               mycmakeargs+=(
+                       -DCMAKE_BUILD_TYPE=Debug
+               )
+       fi
+
+       cmake_src_configure
+       cd "${BUILD_DIR}"
+       eapply "${FILESDIR}"/${P}-SIGSTKSZ.patch
+}
+
+src_test() {
+       "${WORKDIR}/${P}"_build/bin/leatherman_test || die
+}
+
+src_install() {
+       cmake_src_install
+}

Reply via email to