commit:     73b5c4466f2c421fb3bdbe13b3f7b27be76fc968
Author:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
AuthorDate: Thu Aug 27 17:27:46 2020 +0000
Commit:     Conrad Kostecki <conikost <AT> gentoo <DOT> org>
CommitDate: Thu Aug 27 17:28:00 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73b5c446

net-im/spectrum2: fix compilation with musl

Closes: https://bugs.gentoo.org/717410
Package-Manager: Portage-3.0.4, Repoman-3.0.1
Signed-off-by: Conrad Kostecki <conikost <AT> gentoo.org>

 .../spectrum2-2.0.13-musl-compatibility.patch      | 95 ++++++++++++++++++++++
 net-im/spectrum2/spectrum2-2.0.12-r4.ebuild        |  1 +
 net-im/spectrum2/spectrum2-2.0.13-r2.ebuild        |  5 +-
 3 files changed, 100 insertions(+), 1 deletion(-)

diff --git a/net-im/spectrum2/files/spectrum2-2.0.13-musl-compatibility.patch 
b/net-im/spectrum2/files/spectrum2-2.0.13-musl-compatibility.patch
new file mode 100644
index 00000000000..07bde50b832
--- /dev/null
+++ b/net-im/spectrum2/files/spectrum2-2.0.13-musl-compatibility.patch
@@ -0,0 +1,95 @@
+From 19b10896fa3426b2bd9e4e75a63ca52322373d33 Mon Sep 17 00:00:00 2001
+From: Vitaly Takmazov <[email protected]>
+Date: Fri, 24 Jul 2020 15:09:28 +0300
+Subject: [PATCH] musl compatibility
+
+---
+ backends/libpurple/main.cpp  | 6 +++---
+ backends/swiften/main.cpp    | 2 ++
+ libtransport/UserManager.cpp | 2 ++
+ spectrum/src/main.cpp        | 2 ++
+ 4 files changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/backends/libpurple/main.cpp b/backends/libpurple/main.cpp
+index 54c618e0..4555edbc 100644
+--- a/backends/libpurple/main.cpp
++++ b/backends/libpurple/main.cpp
+@@ -528,7 +528,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
+ 
+                               purple_accounts_delete_wrapped(account);
+ #ifndef WIN32
+-#if !defined(__FreeBSD__) && !defined(__APPLE__)
++#if !defined(__FreeBSD__) && !defined(__APPLE__) && defined (__GLIBC__)
+                               malloc_trim(0);
+ #endif
+ #endif
+@@ -2287,7 +2287,7 @@ static void signed_on(PurpleConnection *gc, gpointer 
unused) {
+       PurpleAccount *account = purple_connection_get_account_wrapped(gc);
+       np->handleConnected(np->m_accounts[account]);
+ #ifndef WIN32
+-#if !defined(__FreeBSD__) && !defined(__APPLE__)
++#if !defined(__FreeBSD__) && !defined(__APPLE__) && defined (__GLIBC__)
+       // force returning of memory chunks allocated by libxml2 to kernel
+       malloc_trim(0);
+ #endif
+@@ -2516,7 +2516,7 @@ int main(int argc, char **argv) {
+       boost::locale::generator gen;
+       std::locale::global(gen(""));
+ #ifndef WIN32
+-#if !defined(__FreeBSD__) && !defined(__APPLE__)
++#if !defined(__FreeBSD__) && !defined(__APPLE__) && defined (__GLIBC__)
+               mallopt(M_CHECK_ACTION, 2);
+               mallopt(M_PERTURB, 0xb);
+ #endif
+diff --git a/backends/swiften/main.cpp b/backends/swiften/main.cpp
+index f0acdb6d..6c111464 100644
+--- a/backends/swiften/main.cpp
++++ b/backends/swiften/main.cpp
+@@ -227,10 +227,12 @@ class SwiftenPlugin : public NetworkPlugin, 
Swift::XMPPParserClient {
+ #ifndef WIN32
+ #ifndef __FreeBSD__
+ #ifndef __MACH__
++#if defined (__GLIBC__)
+                       // force returning of memory chunks allocated by 
libxml2 to kernel
+                       malloc_trim(0);
+ #endif
+ #endif
++#endif
+ #endif
+               }
+ 
+diff --git a/libtransport/UserManager.cpp b/libtransport/UserManager.cpp
+index 73fcdae9..a622754f 100644
+--- a/libtransport/UserManager.cpp
++++ b/libtransport/UserManager.cpp
+@@ -125,10 +125,12 @@ void UserManager::removeUser(User *user, bool 
onUserBehalf) {
+ #ifndef WIN32
+ #ifndef __FreeBSD__
+ #ifndef __MACH__
++#if defined (__GLIBC__)
+       malloc_trim(0);
+ #endif
+ #endif
+ #endif
++#endif
+ //    VALGRIND_DO_LEAK_CHECK;
+ }
+ 
+diff --git a/spectrum/src/main.cpp b/spectrum/src/main.cpp
+index 0f5985a2..89e5b9a1 100644
+--- a/spectrum/src/main.cpp
++++ b/spectrum/src/main.cpp
+@@ -320,11 +320,13 @@ int main(int argc, char **argv)
+ #ifndef WIN32
+ #ifndef __FreeBSD__
+ #ifndef __MACH__
++#if defined (__GLIBC__)
+       mallopt(M_CHECK_ACTION, 2);
+       mallopt(M_PERTURB, 0xb);
+ #endif
+ #endif
+ #endif
++#endif
+ 
+ #ifndef WIN32
+       if (signal(SIGINT, spectrum_sigint_handler) == SIG_ERR) {

diff --git a/net-im/spectrum2/spectrum2-2.0.12-r4.ebuild 
b/net-im/spectrum2/spectrum2-2.0.12-r4.ebuild
index 4f12c3c285e..3bbf840a522 100644
--- a/net-im/spectrum2/spectrum2-2.0.12-r4.ebuild
+++ b/net-im/spectrum2/spectrum2-2.0.12-r4.ebuild
@@ -62,6 +62,7 @@ PATCHES=(
        "${FILESDIR}/${P}-boost-173-compatibility.patch"
        "${FILESDIR}/${P}-gcc-10-compatibility.patch"
        "${FILESDIR}/${PN}-2.0.13-libpqxx-7-compatibility.patch"
+       "${FILESDIR}/${PN}-2.0.13-musl-compatibility.patch"
 )
 
 src_prepare() {

diff --git a/net-im/spectrum2/spectrum2-2.0.13-r2.ebuild 
b/net-im/spectrum2/spectrum2-2.0.13-r2.ebuild
index 1c7985cbc6c..d94c327ca2c 100644
--- a/net-im/spectrum2/spectrum2-2.0.13-r2.ebuild
+++ b/net-im/spectrum2/spectrum2-2.0.13-r2.ebuild
@@ -58,7 +58,10 @@ DEPEND="
        test? ( dev-util/cppunit )
 "
 
-PATCHES=( "${FILESDIR}/${P}-libpqxx-7-compatibility.patch" )
+PATCHES=(
+       "${FILESDIR}/${P}-libpqxx-7-compatibility.patch"
+       "${FILESDIR}/${P}-musl-compatibility.patch"
+)
 
 src_prepare() {
        # Respect users LDFLAGS

Reply via email to