Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] [WIP] Remove libintl dependency from some packages
@ 2021-03-05  2:17 ericonr
  2021-03-18 17:33 ` [PR PATCH] [Updated] " ericonr
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ericonr @ 2021-03-05  2:17 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 580 bytes --]

There is a new pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

[WIP] Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 11486 bytes --]

From 5fb3f9339cf2831e1f1bff4458c42dfd5101372b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.
---
 common/shlibs               |  9 ++++-----
 srcpkgs/gettext-devel-tools |  1 +
 srcpkgs/gettext/template    | 34 ++++++++++++++++++++++++----------
 3 files changed, 29 insertions(+), 15 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools

diff --git a/common/shlibs b/common/shlibs
index c836cc1a377..34302380bc9 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7_1
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 00000000000..d3a6700489c
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0..957f87e57ac 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -23,10 +23,10 @@ changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
 
-case "$XBPS_TARGET_MACHINE" in
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +35,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +49,37 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="gettext-libs>=${version}_${revision} gettext-devel-tools>=${version}_${revision} xz tar"
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in intl gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/aclocal
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	short_desc+=" - development tools"
+	pkg_install() {
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From 87283b5bca746f1b5430b4d9d1349edaf6acf969 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778..f9f9d0e3bc1 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From dd718daf677031bc1d69f515d2526955c2cd1f3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index 05daee1117a..f41658cfd4b 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.0
-revision=2
+revision=3
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=4f0293ed9f6a6b77e47d41efabe62f3319e86efc8bf83cc58733044fbc6f9211
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From ccfcc35cedba4efbe4285e5e288c1d8df75c2dce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c..364f229dba3 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From 524d64a3cbb418418b59571fc4b630b4c2c0fec6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 5/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index 0b4f25139b1..f76775beed4 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.0.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

From 494a1bb2d6a606f7a1cc70112548f7502b458833 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 6/6] gnutls: don't link against libintl.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8c..69c6ebecc7d 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
@ 2021-03-18 17:33 ` ericonr
  2021-03-24  2:10 ` ericonr
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-18 17:33 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

[WIP] Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 11843 bytes --]

From b7044c7ff9f28dfcc1b5bc1b56466f4fbc49e8db Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.
---
 common/shlibs               |  9 ++++---
 srcpkgs/gettext-devel-tools |  1 +
 srcpkgs/gettext/template    | 47 ++++++++++++++++++++++++++++---------
 3 files changed, 41 insertions(+), 16 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools

diff --git a/common/shlibs b/common/shlibs
index 6815daac2265..88a72b8b1d92 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7.18_3
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 000000000000..d3a6700489c5
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0f..7aa7c527113e 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -23,10 +23,18 @@ changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
 
-case "$XBPS_TARGET_MACHINE" in
+subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
+_intl_lib=
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+	subpackages+=" gettext-libs"
+	_intl_lib=intl
+else
+	# on glibc, old gettext-libs conflicts with new one
+	replaces="gettext-libs>=0"
+	conflicts="gettext-libs>=0"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +43,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +57,40 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="gettext-devel-tools>=${version}_${revision} xz tar"
+	if [ -n "${_intl_lib}" ]; then
+		depends+=" gettext-libs>=${version}_${revision}"
+	fi
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
-		vmove usr/share/aclocal
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in ${_intl_lib} gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	short_desc+=" - development tools"
+	pkg_install() {
+		vmove usr/share/aclocal
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From 0266e395f16443de18198e1f91511e02d5fff41a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778b..f9f9d0e3bc13 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From 7ad0593dfbf2649c21e535e26174f5158292e451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index 05daee1117aa..f41658cfd4b1 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.0
-revision=2
+revision=3
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=4f0293ed9f6a6b77e47d41efabe62f3319e86efc8bf83cc58733044fbc6f9211
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From 7ce511ced7eb52c0bfae2dc9429b409d83e070ff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c6..364f229dba30 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From 2f9638316a70c699594cd1b650023e8d6b4b4300 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 5/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index eaa22c6a06d4..ce42c986b260 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

From c02e125bbb626d51d183a1d9ba92d2cef507db9e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 6/6] gnutls: don't link against libintl.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8cf..69c6ebecc7d3 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
  2021-03-18 17:33 ` [PR PATCH] [Updated] " ericonr
@ 2021-03-24  2:10 ` ericonr
  2021-03-24  2:37 ` ericonr
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-24  2:10 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

[WIP] Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 11883 bytes --]

From 31abd9af5b1b370cc84099e88c6c21b97f196d72 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.
---
 common/shlibs               |  9 ++++---
 srcpkgs/gettext-devel-tools |  1 +
 srcpkgs/gettext/template    | 47 ++++++++++++++++++++++++++++---------
 3 files changed, 41 insertions(+), 16 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools

diff --git a/common/shlibs b/common/shlibs
index 4b82c3ced654..7319cc8d20cb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7.18_3
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 000000000000..d3a6700489c5
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0f..70696921b4cd 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -23,10 +23,18 @@ changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
 
-case "$XBPS_TARGET_MACHINE" in
+subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
+unset _intl_lib
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+	subpackages+=" gettext-libs"
+	_intl_lib=intl
+else
+	# on glibc, old gettext-libs conflicts with new one
+	replaces="gettext-libs>=0"
+	conflicts="gettext-libs>=0"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +43,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +57,40 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="gettext-devel-tools>=${version}_${revision} xz tar"
+	if [ -n "${_intl_lib}" ]; then
+		depends+=" gettext-libs>=${version}_${revision}"
+	fi
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
-		vmove usr/share/aclocal
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in ${_intl_lib} gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	short_desc+=" - development tools"
+	pkg_install() {
+		vmove usr/share/aclocal
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From 8231a2d0761e529285c4556eccf7090817648782 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778b..f9f9d0e3bc13 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From 88967a2ddac4276f2312860d89c1dea5cdc61e6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index c39fd784c423..800a781f214e 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.1
-revision=1
+revision=2
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=d8e49f4090d3778df17dd825e4a2a80192015682423cd9dd02b6675d65c3af5b
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From a2f1909bf8972dbf9112862dd8e4fb7dad628ee0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl for native builds.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c6..364f229dba30 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From d6260e47998bf35ca5d2878e0c670413c4cc9875 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 5/6] gnutls: don't link against libintl in native builds.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8cf..69c6ebecc7d3 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

From be374ede73f3be911dd185446fa962be610f40e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 6/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index eaa22c6a06d4..ce42c986b260 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
  2021-03-18 17:33 ` [PR PATCH] [Updated] " ericonr
  2021-03-24  2:10 ` ericonr
@ 2021-03-24  2:37 ` ericonr
  2021-03-24  2:45 ` ericonr
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-24  2:37 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

[WIP] Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 15995 bytes --]

From 2073493de15cb08e369e4c2cc1d9bc4e77fc094b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.

Also pull in Alpine patches fixing test failures.

gettext
---
 common/shlibs                                 |  9 ++--
 srcpkgs/gettext-devel-tools                   |  1 +
 srcpkgs/gettext/patches/musl-realpath.patch   | 41 ++++++++++++++++
 .../musl-unsupported-iconv-encoding.patch     | 44 +++++++++++++++++
 srcpkgs/gettext/template                      | 48 ++++++++++++++-----
 5 files changed, 127 insertions(+), 16 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools
 create mode 100644 srcpkgs/gettext/patches/musl-realpath.patch
 create mode 100644 srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch

diff --git a/common/shlibs b/common/shlibs
index 4b82c3ced654..7319cc8d20cb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7.18_3
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 000000000000..d3a6700489c5
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/patches/musl-realpath.patch b/srcpkgs/gettext/patches/musl-realpath.patch
new file mode 100644
index 000000000000..75a650895e07
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-realpath.patch
@@ -0,0 +1,41 @@
+https://gitlab.alpinelinux.org/alpine/aports/-/issues/12295
+This patch is necessary only with musl after 1.2.2
+
+----
+test-canonicalize.c:339: assertion 'strcmp (result1, "/") == 0' failed
+Aborted (core dumped)
+FAIL test-canonicalize (exit status: 134)
+----
+
+diff --git a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+index ff82981..17842e8 100644
+--- a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+@@ -208,8 +208,8 @@ main (void)
+ #ifndef __MVS__
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
+       }
+     else
+ #endif
+--- a/gettext-tools/gnulib-tests/test-canonicalize.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize.c
+@@ -336,10 +336,10 @@
+     ASSERT (stat ("//", &st2) == 0);
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
+-        ASSERT (strcmp (result3, "/") == 0);
+-        ASSERT (strcmp (result4, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
++        ASSERT (strcmp (result3, "/") == 0 || strcmp (result3, "//") == 0);
++        ASSERT (strcmp (result4, "/") == 0 || strcmp (result4, "//") == 0);
+       }
+     else
+       {
diff --git a/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
new file mode 100644
index 000000000000..de9a6b02b3a4
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
@@ -0,0 +1,44 @@
+As upstream notes:
+
+# Note: This test fails on Linux with musl libc versions that don't support
+# the BIG5 encoding in 'iconv'.
+
+diff --git a/gettext-tools/tests/msgconv-2 b/gettext-tools/tests/msgconv-2
+index d286cda..d96c487 100755
+--- a/gettext-tools/tests/msgconv-2
++++ b/gettext-tools/tests/msgconv-2
+@@ -7,6 +7,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the BIG5 encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > mco-test2.po
+ # Chinese translation for GNU gettext messages.
+ #
+diff --git a/gettext-tools/tests/msgmerge-compendium-6 b/gettext-tools/tests/msgmerge-compendium-6
+index 0afbe1e..1b2fe6b 100755
+--- a/gettext-tools/tests/msgmerge-compendium-6
++++ b/gettext-tools/tests/msgmerge-compendium-6
+@@ -10,6 +10,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-KR encoding in 'iconv'.
+ 
++Exit 77
++
+ : ${MSGCONV=msgconv}
+ ${MSGCONV} --to-code=UTF-8 -o mm-ko.utf-8.pot "$wabs_srcdir"/mm-ko.ascii.pot
+ 
+diff --git a/gettext-tools/tests/xgettext-python-3 b/gettext-tools/tests/xgettext-python-3
+index ca0926d..2c49fd7 100755
+--- a/gettext-tools/tests/xgettext-python-3
++++ b/gettext-tools/tests/xgettext-python-3
+@@ -6,6 +6,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-JP encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > xg-py-3a.py
+ #!/usr/bin/env python
+ # TRANSLATORS: Fran«®ois Pinard is a hero.
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0f..a41ff09d90e2 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -22,11 +22,20 @@ homepage="https://www.gnu.org/software/gettext/"
 changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
+patch_args=-Np1
 
-case "$XBPS_TARGET_MACHINE" in
+subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
+unset _intl_lib
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+	subpackages+=" gettext-libs"
+	_intl_lib=intl
+else
+	# on glibc, old gettext-libs conflicts with new one
+	replaces="gettext-libs>=0"
+	conflicts="gettext-libs>=0"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +44,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +58,40 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="gettext-devel-tools>=${version}_${revision} xz tar"
+	if [ -n "${_intl_lib}" ]; then
+		depends+=" gettext-libs>=${version}_${revision}"
+	fi
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
-		vmove usr/share/aclocal
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in ${_intl_lib} gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	short_desc+=" - development tools"
+	pkg_install() {
+		vmove usr/share/aclocal
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From 35e6541d7812a8bf347a4d7c0115934e7569eef6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778b..f9f9d0e3bc13 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From 13bff1dc89ba03b25f543fc5a2c664699aa219b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index c39fd784c423..800a781f214e 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.1
-revision=1
+revision=2
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=d8e49f4090d3778df17dd825e4a2a80192015682423cd9dd02b6675d65c3af5b
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From 334f7b125bf089322c342de9497b4c457e837615 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl for native builds.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c6..364f229dba30 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From 5b15088f596dcc71ba2c932e2461a8f536981e1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 5/6] gnutls: don't link against libintl in native builds.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8cf..69c6ebecc7d3 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

From 3e5b1d9d48cb2b3ecf673f3430616f2b0c648e26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 6/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index eaa22c6a06d4..ce42c986b260 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] [WIP] Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
                   ` (2 preceding siblings ...)
  2021-03-24  2:37 ` ericonr
@ 2021-03-24  2:45 ` ericonr
  2021-03-24  3:50 ` [PR PATCH] [Updated] " ericonr
  2021-03-24  3:51 ` [PR PATCH] [Merged]: " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-24  2:45 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 585 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

[WIP] Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 16082 bytes --]

From 1c148fb283d4d9f16085a01946e00942aed3b8ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.

Also pull in Alpine patches fixing test failures.

gettext
---
 common/shlibs                                 |  9 ++--
 srcpkgs/gettext-devel-tools                   |  1 +
 srcpkgs/gettext/patches/musl-realpath.patch   | 41 +++++++++++++++
 .../musl-unsupported-iconv-encoding.patch     | 44 ++++++++++++++++
 srcpkgs/gettext/template                      | 50 +++++++++++++++----
 5 files changed, 129 insertions(+), 16 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools
 create mode 100644 srcpkgs/gettext/patches/musl-realpath.patch
 create mode 100644 srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch

diff --git a/common/shlibs b/common/shlibs
index 4b82c3ced654..7319cc8d20cb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7.18_3
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 000000000000..d3a6700489c5
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/patches/musl-realpath.patch b/srcpkgs/gettext/patches/musl-realpath.patch
new file mode 100644
index 000000000000..75a650895e07
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-realpath.patch
@@ -0,0 +1,41 @@
+https://gitlab.alpinelinux.org/alpine/aports/-/issues/12295
+This patch is necessary only with musl after 1.2.2
+
+----
+test-canonicalize.c:339: assertion 'strcmp (result1, "/") == 0' failed
+Aborted (core dumped)
+FAIL test-canonicalize (exit status: 134)
+----
+
+diff --git a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+index ff82981..17842e8 100644
+--- a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+@@ -208,8 +208,8 @@ main (void)
+ #ifndef __MVS__
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
+       }
+     else
+ #endif
+--- a/gettext-tools/gnulib-tests/test-canonicalize.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize.c
+@@ -336,10 +336,10 @@
+     ASSERT (stat ("//", &st2) == 0);
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
+-        ASSERT (strcmp (result3, "/") == 0);
+-        ASSERT (strcmp (result4, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
++        ASSERT (strcmp (result3, "/") == 0 || strcmp (result3, "//") == 0);
++        ASSERT (strcmp (result4, "/") == 0 || strcmp (result4, "//") == 0);
+       }
+     else
+       {
diff --git a/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
new file mode 100644
index 000000000000..de9a6b02b3a4
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
@@ -0,0 +1,44 @@
+As upstream notes:
+
+# Note: This test fails on Linux with musl libc versions that don't support
+# the BIG5 encoding in 'iconv'.
+
+diff --git a/gettext-tools/tests/msgconv-2 b/gettext-tools/tests/msgconv-2
+index d286cda..d96c487 100755
+--- a/gettext-tools/tests/msgconv-2
++++ b/gettext-tools/tests/msgconv-2
+@@ -7,6 +7,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the BIG5 encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > mco-test2.po
+ # Chinese translation for GNU gettext messages.
+ #
+diff --git a/gettext-tools/tests/msgmerge-compendium-6 b/gettext-tools/tests/msgmerge-compendium-6
+index 0afbe1e..1b2fe6b 100755
+--- a/gettext-tools/tests/msgmerge-compendium-6
++++ b/gettext-tools/tests/msgmerge-compendium-6
+@@ -10,6 +10,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-KR encoding in 'iconv'.
+ 
++Exit 77
++
+ : ${MSGCONV=msgconv}
+ ${MSGCONV} --to-code=UTF-8 -o mm-ko.utf-8.pot "$wabs_srcdir"/mm-ko.ascii.pot
+ 
+diff --git a/gettext-tools/tests/xgettext-python-3 b/gettext-tools/tests/xgettext-python-3
+index ca0926d..2c49fd7 100755
+--- a/gettext-tools/tests/xgettext-python-3
++++ b/gettext-tools/tests/xgettext-python-3
+@@ -6,6 +6,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-JP encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > xg-py-3a.py
+ #!/usr/bin/env python
+ # TRANSLATORS: Fran«®ois Pinard is a hero.
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0f..9c423982f2f3 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -22,11 +22,20 @@ homepage="https://www.gnu.org/software/gettext/"
 changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
+patch_args=-Np1
 
-case "$XBPS_TARGET_MACHINE" in
+subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
+unset _intl_lib
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+	subpackages+=" gettext-libs"
+	_intl_lib=intl
+else
+	# on glibc, old gettext-libs conflicts with new one
+	replaces="gettext-libs>=0"
+	conflicts="gettext-libs>=0"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +44,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +58,42 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="${sourcepkg}>=${version}_${revision}
+	 gettext-devel-tools>=${version}_${revision} xz tar"
+	if [ -n "${_intl_lib}" ]; then
+		depends+=" gettext-libs>=${version}_${revision}"
+	fi
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
-		vmove usr/share/aclocal
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in ${_intl_lib} gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development tools"
+	pkg_install() {
+		vmove usr/share/aclocal
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From a03609f2c59b7c214927fed6cb2e7deb683c8ac4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778b..f9f9d0e3bc13 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From b83d94ec0899316c476d9879efecb73e770dc2dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index c39fd784c423..800a781f214e 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.1
-revision=1
+revision=2
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=d8e49f4090d3778df17dd825e4a2a80192015682423cd9dd02b6675d65c3af5b
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From 303d1ac5ac7aa7f5f02e885836cec931b6aaa987 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl for native builds.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c6..364f229dba30 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From 89a070f4d7c4064589b84f3079e95b67fef3d8ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 5/6] gnutls: don't link against libintl in native builds.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8cf..69c6ebecc7d3 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

From 51e95195d00f185db9db0c2bccddb6ef5a693b28 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 6/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index eaa22c6a06d4..ce42c986b260 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Updated] Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
                   ` (3 preceding siblings ...)
  2021-03-24  2:45 ` ericonr
@ 2021-03-24  3:50 ` ericonr
  2021-03-24  3:51 ` [PR PATCH] [Merged]: " ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-24  3:50 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 579 bytes --]

There is an updated pull request by ericonr against master on the void-packages repository

https://github.com/ericonr/void-packages gettext
https://github.com/void-linux/void-packages/pull/29240

Remove libintl dependency from some packages
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

A patch file from https://github.com/void-linux/void-packages/pull/29240.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-gettext-29240.patch --]
[-- Type: text/x-diff, Size: 16073 bytes --]

From 40a1a438e95788e327d336c13951189c9f9b5a3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:31:38 -0300
Subject: [PATCH 1/6] gettext: reorganize so gettext-libs only ships versioned
 libintl.so.

Move unrelated libraries to gettext package, since they are only used by
it and by gtranslator, which will for the most part be installed
alongside gtranslator already.

The main purpose with this PR is to stop shipping unversioned libintl.so
in gettext-libs. What happens in this case is that packages built
natively for musl with localization support will have gettext in
hostmakedepends, which will lead to gettext-libs being in the host, and,
consequently, /usr/lib/libintl.so being available.

Due to CMake's FindIntl being bad, CMake projects will assume they
should use libintl.so instead of the gettext support from libc, and link
against it unnecessarily (and sometimes innefectively: CMake points the
compiler at /usr/include/libintl.h instead of our
/usr/include/gettext/libintl.h, which means the musl header will be used
instead, and unless the main executable is linked against libintl, the
library's functions won't even be used). Leaving only the essential
libraries in gettext-libs (versioned libintl.so files) and guaranteeing
gettext doesn't pull in the unversioned one means many packages won't
depend on libintl unnecessarily any more. As a matter of fact, this is a
case where our cross builds were more "correct" than native ones, since
libintl.so in the host won't be found for the target.

Furthermore, some packages require autopoint(1) in order to run
autoreconf; to avoid depending on gettext-devel for it, and ending up
linking in libintl into the final binary, we split it into the
gettext-devel-tools subpackage as well.

Also pull in Alpine patches fixing test failures.
---
 common/shlibs                                 |  9 ++--
 srcpkgs/gettext-devel-tools                   |  1 +
 srcpkgs/gettext/patches/musl-realpath.patch   | 41 +++++++++++++++
 .../musl-unsupported-iconv-encoding.patch     | 44 ++++++++++++++++
 srcpkgs/gettext/template                      | 50 +++++++++++++++----
 5 files changed, 129 insertions(+), 16 deletions(-)
 create mode 120000 srcpkgs/gettext-devel-tools
 create mode 100644 srcpkgs/gettext/patches/musl-realpath.patch
 create mode 100644 srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch

diff --git a/common/shlibs b/common/shlibs
index 4b82c3ced654..7319cc8d20cb 100644
--- a/common/shlibs
+++ b/common/shlibs
@@ -176,11 +176,10 @@ libxfce4panel-2.0.so.4 libxfce4panel-4.12.0_1
 libgdbm.so.6 gdbm-1.16_1
 libgdbm_compat.so.4 gdbm-1.10_1_1
 libintl.so.8 gettext-libs-0.19.2_1
-libgnuintl.so.8 gettext-libs-0.19.2_1
-libgettextlib-0.21.so gettext-libs-0.21_1
-libgettextsrc-0.21.so gettext-libs-0.21_1
-libgettextpo.so.0 gettext-libs-0.17_1
-libtextstyle.so.0 gettext-libs-0.20.1_1
+libgettextlib-0.21.so gettext-0.21_3
+libgettextsrc-0.21.so gettext-0.21_3
+libtextstyle.so.0 gettext-0.21_3
+libgettextpo.so.0 gettext-0.21_3
 libattr.so.1 attr-2.4.43_1
 libacl.so.1 acl-2.2.47_1
 libpython2.7.so.1.0 python-2.7.18_3
diff --git a/srcpkgs/gettext-devel-tools b/srcpkgs/gettext-devel-tools
new file mode 120000
index 000000000000..d3a6700489c5
--- /dev/null
+++ b/srcpkgs/gettext-devel-tools
@@ -0,0 +1 @@
+gettext
\ No newline at end of file
diff --git a/srcpkgs/gettext/patches/musl-realpath.patch b/srcpkgs/gettext/patches/musl-realpath.patch
new file mode 100644
index 000000000000..75a650895e07
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-realpath.patch
@@ -0,0 +1,41 @@
+https://gitlab.alpinelinux.org/alpine/aports/-/issues/12295
+This patch is necessary only with musl after 1.2.2
+
+----
+test-canonicalize.c:339: assertion 'strcmp (result1, "/") == 0' failed
+Aborted (core dumped)
+FAIL test-canonicalize (exit status: 134)
+----
+
+diff --git a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+index ff82981..17842e8 100644
+--- a/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize-lgpl.c
+@@ -208,8 +208,8 @@ main (void)
+ #ifndef __MVS__
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
+       }
+     else
+ #endif
+--- a/gettext-tools/gnulib-tests/test-canonicalize.c
++++ b/gettext-tools/gnulib-tests/test-canonicalize.c
+@@ -336,10 +336,10 @@
+     ASSERT (stat ("//", &st2) == 0);
+     if (SAME_INODE (st1, st2))
+       {
+-        ASSERT (strcmp (result1, "/") == 0);
+-        ASSERT (strcmp (result2, "/") == 0);
+-        ASSERT (strcmp (result3, "/") == 0);
+-        ASSERT (strcmp (result4, "/") == 0);
++        ASSERT (strcmp (result1, "/") == 0 || strcmp (result1, "//") == 0);
++        ASSERT (strcmp (result2, "/") == 0 || strcmp (result2, "//") == 0);
++        ASSERT (strcmp (result3, "/") == 0 || strcmp (result3, "//") == 0);
++        ASSERT (strcmp (result4, "/") == 0 || strcmp (result4, "//") == 0);
+       }
+     else
+       {
diff --git a/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
new file mode 100644
index 000000000000..de9a6b02b3a4
--- /dev/null
+++ b/srcpkgs/gettext/patches/musl-unsupported-iconv-encoding.patch
@@ -0,0 +1,44 @@
+As upstream notes:
+
+# Note: This test fails on Linux with musl libc versions that don't support
+# the BIG5 encoding in 'iconv'.
+
+diff --git a/gettext-tools/tests/msgconv-2 b/gettext-tools/tests/msgconv-2
+index d286cda..d96c487 100755
+--- a/gettext-tools/tests/msgconv-2
++++ b/gettext-tools/tests/msgconv-2
+@@ -7,6 +7,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the BIG5 encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > mco-test2.po
+ # Chinese translation for GNU gettext messages.
+ #
+diff --git a/gettext-tools/tests/msgmerge-compendium-6 b/gettext-tools/tests/msgmerge-compendium-6
+index 0afbe1e..1b2fe6b 100755
+--- a/gettext-tools/tests/msgmerge-compendium-6
++++ b/gettext-tools/tests/msgmerge-compendium-6
+@@ -10,6 +10,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-KR encoding in 'iconv'.
+ 
++Exit 77
++
+ : ${MSGCONV=msgconv}
+ ${MSGCONV} --to-code=UTF-8 -o mm-ko.utf-8.pot "$wabs_srcdir"/mm-ko.ascii.pot
+ 
+diff --git a/gettext-tools/tests/xgettext-python-3 b/gettext-tools/tests/xgettext-python-3
+index ca0926d..2c49fd7 100755
+--- a/gettext-tools/tests/xgettext-python-3
++++ b/gettext-tools/tests/xgettext-python-3
+@@ -6,6 +6,8 @@
+ # Note: This test fails on Linux with musl libc versions that don't support
+ # the EUC-JP encoding in 'iconv'.
+ 
++Exit 77
++
+ cat <<\EOF > xg-py-3a.py
+ #!/usr/bin/env python
+ # TRANSLATORS: Fran«®ois Pinard is a hero.
diff --git a/srcpkgs/gettext/template b/srcpkgs/gettext/template
index 06079609ba0f..3c8250b976be 100644
--- a/srcpkgs/gettext/template
+++ b/srcpkgs/gettext/template
@@ -1,7 +1,7 @@
 # Template file for 'gettext'
 pkgname=gettext
 version=0.21
-revision=2
+revision=3
 build_style=gnu-configure
 configure_args="--disable-java --disable-native-java --disable-csharp
  --disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
@@ -22,11 +22,20 @@ homepage="https://www.gnu.org/software/gettext/"
 changelog="https://git.savannah.gnu.org/cgit/gettext.git/plain/NEWS"
 distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12
+patch_args=-Np1
 
-case "$XBPS_TARGET_MACHINE" in
+subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
+unset _intl_lib
+if [ "$XBPS_TARGET_LIBC" = musl ]; then
 	# force libintl
-	*-musl) configure_args+=" --with-included-gettext";;
-esac
+	configure_args+=" --with-included-gettext"
+	subpackages+=" gettext-libs"
+	_intl_lib=intl
+else
+	# on glibc, old gettext-libs conflicts with gettext
+	replaces="gettext-libs>=0"
+	conflicts="gettext-libs>=0"
+fi
 
 if [ "$CROSS_BUILD" ]; then
 	hostmakedepends+=" automake libtool"
@@ -35,10 +44,9 @@ if [ "$CROSS_BUILD" ]; then
 	}
 fi
 
-
 post_install() {
-	# Fix conflict with musl.
-	if [ -e ${DESTDIR}/usr/include/libintl.h ]; then
+	# don't overwrite musl's header
+	if [ "$XBPS_TARGET_LIBC" = musl ]; then
 		vmkdir usr/include/gettext
 		mv ${DESTDIR}/usr/include/libintl.h ${DESTDIR}/usr/include/gettext/libintl.h
 	fi
@@ -50,22 +58,42 @@ gettext-devel-examples_package() {
 		vmove usr/share/doc/gettext
 	}
 }
+
 gettext-devel_package() {
-	depends="gettext-libs>=${version}_${revision} xz tar"
+	depends="${sourcepkg}>=${version}_${revision}
+	 gettext-devel-tools>=${version}_${revision} xz tar"
+	if [ -n "${_intl_lib}" ]; then
+		depends+=" gettext-libs>=${version}_${revision}"
+	fi
 	short_desc+=" - development files"
 	pkg_install() {
 		vmove usr/include
-		vmove usr/lib/*.a
-		vmove usr/share/aclocal
+		vmove "usr/lib/*.a"
+		# libgettext{lib,src}-$version.so need to be in the main package
+		for _lib in ${_intl_lib} gettextlib gettextpo gettextsrc textstyle
+		do
+			vmove "usr/lib/lib${_lib}.so"
+		done
 		vmove usr/share/gettext
 		vmove usr/share/man/man3
+	}
+}
+
+gettext-devel-tools_package() {
+	depends="${sourcepkg}>=${version}_${revision}"
+	short_desc+=" - development tools"
+	pkg_install() {
+		vmove usr/share/aclocal
 		vmove usr/bin/autopoint
 		vmove usr/bin/gettextize
+		vmove usr/share/man/man1/autopoint.1
+		vmove usr/share/man/man1/gettextize.1
 	}
 }
+
 gettext-libs_package() {
 	short_desc+=" - shared libraries"
 	pkg_install() {
-		vmove usr/lib/*.so*
+		vmove "usr/lib/libintl.so.*"
 	}
 }

From a6ce4c24225bb15d3a55fc1be547e33af59188fa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:46:28 -0300
Subject: [PATCH 2/6] gtranslator: revbump for gettext re-org.

---
 srcpkgs/gtranslator/template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/srcpkgs/gtranslator/template b/srcpkgs/gtranslator/template
index d0c49d1d778b..f9f9d0e3bc13 100644
--- a/srcpkgs/gtranslator/template
+++ b/srcpkgs/gtranslator/template
@@ -1,7 +1,7 @@
 # Template file for 'gtranslator'
 pkgname=gtranslator
 version=3.38.0
-revision=1
+revision=2
 build_style=meson
 hostmakedepends="gettext pkg-config glib-devel itstool"
 makedepends="gettext-devel libglib-devel libdazzle-devel libsoup-devel

From 6ab2a8c1b18432a1b39905404f92139a043bcc2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 18:53:22 -0300
Subject: [PATCH 3/6] fish: don't link against libintl.

---
 srcpkgs/fish-shell/template | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/fish-shell/template b/srcpkgs/fish-shell/template
index c39fd784c423..800a781f214e 100644
--- a/srcpkgs/fish-shell/template
+++ b/srcpkgs/fish-shell/template
@@ -1,11 +1,11 @@
 # Template file for 'fish-shell'
 pkgname=fish-shell
 version=3.2.1
-revision=1
+revision=2
 wrksrc="fish-${version}"
 build_style=cmake
 hostmakedepends="gettext"
-makedepends="ncurses-devel pcre2-devel gettext-devel"
+makedepends="ncurses-devel pcre2-devel"
 depends="groff"
 checkdepends="python3-pexpect procps-ng"
 short_desc="User friendly shell intended mostly for interactive use"
@@ -15,6 +15,8 @@ homepage="https://fishshell.com/"
 distfiles="https://github.com/fish-shell/fish-shell/releases/download/${version}/fish-${version}.tar.xz"
 checksum=d8e49f4090d3778df17dd825e4a2a80192015682423cd9dd02b6675d65c3af5b
 register_shell="/bin/fish /usr/bin/fish"
+# tests don't work as root
+make_check=extended
 
 if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
 	makedepends+=" libatomic-devel"

From ab239ceef2adb671c9c6a97fb96fcdcb7aaa1095 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:40:16 -0300
Subject: [PATCH 4/6] inkscape: don't link against libintl for native builds.

---
 srcpkgs/inkscape/template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/inkscape/template b/srcpkgs/inkscape/template
index dd549fae36c6..364f229dba30 100644
--- a/srcpkgs/inkscape/template
+++ b/srcpkgs/inkscape/template
@@ -1,13 +1,13 @@
 # Template file for 'inkscape'
 pkgname=inkscape
 version=1.0.2
-revision=1
+revision=2
 wrksrc="inkscape-${version}_2021-01-15_e86c870879"
 build_style=cmake
 # builds executables then runs checks
 # FIXME: some tests still fail on musl
 make_check_target=check
-hostmakedepends="automake pkg-config libtool intltool gettext-devel
+hostmakedepends="automake pkg-config libtool intltool gettext
  glib-devel perl-XML-Parser tar which xz"
 makedepends="harfbuzz-devel libsoup-devel gsl-devel pango-devel
  double-conversion-devel gc-devel libwpd-devel libcdr-devel libvisio-devel

From a4c29f385f807689cda8ee717ca2fd35919a9a1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 23:07:39 -0300
Subject: [PATCH 5/6] gnutls: don't link against libintl in native builds.

Also remove autoreconf, not necessary for now when configure.ac isn't
being patched.
---
 srcpkgs/gnutls/template | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/srcpkgs/gnutls/template b/srcpkgs/gnutls/template
index 681f6c7ca8cf..69c6ebecc7d3 100644
--- a/srcpkgs/gnutls/template
+++ b/srcpkgs/gnutls/template
@@ -1,13 +1,15 @@
 # Template file for 'gnutls'
 pkgname=gnutls
 version=3.6.15
-revision=1
+revision=2
 build_style=gnu-configure
 configure_args="--with-zlib --disable-guile --disable-static
  --disable-valgrind-tests --disable-rpath
  --with-default-trust-store-file=/etc/ssl/certs/ca-certificates.crt
  --with-trousers-lib=${XBPS_CROSS_BASE}/usr/lib"
-hostmakedepends="automake gettext-devel libtool pkg-config which"
+hostmakedepends="gettext libtool pkg-config which"
+# for autoreconf
+#hostmakedepends+=" gettext-devel-tools automake"
 makedepends="zlib-devel lzo-devel readline-devel libgpg-error-devel
  libtasn1-devel libgcrypt-devel p11-kit-devel nettle-devel libidn2-devel
  libunistring-devel unbound-devel trousers-devel"
@@ -19,10 +21,6 @@ homepage="https://gnutls.org"
 distfiles="https://www.gnupg.org/ftp/gcrypt/gnutls/v${version%.*}/gnutls-${version}.tar.xz"
 checksum=0ea8c3283de8d8335d7ae338ef27c53a916f15f382753b174c18b45ffd481558
 
-pre_configure() {
-	autoreconf -vfi
-}
-
 pre_check() {
 	# same as $PASS in tests/cert-tests/certtool
 	export GNUTLS_PIN=1234

From 539710511e77358e5770b5a54974907e07b20134 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=89rico=20Rolim?= <erico.erc@gmail.com>
Date: Thu, 4 Mar 2021 22:42:05 -0300
Subject: [PATCH 6/6] weechat: generate translations and don't link against
 libintl.

The gnutls-devels -> gnutls -> gettext-libs chain pulled in libintl.so,
which ended up unnecessarily linked into the binary.

Ironically, no localization files were generated, because gettext wasn't
in hostmakedepends.
---
 srcpkgs/weechat/template | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/srcpkgs/weechat/template b/srcpkgs/weechat/template
index eaa22c6a06d4..ce42c986b260 100644
--- a/srcpkgs/weechat/template
+++ b/srcpkgs/weechat/template
@@ -1,12 +1,13 @@
 # Template file for 'weechat'
 pkgname=weechat
 version=3.1
-revision=1
+revision=2
 build_style=cmake
 configure_args="-DENABLE_MAN=ON -DENABLE_PERL=ON
  -DENABLE_LUA=ON -DENABLE_RUBY=ON -DENABLE_SPELL=ON
  -DENABLE_GUILE=OFF -DENABLE_PHP=OFF -DENABLE_JAVASCRIPT=OFF"
-hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel"
+hostmakedepends="ruby-asciidoctor libgcrypt-devel pkg-config python3 tcl-devel
+ gettext"
 makedepends="aspell-devel gnutls-devel libcurl-devel lua53-devel ncurses-devel
  perl python3-devel ruby-devel tcl-devel"
 depends="ca-certificates"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PR PATCH] [Merged]: Remove libintl dependency from some packages
  2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
                   ` (4 preceding siblings ...)
  2021-03-24  3:50 ` [PR PATCH] [Updated] " ericonr
@ 2021-03-24  3:51 ` ericonr
  5 siblings, 0 replies; 7+ messages in thread
From: ericonr @ 2021-03-24  3:51 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 423 bytes --]

There's a merged pull request on the void-packages repository

Remove libintl dependency from some packages
https://github.com/void-linux/void-packages/pull/29240

Description:
The initial commit explains most of the situation. Basically remove unnecessary / useless libintl dependency from some musl packages, where possible. Starting with packages I use myself and can test, would appreciate testing from others as well.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-24  3:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05  2:17 [PR PATCH] [WIP] Remove libintl dependency from some packages ericonr
2021-03-18 17:33 ` [PR PATCH] [Updated] " ericonr
2021-03-24  2:10 ` ericonr
2021-03-24  2:37 ` ericonr
2021-03-24  2:45 ` ericonr
2021-03-24  3:50 ` [PR PATCH] [Updated] " ericonr
2021-03-24  3:51 ` [PR PATCH] [Merged]: " ericonr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).