commit:     b33711289c1fcb2b12f9bc2ffe77a5ebabee0a71
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Tue Jun 13 05:30:44 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu May  9 01:29:42 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b3371128

sys-fs/progsreiserfs: Fix error call to undeclared function _getopt_internal

Closes: https://bugs.gentoo.org/898616
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/31410
Signed-off-by: Sam James <sam <AT> gentoo.org>

 ...iserfs-0.3.1_rc8-musl-getopt_internal-fix.patch | 36 ++++++++++++
 .../progsreiserfs-0.3.1_rc8-r1.ebuild              | 67 ++++++++++++++++++++++
 2 files changed, 103 insertions(+)

diff --git 
a/sys-fs/progsreiserfs/files/progsreiserfs-0.3.1_rc8-musl-getopt_internal-fix.patch
 
b/sys-fs/progsreiserfs/files/progsreiserfs-0.3.1_rc8-musl-getopt_internal-fix.patch
new file mode 100644
index 000000000000..06ba7e357a55
--- /dev/null
+++ 
b/sys-fs/progsreiserfs/files/progsreiserfs-0.3.1_rc8-musl-getopt_internal-fix.patch
@@ -0,0 +1,36 @@
+Bug: https://bugs.gentoo.org/898616
+From: Brahmajit Das <[email protected]>
+Date: Tue, 13 Jun 2023 05:23:45 +0000
+Subject: [PATCH] getopt1.c: wrap the getopt_long and getopt_long_only
+ functions around include directive
+
+The header guard HAVE_GETOPT_LONG_ONLY can be used to check if the
+functions are available or not, as the functions getopt_long and
+getopt_long_only defined in getopt1.c uses the function _getopt_internal
+which is glibc specific and cannot be used on other libc systems (for
+example musl).
+Hence we're wrapping those two functions with this include guard.
+
+Bug: https://bugs.gentoo.org/898616
+Signed-off-by: Brahmajit Das <[email protected]>
+--- a/progsreiserfs/libmisc/getopt1.c
++++ b/progsreiserfs/libmisc/getopt1.c
+@@ -63,6 +63,7 @@
+ #define NULL 0
+ #endif
+ 
++#ifndef HAVE_GETOPT_LONG_ONLY
+ int
+       getopt_long(argc, argv, options, long_options, opt_index)
+        int argc;
+@@ -89,6 +90,7 @@ int
+ {
+       return _getopt_internal(argc, argv, options, long_options, opt_index, 
1);
+ }
++#endif
+ 
+ #endif /* Not ELIDE_CODE.  */
+ 
+-- 
+2.41.0
+

diff --git a/sys-fs/progsreiserfs/progsreiserfs-0.3.1_rc8-r1.ebuild 
b/sys-fs/progsreiserfs/progsreiserfs-0.3.1_rc8-r1.ebuild
new file mode 100644
index 000000000000..e7fe27e0eefc
--- /dev/null
+++ b/sys-fs/progsreiserfs/progsreiserfs-0.3.1_rc8-r1.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic libtool
+
+MY_P=${PN}-${PV/_/-}
+
+DESCRIPTION="Library for accessing and manipulating reiserfs partitions"
+HOMEPAGE="http://reiserfs.linux.kiev.ua/";
+SRC_URI="http://reiserfs.linux.kiev.ua/snapshots/${MY_P}.tar.gz";
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv 
~sparc ~x86"
+IUSE="debug examples nls static-libs"
+
+DEPEND="
+       sys-apps/util-linux
+       nls? (
+               sys-devel/gettext
+               virtual/libintl
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-autotools.patch
+       "${FILESDIR}"/${PN}-0.3.1_rc8-musl-getopt_internal-fix.patch
+)
+
+src_prepare() {
+       default
+
+       elibtoolize
+}
+
+src_configure() {
+       filter-lfs-flags
+
+       econf \
+               $(use_enable static-libs static) \
+               --disable-Werror \
+               $(use_enable nls) \
+               $(use_enable debug)
+}
+
+src_install() {
+       default
+
+       if use examples; then
+               docinto examples
+               dodoc demos/*.c
+       fi
+
+       find "${ED}" -name '*.la' -delete || die
+
+       rm -r "${ED}"/usr/{sbin,share/man} || die
+}
+
+pkg_postinst() {
+       ewarn "progsreiserfs has been proven dangerous in the past, generating 
bad"
+       ewarn "partitions and destroying data on resize/cpfs operations."
+       ewarn "Because of this, we do NOT provide their binaries, but only 
their"
+       ewarn "libraries instead, as these are needed for other applications."
+}

Reply via email to