Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-misc/mc/files/, app-misc/mc/
Date: Wed, 11 Sep 2019 21:44:25
Message-Id: 1568238253.4939d79d562b3490794aac9d3875d1fdf9a60e92.slyfox@gentoo
commit:     4939d79d562b3490794aac9d3875d1fdf9a60e92
Author:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
AuthorDate: Wed Sep 11 21:41:15 2019 +0000
Commit:     Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
CommitDate: Wed Sep 11 21:44:13 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4939d79d

app-misc/mc: workaround linkage against internal gettext, bug #693850

The underlying issue is lack of support of linking in static
gettext into libmc.a due to a deficiency in m4/gettext.m4 (see
upstream bug for more details).

The workaround is to manually link bundled gettext into every
final binary. It fixes default case for musl but does not fix
the underlying issues. Let's leave fixing those to upstream.

Reported-by: Michael 'veremitz' Everitt
Bug: https://bugs.gentoo.org/693850
Bug: https://midnight-commander.org/ticket/3629
Package-Manager: Portage-2.3.75, Repoman-2.3.17
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>

 app-misc/mc/files/mc-4.8.23-gettext-test.patch | 54 +++++++++++++++++++++++++
 app-misc/mc/files/mc-4.8.23-gettext.patch      | 56 ++++++++++++++++++++++++++
 app-misc/mc/mc-4.8.23-r1.ebuild                |  2 +
 3 files changed, 112 insertions(+)

diff --git a/app-misc/mc/files/mc-4.8.23-gettext-test.patch b/app-misc/mc/files/mc-4.8.23-gettext-test.patch
new file mode 100644
index 00000000000..7e19cd7fa11
--- /dev/null
+++ b/app-misc/mc/files/mc-4.8.23-gettext-test.patch
@@ -0,0 +1,54 @@
+https://bugs.gentoo.org/693850
+https://midnight-commander.org/raw-attachment/ticket/3629/mc-3629-Linking-fix-for-gettext.patch
+
+Test change counterpart.
+
+--- a/tests/lib/Makefile.am
++++ b/tests/lib/Makefile.am
+@@ -9,3 +9,3 @@ AM_LDFLAGS = @TESTS_LDFLAGS@
+ LIBS = @CHECK_LIBS@ \
+-	$(top_builddir)/lib/libmc.la
++	$(top_builddir)/lib/libmc.la $(LIBINTL)
+ 
+--- a/tests/lib/mcconfig/Makefile.am
++++ b/tests/lib/mcconfig/Makefile.am
+@@ -11,3 +11,3 @@ AM_LDFLAGS = @TESTS_LDFLAGS@
+ LIBS = @CHECK_LIBS@ \
+-	$(top_builddir)/lib/libmc.la
++	$(top_builddir)/lib/libmc.la $(LIBINTL)
+ 
+--- a/tests/lib/search/Makefile.am
++++ b/tests/lib/search/Makefile.am
+@@ -10,3 +10,3 @@ AM_CPPFLAGS = \
+ LIBS = @CHECK_LIBS@ \
+-	$(top_builddir)/lib/libmc.la @PCRE_LIBS@
++	$(top_builddir)/lib/libmc.la @PCRE_LIBS@ $(LIBINTL)
+ 
+--- a/tests/lib/vfs/Makefile.am
++++ b/tests/lib/vfs/Makefile.am
+@@ -14,3 +14,3 @@ EXTRA_DIST = mc.charsets
+ LIBS = @CHECK_LIBS@ \
+-	$(top_builddir)/lib/libmc.la
++	$(top_builddir)/lib/libmc.la $(LIBINTL)
+ 
+--- a/tests/lib/Makefile.in
++++ b/tests/lib/Makefile.in
+@@ -636 +636 @@ LIBPTH_PREFIX = @LIBPTH_PREFIX@
+-LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(am__append_1)
++LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(LIBINTL) $(am__append_1)
+--- a/tests/lib/mcconfig/Makefile.in
++++ b/tests/lib/mcconfig/Makefile.in
+@@ -542 +542 @@ LIBPTH_PREFIX = @LIBPTH_PREFIX@
+-LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(am__append_1)
++LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(LIBINTL) $(am__append_1)
+--- a/tests/lib/search/Makefile.in
++++ b/tests/lib/search/Makefile.in
+@@ -584,2 +584 @@ LIBPTH_PREFIX = @LIBPTH_PREFIX@
+-LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la @PCRE_LIBS@ \
+-	$(am__append_1)
++LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la @PCRE_LIBS@ $(LIBINTL) $(am__append_1)
+--- a/tests/lib/vfs/Makefile.in
++++ b/tests/lib/vfs/Makefile.in
+@@ -641 +641 @@ LIBPTH_PREFIX = @LIBPTH_PREFIX@
+-LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(am__append_1)
++LIBS = @CHECK_LIBS@ $(top_builddir)/lib/libmc.la $(LIBINTL) $(am__append_1)

diff --git a/app-misc/mc/files/mc-4.8.23-gettext.patch b/app-misc/mc/files/mc-4.8.23-gettext.patch
new file mode 100644
index 00000000000..3ad67dbe5d4
--- /dev/null
+++ b/app-misc/mc/files/mc-4.8.23-gettext.patch
@@ -0,0 +1,56 @@
+https://bugs.gentoo.org/693850
+https://midnight-commander.org/raw-attachment/ticket/3629/mc-3629-Linking-fix-for-gettext.patch
+
+From 2a97524b42eeececd2ecd928a1154da1f5b7378a Mon Sep 17 00:00:00 2001
+From: Andreas Mohr <and@×××.li>
+Date: Fri, 1 Apr 2016 06:44:22 +0000
+Subject: [PATCH] Linking fix for non-default gettext package
+
+mc lost the linking game if gettext package pulled from outside of system paths.
+(Pulling can be done by suitable C-/CPP/LDFLAGS settings)
+
+Furthermore gettext package depends on libintl (if system lib
+don't provide needed functions) then gettext prepare INITLIBS/LIBINTL variable
+for working libintl pull in from gettext libdir.
+
+https://www.gnu.org/software/gettext/FAQ.html#integrating_undefined
+
+Let respect LIBINTL variable at linking (it is empty if not needed).
+
+Failure example for Solaris 10 with non-system-default gettext package:
+
+Undefined                       first referenced
+ symbol                             in file
+ libintl_bind_textdomain_codeset     ./.libs/libinternal.a(args.o)
+ libintl_gettext                     main.o
+ libintl_textdomain                  main.o
+ libintl_bindtextdomain              main.o
+ libintl_ngettext                    ./.libs/libinternal.a(midnight.o)
+
+Signed-off-by: Andreas Mohr <and@×××.li>
+---
+ src/Makefile.am | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -53,7 +53,8 @@ libinternal_la_LIBADD = \
+ 
+ mc_LDADD = \
+ 	libinternal.la \
+-	$(top_builddir)/lib/libmc.la
++	$(top_builddir)/lib/libmc.la \
++	$(LIBINTL)
+ 
+ if ENABLE_VFS_SMB
+ # this is a hack for linking with own samba library in simple way
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -556,7 +557,7 @@ libinternal_la_LIBADD = \
+ 	viewer/libmcviewer.la \
+ 	$(DIFFLIB) $(EDITLIB) $(SUBSHELLLIB)
+ 
+-mc_LDADD = libinternal.la $(top_builddir)/lib/libmc.la $(am__append_6)
++mc_LDADD = libinternal.la $(top_builddir)/lib/libmc.la $(LIBINTL) $(am__append_6)
+ SRC_mc_conssaver = \
+ 	cons.handler.c consaver/cons.saver.h

diff --git a/app-misc/mc/mc-4.8.23-r1.ebuild b/app-misc/mc/mc-4.8.23-r1.ebuild
index 635d0001dcf..9bbeef2c62c 100644
--- a/app-misc/mc/mc-4.8.23-r1.ebuild
+++ b/app-misc/mc/mc-4.8.23-r1.ebuild
@@ -43,6 +43,8 @@ S=${WORKDIR}/${MY_P}
 PATCHES=(
 	"${FILESDIR}"/${P}-3933-iso9660-1.patch
 	"${FILESDIR}"/${P}-3933-iso9660-2.patch
+	"${FILESDIR}"/${PN}-4.8.23-gettext.patch
+	"${FILESDIR}"/${PN}-4.8.23-gettext-test.patch
 )
 
 pkg_pretend() {