commit:     2c3570d00fdefba43d9a51c327d866bdf185372e
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Sun Feb  8 07:07:38 2026 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Mar 11 15:55:48 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2c3570d0

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 <AT> 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 <AT> gentoo.org>

 app-i18n/enca/enca-1.19-r4.ebuild                  | 72 ++++++++++++++++++++++
 .../files/enca-1.19-remove_extern_getopt.patch     | 14 +++++
 2 files changed, 86 insertions(+)

diff --git a/app-i18n/enca/enca-1.19-r4.ebuild 
b/app-i18n/enca/enca-1.19-r4.ebuild
new file mode 100644
index 000000000000..9165c33143d9
--- /dev/null
+++ b/app-i18n/enca/enca-1.19-r4.ebuild
@@ -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
+}

diff --git a/app-i18n/enca/files/enca-1.19-remove_extern_getopt.patch 
b/app-i18n/enca/files/enca-1.19-remove_extern_getopt.patch
new file mode 100644
index 000000000000..170dc9826116
--- /dev/null
+++ b/app-i18n/enca/files/enca-1.19-remove_extern_getopt.patch
@@ -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

Reply via email to