app-i18n/enca: update EAPI 7 -> 8, fix build with gcc-musl

It also should fix cross-compilation on OS X

Closes: https://bugs.gentoo.org/969521
Signed-off-by: NHOrus <jy6x2b32pie9@yahoo.com>
Part-of: https://github.com/gentoo/gentoo/pull/45682
Closes: https://github.com/gentoo/gentoo/pull/45682
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
NHOrus
2026-02-08 10:07:38 +03:00
committed by Sam James
parent a2a68f5729
commit 2c3570d00f
2 changed files with 86 additions and 0 deletions
+72
View File
@@ -0,0 +1,72 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools toolchain-funcs
DESCRIPTION="Detect and convert encoding of text files"
HOMEPAGE="https://cihar.com/software/enca/"
SRC_URI="https://dl.cihar.com/${PN}/${P}.tar.xz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~x64-macos"
IUSE="doc +iconv recode"
BDEPEND="doc? ( dev-util/gtk-doc )"
RDEPEND="
iconv? ( virtual/libiconv )
recode? ( app-text/recode:= )
"
DEPEND="
${RDEPEND}
sys-devel/gettext
"
PATCHES=( "${FILESDIR}/${P}-remove_extern_getopt.patch" )
pkg_pretend() {
if tc-is-cross-compiler && use iconv; then
die "${PN} can't be cross built with iconv USE enabled. See Gentoo bug 593220."
fi
}
src_prepare() {
default
# Disable unconditional documentation build.
sed -i -e '/SUBDIRS/s/ devel-docs//g' Makefile.am || die
eautoreconf
}
src_configure() {
local myeconfargs=(
--enable-external
--disable-static
$(use_enable doc gtk-doc)
$(use_with iconv libiconv-prefix "${EPREFIX}/usr")
$(use_with recode librecode "${EPREFIX}/usr")
)
# Workaround automagic virtual/libiconv dependency.
use iconv || export am_cv_func_iconv=no
econf "${myeconfargs[@]}"
}
src_compile() {
# Workaround cross compilation issues. See Gentoo bug 424473.
tc-is-cross-compiler && tc-env_build emake -e -C tools
emake
use doc && emake -C devel-docs docs
}
src_install() {
emake DESTDIR="${D}" install
use doc && emake -C devel-docs DESTDIR="${D}" install
find "${ED}" -name '*.la' -delete || die
}
@@ -0,0 +1,14 @@
https://bugs.gentoo.org/969521
Patch by Jonathan Lovelace
Bug also happens on gcc-musl system, this fixes it.
diff -ru a/src/getopt.h b/src/getopt.h
--- a/src/getopt.h 2010-01-14 05:45:46.000000000 -0500
+++ b/src/getopt.h 2026-02-02 11:34:49.329689765 -0500
@@ -144,7 +144,6 @@
errors, only prototype getopt for the GNU C library. */
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
# else /* not __GNU_LIBRARY__ */
-extern int getopt ();
# endif /* __GNU_LIBRARY__ */
# ifndef __need_getopt