repo/gentoo:master commit in: dev-libs/nspr/

"Joonas Niilola" <[email protected]>
Newsgroups gmane.linux.gentoo.cvs
Message-ID <1786107391.7ed9d86482eef4691ad48ea1d6a6ca8a5240ec5c.juippis@gentoo>
commit:     7ed9d86482eef4691ad48ea1d6a6ca8a5240ec5c
Author:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
AuthorDate: Fri Aug  7 12:56:31 2026 +0000
Commit:     Joonas Niilola <juippis <AT> gentoo <DOT> org>
CommitDate: Fri Aug  7 12:56:31 2026 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7ed9d864

dev-libs/nspr: add 4.40

Signed-off-by: Joonas Niilola <juippis <AT> gentoo.org>

 dev-libs/nspr/Manifest         |   1 +
 dev-libs/nspr/nspr-4.40.ebuild | 160 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 161 insertions(+)

diff --git a/dev-libs/nspr/Manifest b/dev-libs/nspr/Manifest
index 49d2132cb614..b83f64482b34 100644
--- a/dev-libs/nspr/Manifest
+++ b/dev-libs/nspr/Manifest
@@ -1,3 +1,4 @@
 DIST nspr-4.36.tar.gz 1036274 BLAKE2B 369d851db0f425f0c6c3cdaeb333320860b77b49b40b77cc983998de3f9128f9d987f143e9f2ce155d609fb23f3f9ed0d0abe7d74e20c59763e2b9bdd1835817 SHA512 55d21e196508ad29a179639fc8006f44b04dc2c0b5a85895e727f0a4f0ea37aeeceb936e37ac6b271b882a18e9f06d96133a60f19cee6345f8424c1c66e270ee
 DIST nspr-4.38.2.tar.gz 1025394 BLAKE2B 1e677504bed875651d7204d6df1a0f9671233bdab5a7b7cfdd691084c16c31a74a1126569372e4fe59edc8318b622551f979fbe55c8e64df1d977dbd63962cac SHA512 f17302b0973ab006f9e6af70199ac6bb40d6266f96ab4d6692f56c24979907a7f0a20cf9d926aa80084f2e0ce7dfd56de89a7547b5e7e8caafa7afa5eb0b7bd8
 DIST nspr-4.39.tar.gz 1014093 BLAKE2B dfb8a050ee29974d5226c4140901ba1704af9ddf6939053e495cf698b23c2eb2aff4fec968cb321648ea4cb373cd85cb81283693b11d2b761e3dcc85294dfa57 SHA512 201627666814552e3c98f66a0bdb18194670dcbdbc8cf3241079d918891d46aef1b10e9339beb84802d1de4189993340febab27344e97f8de21ceb1f43c77bda
+DIST nspr-4.40.tar.gz 1008989 BLAKE2B 91fcb301f001068190c9a0e0c792d7decb46bc56c26a7f2b0001aa4b322c71d2bfaecfa7f3467befb7ec1dfecd31694f164cdc3f1c49abcc30c3859896e3f1ac SHA512 7b1256da87e85287f4e2dab1ea735459044c258831f186bc662640c11ab0d96c8e28cd618ea6cb5178cf185e928c2dd967131154327a3bcb0d2ebdb7d560dff2

diff --git a/dev-libs/nspr/nspr-4.40.ebuild b/dev-libs/nspr/nspr-4.40.ebuild
new file mode 100644
index 000000000000..03eea63a2379
--- /dev/null
+++ b/dev-libs/nspr/nspr-4.40.ebuild
@@ -0,0 +1,160 @@
+# Copyright 1999-2026 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic toolchain-funcs multilib-minimal
+
+MIN_PV="$(ver_cut 2)"
+
+DESCRIPTION="Netscape Portable Runtime"
+HOMEPAGE="https://www.mozilla.org/projects/nspr/"
+SRC_URI="https://archive.mozilla.org/pub/nspr/releases/v${PV}/src/${P}.tar.gz"
+
+LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos ~x64-solaris"
+IUSE="debug"
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/nspr-config
+)
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-4.7.1-solaris.patch
+	"${FILESDIR}"/${PN}-4.8.4-darwin-install_name.patch
+	"${FILESDIR}"/${PN}-4.8.9-link-flags.patch
+	# We do not need to pass -L$libdir via nspr-config --libs
+	"${FILESDIR}"/${PN}-4.9.5_nspr_config.patch
+)
+
+QA_CONFIGURE_OPTIONS="--disable-static"
+
+src_prepare() {
+	cd "${S}"/nspr || die
+
+	default
+
+	if use elibc_musl; then
+		eapply "${FILESDIR}"/${PN}-4.21-ipv6-musl-support.patch
+		eapply "${FILESDIR}"/nspr-4.35-bgo-905998-lfs64-musl.patch
+	fi
+
+	# rename configure.in to configure.ac for new autotools compatibility
+	if [[ -e "${S}"/nspr/configure.in ]] ; then
+		einfo "Renaming configure.in to configure.ac"
+		mv "${S}"/nspr/configure.{in,ac} || die
+	else
+		elog "configure.in rename logic can be removed from ebuild."
+	fi
+
+	# We must run eautoconf to regenerate configure
+	eautoconf
+
+	# make sure it won't find Perl out of Prefix
+	sed -i -e "s/perl5//g" "${S}"/nspr/configure || die
+
+	# Respect LDFLAGS
+	sed -i -e 's/\$(MKSHLIB) \$(OBJS)/\$(MKSHLIB) \$(LDFLAGS) \$(OBJS)/g' \
+		"${S}"/nspr/config/rules.mk || die
+}
+
+multilib_src_configure() {
+	# -Werror=strict-aliasing
+	# https://bugs.gentoo.org/867634
+	#
+	# Testsuite-only issue. Still, this makes it challenging to test the package with LTO
+	# enabled...
+	append-flags -fno-strict-aliasing
+	filter-lto
+
+	# The build system overrides user optimization level based on a configure flag. #886987
+	local my_optlvl=$(get-flag '-O*')
+
+	# bgo #923802
+	append-lfs-flags
+
+	# We use the standard BUILD_xxx but nspr uses HOST_xxx
+	tc-export_build_env BUILD_CC
+	export HOST_CC=${BUILD_CC} HOST_CFLAGS=${BUILD_CFLAGS} HOST_LDFLAGS=${BUILD_LDFLAGS}
+	tc-export AR AS CC CXX RANLIB
+	[[ ${CBUILD} != ${CHOST} ]] \
+		&& export CROSS_COMPILE=1 \
+		|| unset CROSS_COMPILE
+
+	local myconf=( --libdir="${EPREFIX}/usr/$(get_libdir)" )
+
+	# Optimization is disabled when debug is enabled.
+	if use debug; then
+		myconf+=( --enable-debug )
+	else
+		myconf+=( --disable-debug )
+		myconf+=( --enable-optimize="${my_optlvl}" )
+	fi
+
+	# The configure has some fancy --enable-{{n,x}32,64bit} switches
+	# that trigger some code conditional to platform & arch. This really
+	# matters for the few common arches (x86, ppc) but we pass a little
+	# more of them to be future-proof.
+	case $(tc-get-ptr-size) in
+		4) use abi_x86_x32 && myconf+=( --enable-x32 );;
+		8) myconf+=( --enable-64bit );;
+	esac
+
+	# Ancient autoconf needs help finding the right tools.
+	LC_ALL="C" ECONF_SOURCE="${S}/nspr" \
+	ac_cv_path_AR="${AR}" \
+	ac_cv_path_AS="${AS}" \
+	econf "${myconf[@]}"
+}
+
+multilib_src_test() {
+	# https://firefox-source-docs.mozilla.org/nspr/running_nspr_tests.html
+	cd "${BUILD_DIR}/pr/tests" || die
+	einfo "Building tests"
+	emake
+
+	einfo "Running test suite"
+	../../../${P}/${PN}/pr/tests/runtests.pl | tee "${T}"/${ABI}-tests.log
+
+	# Needed to check if runtests.pl itself or the tee (somehow) failed
+	# (can't use die with pipes to check each component)
+	[[ ${PIPESTATUS[@]} == "0 0" ]] || die "Tests failed to run!"
+
+	local known_failures=(
+		# network-sandbox related?
+		cltsrv
+		# network-sandbox related?
+		gethost
+	)
+
+	local known_failure
+	for known_failure in "${known_failures[@]}" ; do
+		sed -i -e "/${known_failure}.*FAILED/d" "${T}"/${ABI}-tests.log || die
+	done
+
+	# But to actually check the test results, we examine the log.
+	if grep -q "FAILED" "${T}"/${ABI}-tests.log ; then
+		die "Test failure for ${ABI}!"
+	fi
+}
+
+multilib_src_install() {
+	# Their build system is royally confusing, as usual
+	MINOR_VERSION=${MIN_PV} # Used for .so version
+	emake DESTDIR="${D}" install
+
+	einfo "removing static libraries as upstream has requested!"
+	rm "${ED}"/usr/$(get_libdir)/*.a || die "failed to remove static libraries."
+
+	# install nspr-config
+	dobin config/nspr-config
+
+	# Remove stupid files in /usr/bin
+	rm "${ED}"/usr/bin/prerr.properties || die
+
+	# This is used only to generate prerr.c and prerr.h at build time.
+	# No other projects use it, and we don't want to depend on perl.
+	# Talked to upstream and they agreed w/punting.
+	rm "${ED}"/usr/bin/compile-et.pl || die
+}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.