void-packages/srcpkgs/gettext/template
Érico Rolim e1091a5c5b 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.
2021-03-24 00:51:08 -03:00

99 lines
2.8 KiB
Bash

# Template file for 'gettext'
pkgname=gettext
version=0.21
revision=3
build_style=gnu-configure
configure_args="--disable-java --disable-native-java --disable-csharp
--disable-libasprintf --enable-threads=posix --disable-rpath --without-emacs
--disable-acl --with-included-glib --with-included-libcroco --without-git
--with-included-libxml --with-included-libunistring --disable-openmp
--disable-curses --without-examples --enable-nls
gl_cv_func_gettimeofday_clobber=no"
# gettext will try to use xz bzip2 gzip to compress
# /usr/share/gettext/archive.dir.tar.<ext>
# Either:
# - Have xz in hostmakedepends; or
# - Let gettext-devel depends on bzip2
hostmakedepends="xz"
short_desc="Internationalized Message Handling Library and tools"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-3.0-or-later"
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
subpackages="gettext-devel-examples gettext-devel gettext-devel-tools"
unset _intl_lib
if [ "$XBPS_TARGET_LIBC" = musl ]; then
# force libintl
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"
pre_configure() {
autoreconf -fi
}
fi
post_install() {
# 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
}
gettext-devel-examples_package() {
short_desc+=" - examples for development"
pkg_install() {
vmove usr/share/doc/gettext
}
}
gettext-devel_package() {
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"
# 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/libintl.so.*"
}
}