commit:     4ca7fb9be00c1d64e8d963012bca7fb0e64fb575
Author:     Josiah Mullins <JoMull01 <AT> protonmail <DOT> com>
AuthorDate: Wed Aug 11 22:10:35 2021 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Tue Aug 24 08:50:26 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4ca7fb9b

net-im/toxic: Fix incorrect header file inclusion

It seems that the upstream developer believes that
the macros NAME_MAX and PATH_MAX are defined in
<limits.h> when they are really defined in
<linux/limits.h>. More interestingly, it seems
that GCC automatically corrects for this while
clang does not. This commit adds patches necessary
to fix this as well as some minor fixes.

Signed-off-by: Josiah Mullins <JoMull01 <AT> protonmail.com>
Closes: https://bugs.gentoo.org/803404
Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 .../files/toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch | 49 ++++++++++++++++++++++
 .../files/toxic-0.8.3-NAME_MAX-and-PATH_MAX.patch  | 49 ++++++++++++++++++++++
 ...{toxic-0.10.1.ebuild => toxic-0.10.1-r1.ebuild} | 14 +++++--
 ...toxic-0.8.3-r2.ebuild => toxic-0.8.3-r3.ebuild} | 11 +++--
 4 files changed, 115 insertions(+), 8 deletions(-)

diff --git a/net-im/toxic/files/toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch 
b/net-im/toxic/files/toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch
new file mode 100644
index 00000000000..68cb0bb59cc
--- /dev/null
+++ b/net-im/toxic/files/toxic-0.10.1-NAME_MAX-and-PATH_MAX.patch
@@ -0,0 +1,49 @@
+diff -ruN src/autocomplete.c src/autocomplete.c
+--- src/autocomplete.c 2021-07-26 15:04:59.172715491 -0400
++++ src/autocomplete.c 2021-07-26 15:22:06.652686609 -0400
+@@ -25,10 +25,12 @@
+ #include <string.h>
+ 
+ #ifdef __APPLE__
+-#include <sys/types.h>
+ #include <sys/dir.h>
++#include <sys/types.h>
++#include <sys/sysinfo.h>
+ #else
+ #include <dirent.h>
++#include <linux/limits.h>
+ #endif /* __APPLE__ */
+ 
+ #include "configdir.h"
+diff -ruN src/file_transfers.h src/file_transfers.h
+--- src/file_transfers.h       2021-07-26 15:39:36.765990567 -0400
++++ src/file_transfers.h       2021-07-26 15:39:41.899323757 -0400
+@@ -24,6 +24,12 @@
+ #define FILE_TRANSFERS_H
+ 
+ #include <limits.h>
++//This includes NAME_MAX and PATH_MAX
++#ifdef __APPLE__
++#include <sys/sysinfo.h>
++#elif __linux__
++#include <linux/limits.h>
++#endif
+ 
+ #include "notify.h"
+ #include "toxic.h"
+diff -ruN src/settings.h src/settings.h
+--- src/settings.h     2021-07-26 15:04:59.176048823 -0400
++++ src/settings.h     2021-07-26 15:12:01.772703590 -0400
+@@ -24,6 +24,12 @@
+ #define SETTINGS_H
+ 
+ #include <limits.h>
++//This includes NAME_MAX and PATH_MAX
++#ifdef __APPLE__
++#include <sys/sysinfo.h>
++#elif __linux__
++#include <linux/limits.h>
++#endif
+ 
+ #include <tox/tox.h>
+ 

diff --git a/net-im/toxic/files/toxic-0.8.3-NAME_MAX-and-PATH_MAX.patch 
b/net-im/toxic/files/toxic-0.8.3-NAME_MAX-and-PATH_MAX.patch
new file mode 100644
index 00000000000..11dc43c6b77
--- /dev/null
+++ b/net-im/toxic/files/toxic-0.8.3-NAME_MAX-and-PATH_MAX.patch
@@ -0,0 +1,49 @@
+diff -ruN src/autocomplete.c src/autocomplete.c
+--- src/autocomplete.c 2021-07-26 10:43:37.453154392 -0400
++++ src/autocomplete.c 2021-07-26 10:59:29.856460938 -0400
+@@ -27,8 +27,11 @@
+ #ifdef __APPLE__
+ #include <sys/types.h>
+ #include <sys/dir.h>
+-#else
++//This include NAME_MAX
++#include <sys/sysinfo.h>
++#elif __linux__
+ #include <dirent.h>
++#include <linux/limits.h>//This includes NAME_MAX
+ #endif /* __APPLE__ */
+ 
+ #include "windows.h"
+diff -ruN src/file_transfers.h src/file_transfers.h
+--- src/file_transfers.h       2021-07-26 10:43:37.456487724 -0400
++++ src/file_transfers.h       2021-07-26 11:41:30.513057111 -0400
+@@ -24,6 +24,12 @@
+ #define FILE_TRANSFERS_H
+ 
+ #include <limits.h>
++//This includes PATH_MAX
++#ifdef __APPLE__
++#include <sys/sysinfo.h>
++#elif __linux__
++#include <linux/limits.h>
++#endif
+ 
+ #include "toxic.h"
+ #include "windows.h"
+diff -ruN src/settings.h src/settings.h
+--- src/settings.h     2021-07-26 10:43:37.459821058 -0400
++++ src/settings.h     2021-07-26 11:45:46.709716594 -0400
+@@ -25,6 +25,13 @@
+ 
+ #include <limits.h>
+ 
++//This includes PATH_MAX
++#ifdef __APPLE__
++#include <sys/sysinfo.h>
++#elif __linux__
++#include <linux/limits.h>
++#endif
++
+ #include <tox/tox.h>
+ 
+ /* Represents line_* hints max strlen */

diff --git a/net-im/toxic/toxic-0.10.1.ebuild 
b/net-im/toxic/toxic-0.10.1-r1.ebuild
similarity index 83%
rename from net-im/toxic/toxic-0.10.1.ebuild
rename to net-im/toxic/toxic-0.10.1-r1.ebuild
index 4f0639961dc..931dd62fc29 100644
--- a/net-im/toxic/toxic-0.10.1.ebuild
+++ b/net-im/toxic/toxic-0.10.1-r1.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{7,8,9,10} )
 
 inherit python-single-r1 xdg
 
@@ -18,10 +18,12 @@ IUSE="+audio-notify debug doc llvm notification png python 
qrcode +sound +video
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )
        video? ( sound X ) "
 
-RDEPEND="dev-libs/libconfig:=
-       net-libs/tox:=
+BDEPEND="dev-libs/libconfig"
+
+RDEPEND="net-libs/tox:=
        net-misc/curl
        sys-libs/ncurses:=
+       sys-kernel/linux-headers
        audio-notify? (
                media-libs/freealut
                media-libs/openal
@@ -58,6 +60,10 @@ src_prepare() {
        #This line changes the "lazy set if absent" assignment to a "lazy set" 
assignment.
        #look below in src_configure to see how CFLAGS are passed to the 
makefile in USER_CFLAGS
        sed -i -e 's/?=/=/g' Makefile || die "Unable to force CFLAGS and 
LDFLAGS"
+       #Fix incomplete invocation of python-config
+       sed -i -e "s/--ldflags/--ldflags --embed/" cfg/checks/python.mk || die 
"Unable to fix python linking"
+       #Fix incorrect include statements for NAME_MAX and PATH_MAX macros
+       eapply -p0 "${FILESDIR}/${P}-NAME_MAX-and-PATH_MAX.patch" || die 
"Unable to fix header inclusion"
 }
 
 src_configure() {
@@ -101,6 +107,6 @@ src_configure() {
 src_install() {
        default
        if ! use audio-notify; then
-               rm -r "${ED}"/usr/share/${PN}/sounds || die "Could not remove 
sounds directory"
+               rm -r "${ED}"/usr/share/"${PN}"/sounds || die "Could not remove 
sounds directory"
        fi
 }

diff --git a/net-im/toxic/toxic-0.8.3-r2.ebuild 
b/net-im/toxic/toxic-0.8.3-r3.ebuild
similarity index 85%
rename from net-im/toxic/toxic-0.8.3-r2.ebuild
rename to net-im/toxic/toxic-0.8.3-r3.ebuild
index fb4792fc89e..97ed2aa0ae3 100644
--- a/net-im/toxic/toxic-0.8.3-r2.ebuild
+++ b/net-im/toxic/toxic-0.8.3-r3.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{7,8,9} )
+PYTHON_COMPAT=( python3_{7,8,9,10} )
 
 inherit python-single-r1 xdg
 
@@ -17,11 +17,12 @@ KEYWORDS="amd64 x86"
 IUSE="notification python qrcode +sound +video +X"
 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
 
-RDEPEND="
-       dev-libs/libconfig:=
-       >=net-libs/tox-0.2.8:=
+BDEPEND="dev-libs/libconfig"
+
+RDEPEND="net-libs/tox:=
        net-misc/curl
        sys-libs/ncurses:=
+       sys-kernel/linux-headers
        notification? ( x11-libs/libnotify )
        python? ( ${PYTHON_DEPS} )
        qrcode? ( media-gfx/qrencode:= )
@@ -45,6 +46,8 @@ src_prepare() {
        default
        #prevent man files from being compressed.
        sed -i -e "/gzip/d" cfg/targets/install.mk || die "Unable to prevent 
compression of man pages."
+       #Fix incorrect include declarations for NAME_MAX and PATH_MAX.
+       eapply -p0 "${FILESDIR}/${P}-NAME_MAX-and-PATH_MAX.patch" || die 
"Unable to fix include statements"
 }
 
 src_configure() {

Reply via email to