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.
This commit is contained in:
Érico Rolim 2021-03-04 18:31:38 -03:00 committed by Érico Nogueira Rolim
parent 3e0e3a005a
commit e1091a5c5b
5 changed files with 131 additions and 18 deletions

View file

@ -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

1
srcpkgs/gettext-devel-tools Symbolic link
View file

@ -0,0 +1 @@
gettext

View file

@ -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
{

View file

@ -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<61>«®ois Pinard is a hero.

View file

@ -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
vmove usr/bin/autopoint
vmove usr/bin/gettextize
}
}
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.*"
}
}