commit:     a50c8f48bd841bd7f17f3110dd1562248d39961c
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Dec  8 03:20:02 2020 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Dec  8 03:20:02 2020 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=a50c8f48

sys-apps/help2man: adjust Cygwin patch

* Use cygwinports patch again
* Rebase the Makefile hunk

Package-Manager: Portage-3.0.12-prefix, Repoman-3.0.2
RepoMan-Options: --force
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-apps/help2man/Manifest                         |   1 -
 .../help2man/files/help2man-1.47.16-cygwin.patch   | 165 +++++++++++++++++++++
 sys-apps/help2man/help2man-1.47.16.ebuild          |  18 ++-
 3 files changed, 175 insertions(+), 9 deletions(-)

diff --git a/sys-apps/help2man/Manifest b/sys-apps/help2man/Manifest
index 6a284f99aa..f01b7eebe1 100644
--- a/sys-apps/help2man/Manifest
+++ b/sys-apps/help2man/Manifest
@@ -1,5 +1,4 @@
 DIST help2man-1.40.4-cygwin-nls.patch 5371 BLAKE2B 
998988ee4c66d3e029d2279b4acd3c02d68df9fbd0d780670d03a5246e8308d1ba7c0c98e810d9527ed27ac11331a26c2b74dedcd0e722e7d78dd1cf8c95c851
 SHA512 
f21e82a5d96b886c7859205937f04ad8e83408ffa1a223106dd055a7a722dccf2d1e428b9e354cd49f0e38059e92fcc72da7aeb39984463492f801bd54b5d5c6
-DIST help2man-1.40.4-cygwin-nls.patch-2 5394 BLAKE2B 
16381050e40f05659846ce769cd60198af4731a24b1a36e14455a58318e6850a15a560adb25469a53e3b59e83a79110c5d5b616e65224a0bd8b70b23af4564eb
 SHA512 
3129eabaeecb2cf70e031f2473f723bd5cd09e861e30914273fd8c08b5b2fb48a78ee7830d605b009847c9fd7c4a8c51cc3964d2a6d426167fb5d37be49600a0
 DIST help2man-1.47.16.tar.xz 203036 BLAKE2B 
8e06c2c2e90adfc2ab8345908516b15ae50b02a7a9554d5d9beee4373b71c131aeaa0c148b9a988c531bbfe2149c25069af56a79101a4248b6c1adfeb734a132
 SHA512 
b427e60a9e3d2e805caf1ae84c337b09c7ca6f92b7ff14771f946c4a1bf7adf177df99b9c1c223ad76df99756005ababf5b548ff8e08d4746702ff7f8150b544
 DIST help2man-1.47.6.tar.xz 192980 BLAKE2B 
ddf2b899e4479a45505aefaf3dabfceb1595128da35c000b81be79046aabceff58e1d605b2797880c5c652947d0fe59673eaf087de911152e79768c571037a73
 SHA512 
d24849b93de58b20f518c071687e7bfa653a96600382f36c4cf7fc1047656458f75f093b911b786b18b6931b2453cb60868ecbe07cc7d2984e5981a874b34942
 DIST help2man-1.47.7.tar.xz 200128 BLAKE2B 
bdac9d1db29b03bbb8e41caecfdf3a7273b69d9b9fa2e206b2e6c28d1144c3104b8d4b7d4a43aab1b405bffd6e097db63a2f4e97a76dfcd980ee5d8a9ffc2114
 SHA512 
e6ec25d973df68edde87d3314b1bef2e679d57d4c9e024bca17362b9da058c80314050e1ae61d73179b8c2662c8692caa1f223fc48b8d02f2d4f040d16e51d14

diff --git a/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch 
b/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch
new file mode 100644
index 0000000000..e1dd22b8b1
--- /dev/null
+++ b/sys-apps/help2man/files/help2man-1.47.16-cygwin.patch
@@ -0,0 +1,165 @@
+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.40.4/bindtextdomain.c   2009-11-13 00:01:34.000000000 
-0600
++++ src/help2man-1.40.4/bindtextdomain.c       2011-12-29 00:24:33.608078600 
-0600
+@@ -27,12 +27,34 @@ static char *(*r_textdomain)(char const
+ 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");
+ 
+@@ -48,9 +70,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();
+@@ -61,7 +93,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();
+@@ -71,7 +103,7 @@ char *bindtextdomain(char const *domainn
+     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();
+@@ -81,3 +113,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
+--- src/help2man-1.47.16/Makefile.in
++++ src/help2man-1.47.16/Makefile.in
+@@ -83,7 +83,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; \
+@@ -152,7 +153,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

diff --git a/sys-apps/help2man/help2man-1.47.16.ebuild 
b/sys-apps/help2man/help2man-1.47.16.ebuild
index 9fe158d130..4f6dc6903f 100644
--- a/sys-apps/help2man/help2man-1.47.16.ebuild
+++ b/sys-apps/help2man/help2man-1.47.16.ebuild
@@ -7,13 +7,12 @@ 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"
 
-# Was: 
https://raw.githubusercontent.com/cygwinports/help2man/${CYGWIN_PATCHREV}/${CYGWIN_PATCH}
 -> ${PN}-${CYGWIN_PATCH}
-CYGWIN_PATCHREV="adf3e6f73a4857e55594f140d6282d9ff5362f5a"
-CYGWIN_PATCH="1.40.4-cygwin-nls.patch"
-CYGWIN_REV="-2"
-SRC_URI+=" elibc_Cygwin? (
-       
https://raw.githubusercontent.com/msys2/MSYS2-packages/master/help2man/${CYGWIN_PATCH}
 -> ${PN}-${CYGWIN_PATCH}${CYGWIN_REV}
-)"
+# Needed to rebase the Makefile hunk, now in files/
+#CYGWIN_PATCHREV="60ae068c5e01fbed4ee3f86107f7df64d596a864"
+#CYGWIN_PATCH="1.40.4-cygwin-nls.patch"
+#SRC_URI+=" elibc_Cygwin? (
+#      
https://raw.githubusercontent.com/cygwinports/help2man/${CYGWIN_PATCHREV}/${CYGWIN_PATCH}
 -> ${PN}-${CYGWIN_PATCH}
+#)"
 
 LICENSE="GPL-3"
 SLOT="0"
@@ -36,8 +35,11 @@ src_prepare() {
                        -e 's/-shared/-bundle/' \
                        Makefile.in || die
        fi
+
        default
-       use elibc_Cygwin && eapply -p2 
"${DISTDIR}/${PN}-${CYGWIN_PATCH}${CYGWIN_REV}"
+
+       use elibc_Cygwin && eapply -p2 "${FILESDIR}"/${PN}-1.47.16-cygwin.patch
+       #use elibc_Cygwin && eapply -p2 "${DISTDIR}/${PN}-${CYGWIN_PATCH}"
 }
 
 src_configure() {

Reply via email to