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

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).