From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1695949-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 (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id C42FF1581FB
	for <garchives@archives.gentoo.org>; Sun,  1 Dec 2024 12:12:48 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 79624E0844;
	Sun,  1 Dec 2024 12:12:47 +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))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 54A74E0844
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Dec 2024 12:12:47 +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))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 685E5335C36
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Dec 2024 12:12:46 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9351D1EC5
	for <gentoo-commits@lists.gentoo.org>; Sun,  1 Dec 2024 12:12:43 +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: <1733054990.79fc88962cf8975b263e8a86703bfc00de5f155a.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-electronics/ngspice/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sci-electronics/ngspice/Manifest sci-electronics/ngspice/metadata.xml sci-electronics/ngspice/ngspice-43.ebuild
X-VCS-Directories: sci-electronics/ngspice/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 79fc88962cf8975b263e8a86703bfc00de5f155a
X-VCS-Branch: master
Date: Sun,  1 Dec 2024 12:12:43 +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: 53c11483-4a39-421c-ac47-70657c859a36
X-Archives-Hash: e3922488ad428051b61784418385ac4d

commit:     79fc88962cf8975b263e8a86703bfc00de5f155a
Author:     Fabio Rossi <rossi.f <AT> inwind <DOT> it>
AuthorDate: Mon Oct  7 12:56:49 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Dec  1 12:09:50 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=79fc8896

sci-electronics/ngspice: add latest version 43

- added embedded KLU support

Closes: https://bugs.gentoo.org/919371
Closes: https://bugs.gentoo.org/920210
Closes: https://bugs.gentoo.org/922664
Closes: https://bugs.gentoo.org/939955
Signed-off-by: Fabio Rossi <rossi.f <AT> inwind.it>
Closes: https://github.com/gentoo/gentoo/pull/38922
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sci-electronics/ngspice/Manifest          |   2 +
 sci-electronics/ngspice/metadata.xml      |   1 +
 sci-electronics/ngspice/ngspice-43.ebuild | 216 ++++++++++++++++++++++++++++++
 3 files changed, 219 insertions(+)

diff --git a/sci-electronics/ngspice/Manifest b/sci-electronics/ngspice/Manifest
index 8cdb55d9e36c..e112eb71c247 100644
--- a/sci-electronics/ngspice/Manifest
+++ b/sci-electronics/ngspice/Manifest
@@ -1,2 +1,4 @@
 DIST ngspice-40-manual.pdf 2462604 BLAKE2B a0d680cd76f8acb1be18e94953d70784aaf79e1bcc4bc3995a1221d81e27c13e577d182e7cbacb8430a068db7d86681f22ec4f3537b5704faacb8e982588617f SHA512 1a5c7828aa9a4554052fb01145641415d8a4cbd50db9885d5d937e1b6f50c7c541dfeeabf2efd6ea862036b4d74ce8265bdac1cfad0fc635f28651a0d397bfc5
 DIST ngspice-40.tar.gz 9431981 BLAKE2B e45d5d7a9e8d9d3fdae4eb076090a588680055a74cc24ba9ca3d93a7c42b95ee29073101d5791f8069cb27b3049aa1a451476f1df6460477fb156336602678fd SHA512 dab422cc8677e6f4bb92e06be0ce695a53d3e9abbe533c7bb91540d55d2a13514b0b166c8ccafcc17699799a846a35e260dddc400664c6e1137e1b18504e9954
+DIST ngspice-43-manual.pdf 2559027 BLAKE2B 71c86d4325025900db0d7ae961134111f1004490f827be64322cf1109e3781630f4ad7f70006a5e086914b6ec1b8a82bfc013219237d52838cb9dcbd4ece52bb SHA512 01bd68983c10ca8ef2a399354290032a0e9a9881159a3781459c576e662efa91af403ef191e846694ef418a8aec3e867d8e916d8a41a6d616d3169daf22be444
+DIST ngspice-43.tar.gz 10279606 BLAKE2B a866866dfe6dec238241406fe323baa22fd4145e7bda9e234cee507690fe224938663423ffc3fc37bf86093a982151ad96a5ba53fe292161f901297eef1cf892 SHA512 ad938e6ea8f9874c04d1033599bf39d3728e763fbd42ba77bd036b6c00271600695b3656f3f34547c39153382f55e7d7d5d6cb732f272d149cdbe21988c0d636

diff --git a/sci-electronics/ngspice/metadata.xml b/sci-electronics/ngspice/metadata.xml
index f145a23291ff..22f3ebfaa0e5 100644
--- a/sci-electronics/ngspice/metadata.xml
+++ b/sci-electronics/ngspice/metadata.xml
@@ -11,6 +11,7 @@
 	</longdescription>
 	<use>
 		<flag name="deprecated">Build old and deprecated apps</flag>
+		<flag name="klu">Add support for KLU (embedded version of suitesparse)</flag>
 		<flag name="shared">Build ngspice as a shared library</flag>
 	</use>
 	<upstream>

diff --git a/sci-electronics/ngspice/ngspice-43.ebuild b/sci-electronics/ngspice/ngspice-43.ebuild
new file mode 100644
index 000000000000..be5b137533cd
--- /dev/null
+++ b/sci-electronics/ngspice/ngspice-43.ebuild
@@ -0,0 +1,216 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic multibuild toolchain-funcs virtualx
+
+DESCRIPTION="The Next Generation Spice (Electronic Circuit Simulator)"
+HOMEPAGE="http://ngspice.sourceforge.net"
+SRC_URI="
+	https://downloads.sourceforge.net/ngspice/${P}.tar.gz
+	doc? ( https://downloads.sourceforge.net/ngspice/${P}-manual.pdf )
+"
+
+LICENSE="BSD GPL-2 MPL-2.0"
+SLOT="0"
+IUSE="X debug deprecated doc examples fftw +klu openmp +readline +shared tcl"
+KEYWORDS="~amd64 ~arm64 ~ppc ~riscv ~sparc ~x86 ~x64-macos"
+RESTRICT="!test? ( test )"
+
+DEPEND="
+	sys-libs/ncurses:=
+	X? (
+		x11-libs/libXaw
+		x11-libs/libXt
+		x11-libs/libX11
+	)
+	fftw? ( sci-libs/fftw:3.0= )
+	readline? ( sys-libs/readline:= )
+	tcl? (
+		dev-lang/tcl:=
+		dev-tcltk/blt
+	)
+"
+RDEPEND="${DEPEND}"
+
+DOCS=(
+	ANALYSES
+	AUTHORS
+	BUGS
+	ChangeLog
+	DEVICES
+	FAQ
+	NEWS
+	README
+	README.vdmos
+	Stuarts_Poly_Notes
+)
+
+pkg_pretend() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+}
+
+pkg_setup() {
+	[[ ${MERGE_TYPE} != binary ]] && use openmp && tc-check-openmp
+
+	MULTIBUILD_VARIANTS=( "binaries" )
+	use shared && MULTIBUILD_VARIANTS+=( "shared" )
+	use tcl && MULTIBUILD_VARIANTS+=( "tcl" )
+}
+
+src_prepare() {
+	default
+
+	if use tcl; then
+		if use examples; then
+			find examples/tclspice -type f -iname \*tcl -or -iname \*.sh |
+			while read s
+			do
+				sed -i -e 's@../../../src/.libs/libspice.so@libspice.so@g' \
+					-e 's@package require BLT@package require Tk\npackage require BLT@g' \
+					-e "s@spice::codemodel \(.*\)/\(.*\).cm@spice::codemodel /usr/$(get_libdir)/ngspice/\2.cm@g" \
+					"${s}" || die "sed failed"
+			done
+		fi
+	fi
+
+	eautoreconf
+	multibuild_copy_sources
+}
+
+src_configure() {
+	# -Werror=lto-type-mismatch
+	# https://bugs.gentoo.org/862513
+	# https://sourceforge.net/p/ngspice/bugs/665/
+	filter-lto
+
+	multibuild_foreach_variant ngspice_configure
+}
+
+ngspice_configure() {
+	local myeconfargs
+
+	pushd "${BUILD_DIR}" &>/dev/null || die
+
+	if use debug; then
+		myeconfargs=(
+			--enable-debug
+			--enable-ftedebug
+			--enable-cpdebug
+			--enable-sensdebug
+			--enable-asdebug
+			--enable-stepdebug
+			--enable-pzdebug
+		)
+	else
+		myeconfargs=(
+			--disable-debug
+			--disable-ftedebug
+			--disable-cpdebug
+			--disable-sensdebug
+			--disable-asdebug
+			--disable-stepdebug
+			--disable-pzdebug
+		)
+	fi
+
+	# As of March 2021, these do not compile
+	myeconfargs+=(
+		--disable-blktmsdebug
+		--disable-smltmsdebug
+	)
+
+	myeconfargs+=(
+		--enable-xspice
+		--enable-cider
+		--disable-rpath
+		$(use_enable klu)
+		$(use_enable openmp)
+		$(use_with fftw fftw3)
+		$(use_with readline)
+	)
+
+	if [[ "${MULTIBUILD_VARIANT}" == "shared" ]]; then
+		myeconfargs+=( --with-ngshared )
+	elif [[ "${MULTIBUILD_VARIANT}" == "tcl" ]]; then
+		myeconfargs+=( --with-tcl="${EPREFIX}/usr/$(get_libdir)" )
+	else
+		myeconfargs+=(
+			$(use_enable deprecated oldapps)
+			$(use_with X x)
+		)
+	fi
+
+	econf "${myeconfargs[@]}"
+
+	popd &>/dev/null || die
+}
+
+src_compile() {
+	multibuild_foreach_variant ngspice_compile
+}
+
+ngspice_compile() {
+	pushd "${BUILD_DIR}" &>/dev/null || die
+	default
+	popd &>/dev/null || die
+}
+
+src_test() {
+	if ! use debug; then
+		# tests can be only executed for the binaries variant
+		pushd "${WORKDIR}/${P}-binaries" &>/dev/null || die
+		echo "set ngbehavior=mc" > "${HOME}"/.spiceinit || die "Failed to configure ${PN} for running the test suite"
+		virtx default
+		popd &>/dev/null || die
+	else
+		# https://sourceforge.net/p/ngspice/bugs/353/
+		ewarn
+		ewarn "Skipping tests because they are known to fail in debug mode"
+		ewarn
+	fi
+}
+
+src_install() {
+	multibuild_foreach_variant ngspice_install
+
+	# merge the installations of all variants
+	local v
+	for v in "${MULTIBUILD_VARIANTS[@]}" ; do
+		cp -a "${ED}/tmp/${v}"/* "${ED}" || die "Failed to combine multibuild installations"
+	done
+	rm -rf "${ED}/tmp" || die
+
+	use tcl && DOCS+=( README.tcl )
+	use shared && DOCS+=( README.shared-xspice )
+	use doc && DOCS+=( "${DISTDIR}"/${P}-manual.pdf )
+
+	default
+
+	if use examples; then
+		if ! use tcl; then
+			rm -rf examples/tclspice || die
+		fi
+
+		insinto /usr/share/${PN}
+		doins -r examples
+	fi
+}
+
+ngspice_install() {
+	pushd "${BUILD_DIR}" &>/dev/null || die
+
+	emake DESTDIR="${ED}/tmp/${MULTIBUILD_VARIANT}" install
+
+	# Strip shared-library and Tcl-module builds to the bare minimum;
+	# all the support files will have been handled by the 'binaries' build.
+	if [[ "${MULTIBUILD_VARIANT}" != "binaries" ]]; then
+		rm -rf "${ED}/tmp/${MULTIBUILD_VARIANT}"/usr/bin{,.debug} || die
+		rm -rf "${ED}/tmp/${MULTIBUILD_VARIANT}"/usr/share || die
+		rm -rf "${ED}/tmp/${MULTIBUILD_VARIANT}"/usr/$(get_libdir)/*.la || die
+		rm -rf "${ED}/tmp/${MULTIBUILD_VARIANT}"/usr/$(get_libdir)/ngspice/*.cm{,.debug} || die
+	fi
+
+	popd &>/dev/null || die
+}