commit:     953cbc6f8a30cbde3975c00fcfb7a926a15ad28c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 16 06:28:57 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 16 06:29:11 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=953cbc6f

sys-apps/help2man: add 1.48.5

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/help2man/Manifest                         |   1 +
 .../help2man/files/help2man-1.48.5-cygwin.patch    | 167 +++++++++++++++++++++
 sys-apps/help2man/help2man-1.48.5.ebuild           |  44 ++++++
 3 files changed, 212 insertions(+)

diff --git a/sys-apps/help2man/Manifest b/sys-apps/help2man/Manifest
index dc717cbf51..591e813c6c 100644
--- a/sys-apps/help2man/Manifest
+++ b/sys-apps/help2man/Manifest
@@ -1 +1,2 @@
 DIST help2man-1.47.16.tar.xz 203036 BLAKE2B 
8e06c2c2e90adfc2ab8345908516b15ae50b02a7a9554d5d9beee4373b71c131aeaa0c148b9a988c531bbfe2149c25069af56a79101a4248b6c1adfeb734a132
 SHA512 
b427e60a9e3d2e805caf1ae84c337b09c7ca6f92b7ff14771f946c4a1bf7adf177df99b9c1c223ad76df99756005ababf5b548ff8e08d4746702ff7f8150b544
+DIST help2man-1.48.5.tar.xz 204672 BLAKE2B 
6d96f5f65f8c637d524e5c373f2b89f114adf544c1d3508a9cb51115279b9bf6399c8ebb0a8d831de12ef8cdaca40b6e75412a221efc5d2dd1794e9c9643196f
 SHA512 
800eb0daa9daef8e423d52ede55eee2960122ea0269865295afada4cf4fcc1c6791da8429c3a57c0fc1bf0a14c8a77953952325413a8faa5dd07b1bc5bc0edd1

diff --git a/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch 
b/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch
new file mode 100644
index 0000000000..aa75d10e38
--- /dev/null
+++ b/sys-apps/help2man/files/help2man-1.48.5-cygwin.patch
@@ -0,0 +1,167 @@
+https://cygwin.com/git-cygwin-packages/?p=git/cygwin-packages/help2man.git;a=blob;f=help2man-preload-intl.patch;h=2fbc34bbc6bc7a36414257a29fee13944f5c087c;hb=b47c3b0de257e3cda4455e16e196e629c69d28e7
+
+LD_PRELOAD by itself only works with Cygwin builtin functions, but
+textdomain() and friends come from libintl.  In order to override
+those functions, we have to "replace" cygintl-?.dll since functions are
+bound to a DLL name at link time.  Our replacement will be used since
+it is loaded first by LD_PRELOAD.
+
+But as we are making this *the* libintl, we need to provide 
+pass-throughs for the other functions which we're not overriding,
+otherwise Locale::gettext won't load (not to mention the program
+that we're trying to help2man).
+
+--- origsrc/help2man-1.48.5/Makefile.in        2020-03-15 04:52:00.000000000 
-0600
++++ src/help2man-1.48.5/Makefile.in    2021-09-07 03:10:00.000000000 -0600
+@@ -76,7 +76,8 @@ install_base:
+ 
+ install_preload: preload
+       $(MKINSTALLDIRS) $(DESTDIR)$(pkglibdir)
+-      $(INSTALL_PROGRAM) $(preload).so $(DESTDIR)$(pkglibdir)
++      $(INSTALL_PROGRAM) lib/cygintl-8.dll $(DESTDIR)$(pkglibdir)
++      ln -sf cygintl-8.dll $(DESTDIR)$(pkglibdir)/$(preload).so
+ 
+ install_l10n: msg_l10n man_l10n info_l10n
+       set -e; \
+@@ -145,7 +146,9 @@ $(target).h2m: $(srcdir)/$(target).h2m.PL
+ 
+ preload: $(preload).so
+ $(preload).so: $(srcdir)/$(preload).c
+-      $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o $@ -fPIC -shared $? $(LIBS)
++      mkdir -p lib
++      $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) -o lib/cygintl-8.dll -shared $? 
$(LIBS)
++      ln -sf lib/cygintl-8.dll $@
+ 
+ man: $(target).1
+ $(target).1: $(srcdir)/$(target).PL $(srcdir)/$(target).h2m.PL
+--- origsrc/help2man-1.48.5/bindtextdomain.c   2009-11-13 00:01:34.000000000 
-0600
++++ src/help2man-1.48.5/bindtextdomain.c       2011-12-29 00:24:33.608078600 
-0600
+@@ -36,12 +36,34 @@ static char *(*r_textdomain)(char const *) = 0;
+ static char *(*r_bindtextdomain)(char const *, char const *) = 0;
+ static char *(*r_bind_textdomain_codeset)(char const *, char const *) = 0;
+ 
++#ifdef __CYGWIN__
++static void *RTLD_NEXT = 0;
++static char *(*r_gettext)(const char *) = 0;
++static char *(*r_dgettext)(const char *, const char *) = 0;
++static char *(*r_dcgettext)(const char *, const char *, int) = 0;
++static char *(*r_ngettext)(const char *, const char *, unsigned long int) = 0;
++static char *(*r_dngettext)(const char *, const char *, const char *,
++                            unsigned long int) = 0;
++static char *(*r_dcngettext)(const char *, const char *, const char *,
++                             unsigned long int, int) = 0;
++static char *(*r_setlocale)(int, const char *) = 0;
++
++#define SYM(sym) libintl_ ## sym
++#else
++#define SYM(sym) sym
++#endif
++
+ void setup()
+ {
+     static int done = 0;
+     if (done++)
+         return;
+ 
++#ifdef __CYGWIN__
++    if (!(RTLD_NEXT = dlopen("/usr/bin/cygintl-8.dll", RTLD_LAZY)))
++        die("libintl8 not found");
++#endif
++
+     if (!(e_textdomain = getenv("TEXTDOMAIN")))
+       die("TEXTDOMAIN not set");
+ 
+@@ -57,9 +79,19 @@ void setup()
+     if (!(r_bind_textdomain_codeset = dlsym(RTLD_NEXT,
+                                           "bind_textdomain_codeset")))
+       die("can't find symbol \"bind_textdomain_codeset\"");
++
++#ifdef __CYGWIN__
++    r_gettext = dlsym(RTLD_NEXT, "libintl_gettext");
++    r_dgettext = dlsym(RTLD_NEXT, "libintl_dgettext");
++    r_dcgettext = dlsym(RTLD_NEXT, "libintl_dcgettext");
++    r_ngettext = dlsym(RTLD_NEXT, "libintl_ngettext");
++    r_dngettext = dlsym(RTLD_NEXT, "libintl_dngettext");
++    r_dcngettext = dlsym(RTLD_NEXT, "libintl_dcngettext");
++    r_setlocale = dlsym(RTLD_NEXT, "libintl_setlocale");
++#endif
+ }
+ 
+-char *textdomain(char const *domainname)
++char *SYM(textdomain)(char const *domainname)
+ {
+     char *r;
+     setup();
+@@ -70,7 +102,7 @@ char *textdomain(char const *domainname)
+     return r;
+ }
+ 
+-char *bindtextdomain(char const *domainname, char const *dirname)
++char *SYM(bindtextdomain)(char const *domainname, char const *dirname)
+ {
+     char const *dir = dirname;
+     setup();
+@@ -80,7 +112,7 @@ char *bindtextdomain(char const *domainname,
+     return r_bindtextdomain(domainname, dir);
+ }
+ 
+-char *bind_textdomain_codeset(char const *domainname, char const *codeset)
++char *SYM(bind_textdomain_codeset)(char const *domainname, char const 
*codeset)
+ {
+     char *r;
+     setup();
+@@ -90,3 +122,54 @@ char *bind_textdomain_codeset(char const
+ 
+     return r;
+ }
++
++#ifdef __CYGWIN__
++
++char *libintl_gettext(const char *msgid)
++{
++    setup();
++    return r_gettext(msgid);
++}
++
++char *libintl_dgettext (const char *domainname, const char *msgid)
++{
++    setup();
++    return r_dgettext(domainname, msgid);
++}
++
++char *libintl_dcgettext (const char *domainname, const char *msgid,
++                         int category)
++{
++    setup();
++    return r_dcgettext (domainname, msgid, category);
++}
++
++char *libintl_ngettext (const char *msgid1, const char *msgid2,
++                        unsigned long int n)
++{
++    setup();
++    return r_ngettext (msgid1, msgid2, n);
++}
++
++char *libintl_dngettext (const char *domainname, const char *msgid1,
++                         const char *msgid2, unsigned long int n)
++{
++    setup();
++    return r_dngettext (domainname, msgid1, msgid2, n);
++}
++
++char *libintl_dcngettext (const char *domainname,
++                          const char *msgid1, const char *msgid2,
++                          unsigned long int n, int category)
++{
++    setup();
++    return r_dcngettext (domainname, msgid1, msgid2, n, category);
++}
++
++char *libintl_setlocale (int i, const char *s)
++{
++    setup();
++    return r_setlocale (i, s);
++}
++
++#endif

diff --git a/sys-apps/help2man/help2man-1.48.5.ebuild 
b/sys-apps/help2man/help2man-1.48.5.ebuild
new file mode 100644
index 0000000000..6f98d5da46
--- /dev/null
+++ b/sys-apps/help2man/help2man-1.48.5.ebuild
@@ -0,0 +1,44 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="GNU utility to convert program --help output to a man page"
+HOMEPAGE="https://www.gnu.org/software/help2man/";
+SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls"
+
+RDEPEND="dev-lang/perl
+       nls? ( dev-perl/Locale-gettext )"
+DEPEND="${RDEPEND}"
+
+DOCS=( debian/changelog NEWS README THANKS ) #385753
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-1.46.1-linguas.patch
+)
+
+src_prepare() {
+       default
+
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               sed -i \
+                       -e 's/-shared/-bundle/' \
+                       Makefile.in || die
+       fi
+
+       use elibc_Cygwin && eapply -p2 "${FILESDIR}"/${PN}-1.48.5-cygwin.patch
+}
+
+src_configure() {
+       # Disable gettext requirement as the release includes the gmo files 
#555018
+       local myeconfargs=(
+               ac_cv_path_MSGFMT=$(type -P false)
+               $(use_enable nls)
+       )
+       econf "${myeconfargs[@]}"
+}

Reply via email to