From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1588667-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256)
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 7127C158451
	for <garchives@archives.gentoo.org>; Mon,  8 Jan 2024 16:54:54 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B1F722BC014;
	Mon,  8 Jan 2024 16:54:53 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 8DEC72BC014
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 16:54:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 8300D3432D1
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 16:54:52 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id D2B2995D
	for <gentoo-commits@lists.gentoo.org>; Mon,  8 Jan 2024 16:54:50 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1704732814.c798862e4a607518927bf3353524a24f2dbb480f.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-libs/openipmi/files/, sys-libs/openipmi/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-libs/openipmi/files/openipmi-2.0.33-c99.patch sys-libs/openipmi/openipmi-2.0.33-r1.ebuild
X-VCS-Directories: sys-libs/openipmi/files/ sys-libs/openipmi/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: c798862e4a607518927bf3353524a24f2dbb480f
X-VCS-Branch: master
Date: Mon,  8 Jan 2024 16:54:50 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 52e0f557-246e-439f-b677-4918a7f40204
X-Archives-Hash: b69669aea712ebbbf9a76461f454c3d2

commit:     c798862e4a607518927bf3353524a24f2dbb480f
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Mon Jan  8 16:53:34 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Mon Jan  8 16:53:34 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c798862e

sys-libs/openipmi: fix modern C issue w/ USE=perl

Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-libs/openipmi/files/openipmi-2.0.33-c99.patch | 56 +++++++++++++
 sys-libs/openipmi/openipmi-2.0.33-r1.ebuild       | 98 +++++++++++++++++++++++
 2 files changed, 154 insertions(+)

diff --git a/sys-libs/openipmi/files/openipmi-2.0.33-c99.patch b/sys-libs/openipmi/files/openipmi-2.0.33-c99.patch
new file mode 100644
index 000000000000..b7786c3ceab1
--- /dev/null
+++ b/sys-libs/openipmi/files/openipmi-2.0.33-c99.patch
@@ -0,0 +1,56 @@
+https://sourceforge.net/p/openipmi/patches/38/
+
+C type errors in the SWIG-generated Perl bindings
+
+The first change fixes an error with newer compilers:
+
+OpenIPMI_wrap.c: In function ‘_wrap_strconstarray_val_set’:
+OpenIPMI_wrap.c:10491:27: error: assignment to ‘const char **’ from incompatible pointer type ‘char **’
+10491 |     if (arg1) (arg1)->val = arg2;
+      |                           ^
+
+The second change is also about a compiler error:
+
+In file included from /usr/lib64/perl5/CORE/perl.h:4530,
+                 from OpenIPMI_wrap.c:751:
+OpenIPMI_wrap.c: In function ‘_wrap_ipmi_sol_conn_t_write’:
+/usr/lib64/perl5/CORE/sv.h:1952:31: error: passing argument 3 of ‘Perl_SvPV_helper’ from incompatible pointer type
+ 1952 |    Perl_SvPV_helper(aTHX_ sv, &len, flags, SvPVnormal_type_,                \
+/usr/lib64/perl5/CORE/sv.h:1972:37: note: in expansion of macro ‘SvPV_flags’
+ 1972 | #define SvPV(sv, len)               SvPV_flags(sv, len, SV_GMAGIC)
+      |                                     ^~~~~~~~~~
+OpenIPMI_wrap.c:27664:24: note: in expansion of macro ‘SvPV’
+27664 |         (&arg2)->val = SvPV(tempsv, (&arg2)->len);
+      |                        ^~~~
+In file included from /usr/lib64/perl5/CORE/perl.h:7812:
+/usr/lib64/perl5/CORE/sv_inline.h:908:33: note: expected ‘STRLEN * const’ {aka ‘long unsigned int * const’} but argument is of type ‘int *’
+  908 |                  STRLEN * const lp,
+      |                  ~~~~~~~~~~~~~~~^~
+
+But the existing code looks broken on big-endian 64-bit architectures,
+too.
+
+--- a/swig/OpenIPMI.i
++++ b/swig/OpenIPMI.i
+@@ -359,7 +359,7 @@ typedef struct iargarray
+ %}
+ typedef struct strconstarray
+ {
+-    char **val;
++    const char **val;
+     int len;
+ } strconstarray;
+ typedef struct argarray
+--- a/swig/perl/OpenIPMI_lang.i
++++ b/swig/perl/OpenIPMI_lang.i
+@@ -292,7 +292,9 @@
+ 	$1.val = NULL;
+ 	$1.len = 0;
+     } else {
+-	$1.val = SvPV(tempsv, $1.len);
++	STRLEN len;
++	$1.val = SvPV(tempsv, len);
++	$1.len = len;
+     }
+ }
+ 

diff --git a/sys-libs/openipmi/openipmi-2.0.33-r1.ebuild b/sys-libs/openipmi/openipmi-2.0.33-r1.ebuild
new file mode 100644
index 000000000000..26db37796649
--- /dev/null
+++ b/sys-libs/openipmi/openipmi-2.0.33-r1.ebuild
@@ -0,0 +1,98 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{9..11} )
+inherit autotools python-single-r1
+
+MY_PN="OpenIPMI"
+MY_P="${MY_PN}-${PV/_/-}"
+DESCRIPTION="Library interface to IPMI"
+HOMEPAGE="https://sourceforge.net/projects/openipmi/"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="LGPL-2.1 GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~x86"
+IUSE="crypt snmp perl python static-libs tcl"
+
+RDEPEND="
+	dev-libs/glib:2
+	dev-libs/popt
+	sys-libs/gdbm:=
+	sys-libs/ncurses:=
+	sys-libs/readline:=
+	crypt? ( dev-libs/openssl:= )
+	snmp? ( net-analyzer/net-snmp )
+	perl? ( dev-lang/perl:= )
+	python? ( ${PYTHON_DEPS} )
+	tcl? ( dev-lang/tcl:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+	>=dev-lang/swig-1.3.21
+	virtual/pkgconfig
+"
+
+# Gui is broken!
+#		python? ( tcl? ( tk? ( dev-lang/tk dev-tcltk/tix ) ) )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-2.0.26-tinfo.patch" # bug #501510
+	"${FILESDIR}/${PN}-2.0.33-c99.patch"
+)
+
+pkg_setup() {
+	use python && python-single-r1_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# For tinfo patch
+	eautoreconf
+}
+
+src_configure() {
+	local myconf=(
+		# These binaries are for root!
+		--bindir="${EPREFIX}"/usr/sbin
+		--with-glib
+		--with-glibver=2.0
+		--with-swig
+		--without-tkinter
+		$(use_with snmp ucdsnmp yes)
+		$(use_with crypt openssl yes)
+		$(use_with perl perl yes)
+		$(use_with tcl tcl yes)
+		$(use_with python python yes)
+	)
+
+	# GUI is broken
+	#use tk && use python && use !tcl && \
+	#	ewarn "Not building Tk GUI because it needs both Python AND Tcl"
+	#if use python && use tcl; then
+	#	myconf+=( $(use_with tk tkinter) )
+	#else
+	#	myconf+=( --without-tkinter )
+	#fi
+
+	econf "${myconf[@]}"
+}
+
+src_install() {
+	emake DESTDIR="${D}" install
+	dodoc README* FAQ ChangeLog TODO doc/IPMI.pdf lanserv/README.vm
+	newdoc cmdlang/README README.cmdlang
+
+	use python && python_optimize
+
+	find "${ED}" -name "*.la" -delete || die
+
+	if ! use static-libs ; then
+		find "${ED}" -name "*.a" -delete || die
+	fi
+}