From eb3b53b5fd521edc0e4a7d611e76898732a63a81 Mon Sep 17 00:00:00 2001
From: V3n3RiX <venerix@koprulu.sector>
Date: Wed, 21 Feb 2024 11:40:26 +0000
Subject: gentoo auto-resync : 21:02:2024 - 11:40:26

---
 dev-libs/Manifest.gz                  | Bin 97700 -> 97688 bytes
 dev-libs/botan/Manifest               |   8 +-
 dev-libs/botan/botan-2.19.3-r2.ebuild |  16 +-
 dev-libs/botan/botan-2.19.4.ebuild    | 201 ++++++++++++++++
 dev-libs/botan/botan-3.3.0.ebuild     | 224 ++++++++++++++++++
 dev-libs/nspr/Manifest                |   2 +-
 dev-libs/nspr/nspr-4.35-r2.ebuild     |   3 +
 dev-libs/nss/Manifest                 |   2 +
 dev-libs/nss/nss-3.90.2.ebuild        | 418 ++++++++++++++++++++++++++++++++++
 9 files changed, 870 insertions(+), 4 deletions(-)
 create mode 100644 dev-libs/botan/botan-2.19.4.ebuild
 create mode 100644 dev-libs/botan/botan-3.3.0.ebuild
 create mode 100644 dev-libs/nss/nss-3.90.2.ebuild

(limited to 'dev-libs')

diff --git a/dev-libs/Manifest.gz b/dev-libs/Manifest.gz
index fdf3de8e6823..4c44d07994b7 100644
Binary files a/dev-libs/Manifest.gz and b/dev-libs/Manifest.gz differ
diff --git a/dev-libs/botan/Manifest b/dev-libs/botan/Manifest
index b55f0158d65f..3cec299d5e78 100644
--- a/dev-libs/botan/Manifest
+++ b/dev-libs/botan/Manifest
@@ -1,12 +1,18 @@
 AUX botan-3.2.0-ninja.patch 575 BLAKE2B f75eb0a16fadfae6e0a1bb554262d8d902152c054fd97c19a1c4eda31a780138efd42ce05992896d16d98415c555a7cfa01b6dfa201c7e97ad971deab851e7b7 SHA512 ff9078ae1a43404680cf757da15bd17541f51f8de02a1a8d02f075676a1e35ff9a78adba0f3b84847634bc4904ed7b5824df6c708785865a4d01d4f9139e617b
 DIST Botan-2.19.3.tar.xz 6105896 BLAKE2B 6d7778d9e9a101c76f35c65b0fb0201641cd91967ba934510f3836ee4b924d54cabdc760dd460997679250aa66e1d2a99369cd03f8fb9e7b2fe672d4b355215f SHA512 80012397e2aa7cc88a9536340ac9b770d1195fddda53b9d4cfde82318dd05f9d4f925bbdff773aba99883a701f4d30581e9d5c97e915fa80c3ca2acfa5a92110
 DIST Botan-2.19.3.tar.xz.asc 488 BLAKE2B cd86bf77306aad2956cced6ac4fb96081279af88743e87d8fe5437e72e9fa8db8aaf40d0b5cb9c5b3a85204cb7d63c3baa3054126ab4c9a2db527e6835a069d7 SHA512 9142f932c958138b4bac32f503a550e6c73b61612690a280dcb98efe8c367aa6bd3cd88b4ed4decec376bb87596a780a21bdcb01d4a3573a1c44fbeb0aa49d23
+DIST Botan-2.19.4.tar.xz 6099528 BLAKE2B c35dfec5aad13c76fe09b33f97a72d15f84bfd6c434cae89be13c3fd3e6f7deaa9ea21474890bb6a1f4fa7d23369c32b9fc747862233eac33c8c88dbc912d31f SHA512 2fab4347367703dce8302b7710698ed228c6cc6dd609c39829ba17ad580407ed40d822862d467aa7aea4bfd633c1f1d1c0d437e86376f453845cc609596335d8
+DIST Botan-2.19.4.tar.xz.asc 488 BLAKE2B b8b7db32d61859778c0866e782ed94ef89ba48a0f0f2289d9452fe7f540ae37ad495cb7eede68199d9bed8e23f695e1860c0d379cd4c35c92de8c45db167b68a SHA512 e00c4e2944655919507300650d81fbee03dd22d1a84cb8135848ea9ee061ca4d4dfada618643193143c0123e56f22e4a6d3a26c73923d872754d80dc2a4779c5
 DIST Botan-3.1.1.tar.xz 8800368 BLAKE2B c31365e6bd4106f96a033e5f092c528c0185577f41d9a698d2630ece0f660f87f03e0775ebeb5c4d812819bbc6eb556b5ff15c16f243288ae73c8bf1fbb991ce SHA512 ed6bdadb910b0775245648140212953ed364aa26107f851e39ac5cb664d7f476c519a22cdad41f0e520796c4ebe453c56ca68a2178e39f815d445e9979333795
 DIST Botan-3.1.1.tar.xz.asc 488 BLAKE2B 9ac94473d90a26932e507cdb3f46d8381565deecff38a5a2f7fe043b33405071adf0baee4235dd94bb6d35fa3ffedca6192fb5f5d76030874a90a399d88f9744 SHA512 f52e8602a57f590150f6f49829e788910006e5113ab6e85c6efe73009b8db752b5f28b869c6265ef6dd3c2727c64c0182d125f02f92485485768416c618acdb9
 DIST Botan-3.2.0.tar.xz 8998204 BLAKE2B f21e7574af93ab3331607f4a4ecf1b2cbbc0db4b510ea8ad19a5286d46d3a8e37e13746d2d4751eb16a70fdc8371b4435b030ef0a17f1ab6dcd76bd81bb3a4fa SHA512 526cf71144584fef6e73f14f6aa1e2a7b03a92a3e51436287764bb61e742a94e02926bcc2aab038f08ef2169cb511152c8ecd71d51e06deb4875dc676875c2d9
 DIST Botan-3.2.0.tar.xz.asc 488 BLAKE2B f7bc716dd18eedf35928933e22c75de3d2731330dfdaf8a5048e8ad86e1f3896ea55294a64b7f82593af16dd2e4097a9ba68f25baa024e175b7334478bcf84a6 SHA512 3ee42ac73e1bd6cea0a2e9f468b88d67c02a4a69786c41ddf9fc7f94b6847be00e0f3f0f38f934ab599b8d6dd29006414294df8b371f5cf2422292f3dd176756
-EBUILD botan-2.19.3-r2.ebuild 4812 BLAKE2B 7d60b4ab89099aaac8c8f8a4c7517b07e9b951511afc4436d5bcd93f79f996dff82e31a981211e9f7035cf90a20a701df640cf288b3f03da33e30bcf6553b26a SHA512 7db8932f965443ad0a46ab77adb35bc3db1dfaefe82f76f98f8c670b76c0351ad28306204ce278bb58d4c0912d29394963accd082c2f8097487f2c57af2b356c
+DIST Botan-3.3.0.tar.xz 7164024 BLAKE2B 051a24c28e6858fdff2af15d01a871ebe5bab11d773be821c0a56a55c725c91cf3119280195ac736f4df83305c1d4910430e6b26deded0d4c634e5c2fc23b389 SHA512 90930add225a2b4376046b3ed0177c71e7d19e983fb2b99c40751de5e6c3959b520eaa1e836782eb02ebc8aff8e9a4fd928f585de5e6b1798a8ad4aa0464f19b
+DIST Botan-3.3.0.tar.xz.asc 488 BLAKE2B 043538ff2572a449d4d9ad4bba6d7cab78865e924f712d1b4d4aad9f378cc417f07c19a25adefa22b6e1c06259a50880414c11ce8d3ad1e7f815cf458dbbe6b8 SHA512 c951079c22665966b96cf18c20df7b709353b42dab4aeb33d021b4a8abbc0f06d8fe909f1a5db3e736b4f93b17374d8f832f7aa9f25757a5d5ab1604320581b2
+EBUILD botan-2.19.3-r2.ebuild 5090 BLAKE2B 07789302d91c6430361930d400e7a41246135b76f455823bd7349482bda12c410c1cad51eae22fd50d539478d9ae10936a1fc7e6354f13415b72baa13929cf16 SHA512 f96e511ff7a43a5c931a97f88177295a25a6601d657144c7f831becac04be52020b35325537ac48867739ff7c4611c2988f93d6b70ea3f141df32ec26dc55de8
+EBUILD botan-2.19.4.ebuild 5164 BLAKE2B 60bfb0d375551c04b298a2078bd312d0dffbcceef1ffce3e2e4a2860be00acbbb651f3aec15e0db7a845f3afc604a7b3e783cf2b43d37b21c9d08b32d06693da SHA512 5d5051bd566fd06819e1b71a403c13bebb49c510d4409f965e8453ca1727955dba9d89933e27e46af119e227a32a4564a2e27d626055ac4244aeaadd9c271769
 EBUILD botan-3.1.1.ebuild 5693 BLAKE2B 0fc42ff9c45b42edbc0797db23cbcbc2b3369c8a263fa692f6ce62890b9fd28388b910680c37a623472c6aa83c0ee7e883e48ef6e95d584a619da54e842aced2 SHA512 30324195f2c38bf7508954c3941083386d92f1a31ceae76628783d72de99d7caae8a751b03d9478e16366ffe353f9ef3ccb935c101bf570b0d8d50eb03b5d83d
 EBUILD botan-3.2.0-r1.ebuild 5955 BLAKE2B e2664dcb86942ca4f8924c5b327778c16120fab97883e05c5a50145e56c5154bdd6eff06616c8f1706e5fecf40d4f87e0c5512e628f88f224fa250d15c8b0708 SHA512 81ccdaa911b1e29261c6ea276dd6ac1675f570d885a02254714878fda3e1aff47aa342607c43f40b449232dceabdafd25ff73ad6d70d3f040bc49d0052f385b2
 EBUILD botan-3.2.0-r2.ebuild 5980 BLAKE2B 7dfa6ef02c573b96a9e8df3dbdf823b69343f212f03a3f36557ab214286ce2e51ab0bb514ff2f45827eeaa25c8184cf9d71ddbe9cbf1b3d64fb6c45daff6f294 SHA512 1ae769c23dd7b112e08cfe2fc7504517b9e05e8f5a0f5b49ede868140231e96b8649d68472c79b5dcd6bd0ce7d64ceba9c6609e6dc35201509708e92d7f11df2
+EBUILD botan-3.3.0.ebuild 6006 BLAKE2B d91daca87c8f48e612ae8333e99492d91927bede6e5c293ee07f70aebe5035dd6858b02517af7b977167ff616e077eaf1078c87c732cd5d21782010738d9952d SHA512 79ef05148ff0dc42552266ab11729e88a050fc7ed3e2586ec920b8fd7eb805e042d8e3a17ed10da80e17559512137602a21054cc7d69d3083585060f58818cf9
 MISC metadata.xml 587 BLAKE2B 8d46466fee633fda0f81549a6e512e4ef5963eda31d7c882cee2fe2bfae8b0379509f046d0bdfdb1fe9481eea0585f1754753ed6b509c4f922b8fbf9ae089f39 SHA512 258e04098b9db5821a66e38d02ffb195b57378621fd2a549c8892744cf257be857ebf75c8e4a2f041cd267f07c2f1c3a5fca8df61db0538d8282507cf03a029d
diff --git a/dev-libs/botan/botan-2.19.3-r2.ebuild b/dev-libs/botan/botan-2.19.3-r2.ebuild
index fbab36fb5bef..2a151dbc3529 100644
--- a/dev-libs/botan/botan-2.19.3-r2.ebuild
+++ b/dev-libs/botan/botan-2.19.3-r2.ebuild
@@ -1,11 +1,11 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
 PYTHON_COMPAT=( python3_{10..12} )
 VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/botan.asc
-inherit edo multiprocessing python-r1 toolchain-funcs verify-sig
+inherit edo flag-o-matic multiprocessing python-r1 toolchain-funcs verify-sig
 
 MY_P="Botan-${PV}"
 DESCRIPTION="C++ crypto library"
@@ -169,6 +169,18 @@ src_configure() {
 
 	tc-export AR CC CXX
 
+	local sanitizers=()
+	if is-flagq -fsanitize=address ; then
+		sanitizers+=( address )
+	fi
+	if is-flagq -fsanitize=undefined ; then
+		sanitizers+=( undefined )
+	fi
+	filter-flags '-fsanitize=*'
+	myargs+=(
+		--enable-sanitizers=$(IFS=","; echo "${sanitizers[*]}")
+	)
+
 	edo ${EPYTHON} configure.py --verbose "${myargs[@]}"
 }
 
diff --git a/dev-libs/botan/botan-2.19.4.ebuild b/dev-libs/botan/botan-2.19.4.ebuild
new file mode 100644
index 000000000000..6e152aa47946
--- /dev/null
+++ b/dev-libs/botan/botan-2.19.4.ebuild
@@ -0,0 +1,201 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/botan.asc
+inherit edo flag-o-matic multiprocessing python-r1 toolchain-funcs verify-sig
+
+MY_P="Botan-${PV}"
+DESCRIPTION="C++ crypto library"
+HOMEPAGE="https://botan.randombit.net/"
+SRC_URI="https://botan.randombit.net/releases/${MY_P}.tar.xz"
+SRC_URI+=" verify-sig? ( https://botan.randombit.net/releases/${MY_P}.tar.xz.asc )"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="BSD-2"
+# New major versions are parallel-installable
+SLOT="$(ver_cut 1)/$(ver_cut 1-2)" # soname version
+# Unkeyworded because of https://github.com/randombit/botan/issues/3916
+#KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86 ~ppc-macos"
+IUSE="doc boost bzip2 lzma python static-libs sqlite test tools zlib"
+CPU_USE=(
+	cpu_flags_arm_{aes,neon}
+	cpu_flags_ppc_altivec
+	cpu_flags_x86_{aes,avx2,popcnt,rdrand,sha,sse2,ssse3,sse4_1,sse4_2}
+)
+IUSE+=" ${CPU_USE[@]}"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+# NOTE: Boost is needed at runtime too for the CLI tool.
+DEPEND="
+	boost? ( dev-libs/boost:= )
+	bzip2? ( >=app-arch/bzip2-1.0.5:= )
+	lzma? ( app-arch/xz-utils:= )
+	python? ( ${PYTHON_DEPS} )
+	sqlite? ( dev-db/sqlite:3= )
+	zlib? ( >=sys-libs/zlib-1.2.3:= )
+"
+RDEPEND="
+	${DEPEND}
+	!<dev-libs/botan-3.0.0-r1:3[tools]
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	$(python_gen_any_dep '
+		doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
+	')
+	verify-sig? ( sec-keys/openpgp-keys-botan )
+"
+
+# NOTE: Considering patching Botan?
+# Please see upstream's guidance:
+# https://botan.randombit.net/handbook/packaging.html#minimize-distribution-patches
+
+python_check_deps() {
+	use doc || return 0
+	python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
+}
+
+src_configure() {
+	python_setup
+
+	local disable_modules=(
+		$(usev !boost 'boost')
+	)
+
+	if [[ -z "${DISABLE_MODULES}" ]] ; then
+		elog "Disabling module(s): ${disable_modules[@]}"
+	fi
+
+	local chostarch="${CHOST%%-*}"
+
+	# Arch specific wrangling
+	local myos=
+	case ${CHOST} in
+		*-darwin*)
+			myos=darwin
+			;;
+		*)
+			myos=linux
+
+			if [[ ${CHOST} == *hppa* ]] ; then
+				chostarch=parisc
+			elif [[ ${ABI} == sparc64 ]] ; then
+				chostarch="sparc64"
+			elif [[ ${ABI} == sparc32 ]] ; then
+				chostarch="sparc32"
+			fi
+			;;
+	esac
+
+	local pythonvers=()
+	if use python ; then
+		_append() {
+			pythonvers+=( ${EPYTHON/python/} )
+		}
+
+		python_foreach_impl _append
+	fi
+
+	local myargs=(
+		# Intrinsics
+		# TODO: x86 RDSEED (new CPU_FLAGS_X86?)
+		# TODO: POWER Crypto (new CPU_FLAGS_PPC?)
+		$(usev !cpu_flags_arm_aes '--disable-armv8crypto')
+		$(usev !cpu_flags_arm_neon '--disable-neon')
+		$(usev !cpu_flags_ppc_altivec '--disable-altivec')
+		$(usev !cpu_flags_x86_aes '--disable-aes-ni')
+		$(usev !cpu_flags_x86_avx2 '--disable-avx2')
+		$(usev !cpu_flags_x86_popcnt '--disable-bmi2')
+		$(usev !cpu_flags_x86_rdrand '--disable-rdrand')
+		$(usev !cpu_flags_x86_sha '--disable-sha-ni')
+		$(usev !cpu_flags_x86_sse2 '--disable-sse2')
+		$(usev !cpu_flags_x86_ssse3 '--disable-ssse3')
+		$(usev !cpu_flags_x86_sse4_1 '--disable-sse4.1')
+		$(usev !cpu_flags_x86_sse4_2 '--disable-sse4.2')
+
+		# HPPA's GCC doesn't support SSP
+		$(usev hppa '--without-stack-protector')
+
+		$(use_with boost)
+		$(use_with bzip2)
+		$(use_with doc documentation)
+		$(use_with doc sphinx)
+		$(use_with lzma)
+		$(use_enable static-libs static-library)
+		$(use_with sqlite sqlite3)
+		$(use_with zlib)
+
+		--cpu=${chostarch}
+		--docdir=share/doc
+		--disable-modules=$(IFS=","; echo "${disable_modules[*]}")
+		--distribution-info="Gentoo ${PVR}"
+		--libdir="$(get_libdir)"
+		# Avoid collisions between slots for tools (bug #905700)
+		--program-suffix=$(ver_cut 1)
+
+		# Don't install Python bindings automatically
+		# (do it manually later in the right place)
+		# bug #723096
+		--no-install-python-module
+
+		--os=${myos}
+		--prefix="${EPREFIX}"/usr
+		--with-endian="$(tc-endian)"
+		--with-python-version=$(IFS=","; echo "${pythonvers[*]}")
+	)
+
+	local build_targets=(
+		shared
+		$(usev static-libs static)
+		$(usev tools cli)
+		$(usev test tests)
+	)
+
+	myargs+=(
+		--build-targets=$(IFS=","; echo "${build_targets[*]}")
+	)
+
+	if use elibc_glibc && use kernel_linux ; then
+		myargs+=(
+			--with-os-features=getrandom,getentropy
+		)
+	fi
+
+	tc-export AR CC CXX
+
+	local sanitizers=()
+	if is-flagq -fsanitize=address ; then
+		sanitizers+=( address )
+	fi
+	if is-flagq -fsanitize=undefined ; then
+		sanitizers+=( undefined )
+	fi
+	filter-flags '-fsanitize=*'
+	myargs+=(
+		--enable-sanitizers=$(IFS=","; echo "${sanitizers[*]}")
+	)
+
+	edo ${EPYTHON} configure.py --verbose "${myargs[@]}"
+}
+
+src_test() {
+	LD_LIBRARY_PATH="${S}" edo ./botan-test$(ver_cut 1) --test-threads="$(makeopts_jobs)"
+}
+
+src_install() {
+	default
+
+	if [[ -d "${ED}"/usr/share/doc/${P} ]] ; then
+		# --docdir in configure controls the parent directory unfortunately
+		mv "${ED}"/usr/share/doc/${P} "${ED}"/usr/share/doc/${PF} || die
+	fi
+
+	# Manually install the Python bindings (bug #723096)
+	if use python ; then
+		python_foreach_impl python_domodule src/python/botan$(ver_cut 1).py
+	fi
+}
diff --git a/dev-libs/botan/botan-3.3.0.ebuild b/dev-libs/botan/botan-3.3.0.ebuild
new file mode 100644
index 000000000000..893a9edb2868
--- /dev/null
+++ b/dev-libs/botan/botan-3.3.0.ebuild
@@ -0,0 +1,224 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{10..12} )
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/botan.asc
+inherit edo flag-o-matic multiprocessing ninja-utils python-r1 toolchain-funcs verify-sig
+
+MY_P="Botan-${PV}"
+DESCRIPTION="C++ crypto library"
+HOMEPAGE="https://botan.randombit.net/"
+SRC_URI="https://botan.randombit.net/releases/${MY_P}.tar.xz"
+SRC_URI+=" verify-sig? ( https://botan.randombit.net/releases/${MY_P}.tar.xz.asc )"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="BSD-2"
+# New major versions are parallel-installable
+SLOT="$(ver_cut 1)/$(ver_cut 1-2)" # soname version
+# Unkeyworded because of https://github.com/randombit/botan/issues/3917
+#KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-macos"
+IUSE="doc boost bzip2 lzma python static-libs sqlite test tools zlib"
+CPU_USE=(
+	cpu_flags_arm_{aes,neon,sha1,sha2}
+	cpu_flags_ppc_altivec
+	cpu_flags_x86_{aes,avx2,popcnt,rdrand,sha,sse2,ssse3,sse4_1,sse4_2}
+)
+IUSE+=" ${CPU_USE[@]}"
+RESTRICT="!test? ( test )"
+REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
+
+# NOTE: Boost is needed at runtime too for the CLI tool.
+DEPEND="
+	boost? ( dev-libs/boost:= )
+	bzip2? ( >=app-arch/bzip2-1.0.5:= )
+	lzma? ( app-arch/xz-utils:= )
+	python? ( ${PYTHON_DEPS} )
+	sqlite? ( dev-db/sqlite:3= )
+	zlib? ( >=sys-libs/zlib-1.2.3:= )
+"
+RDEPEND="
+	${DEPEND}
+	!<dev-libs/botan-2.19.3-r1:2[tools]
+"
+BDEPEND="
+	${PYTHON_DEPS}
+	${NINJA_DEPEND}
+	$(python_gen_any_dep '
+		doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )
+	')
+	|| ( >=sys-devel/gcc-11:* >=sys-devel/clang-14:* )
+	verify-sig? ( sec-keys/openpgp-keys-botan )
+"
+
+# NOTE: Considering patching Botan?
+# Please see upstream's guidance:
+# https://botan.randombit.net/handbook/packaging.html#minimize-distribution-patches
+
+python_check_deps() {
+	use doc || return 0
+	python_has_version "dev-python/sphinx[${PYTHON_USEDEP}]"
+}
+
+pkg_pretend() {
+	[[ ${MERGE_TYPE} == binary ]] && return
+
+	# bug #908958
+	if tc-is-gcc && ver_test $(gcc-version) -lt 11 ; then
+		eerror "Botan needs >=gcc-11 or >=clang-14 to compile."
+		eerror "Please upgrade GCC: emerge -v1 sys-devel/gcc"
+		die "GCC version is too old to compile Botan!"
+	elif tc-is-clang && ver_test $(clang-version) -lt 14 ; then
+		eerror "Botan needs >=gcc-11 or >=clang-14 to compile."
+		eerror "Please upgrade Clang: emerge -v1 sys-devel/clang"
+		die "Clang version is too old to compile Botan!"
+	fi
+}
+
+src_configure() {
+	tc-export AR CC CXX
+	python_setup
+
+	local disable_modules=(
+		$(usev !boost 'boost')
+	)
+
+	if [[ -z "${DISABLE_MODULES}" ]] ; then
+		elog "Disabling module(s): ${disable_modules[@]}"
+	fi
+
+	local chostarch="${CHOST%%-*}"
+
+	# Arch specific wrangling
+	local myos=
+	case ${CHOST} in
+		*-darwin*)
+			myos=darwin
+			;;
+		*)
+			myos=linux
+
+			if [[ ${CHOST} == *hppa* ]] ; then
+				chostarch=parisc
+			elif [[ ${ABI} == sparc64 ]] ; then
+				chostarch="sparc64"
+			elif [[ ${ABI} == sparc32 ]] ; then
+				chostarch="sparc32"
+			fi
+			;;
+	esac
+
+	local pythonvers=()
+	if use python ; then
+		_append() {
+			pythonvers+=( ${EPYTHON/python/} )
+		}
+
+		python_foreach_impl _append
+	fi
+
+	local myargs=(
+		# Intrinsics
+		# TODO: x86 RDSEED (new CPU_FLAGS_X86?)
+		# TODO: POWER Crypto (new CPU_FLAGS_PPC?)
+		$(usev !cpu_flags_arm_aes '--disable-armv8crypto')
+		$(usev !cpu_flags_arm_neon '--disable-neon')
+		$(usev !cpu_flags_arm_sha1 '--disable-armv8crypto')
+		$(usev !cpu_flags_arm_sha2 '--disable-armv8crypto')
+		$(usev !cpu_flags_ppc_altivec '--disable-altivec')
+		$(usev !cpu_flags_x86_aes '--disable-aes-ni')
+		$(usev !cpu_flags_x86_avx2 '--disable-avx2')
+		$(usev !cpu_flags_x86_popcnt '--disable-bmi2')
+		$(usev !cpu_flags_x86_rdrand '--disable-rdrand')
+		$(usev !cpu_flags_x86_sha '--disable-sha-ni')
+		$(usev !cpu_flags_x86_sse2 '--disable-sse2')
+		$(usev !cpu_flags_x86_ssse3 '--disable-ssse3')
+		$(usev !cpu_flags_x86_sse4_1 '--disable-sse4.1')
+		$(usev !cpu_flags_x86_sse4_2 '--disable-sse4.2')
+
+		# HPPA's GCC doesn't support SSP
+		$(usev hppa '--without-stack-protector')
+
+		$(use_with boost)
+		$(use_with bzip2)
+		$(use_with doc documentation)
+		$(use_with doc sphinx)
+		$(use_with lzma)
+		$(use_enable static-libs static-library)
+		$(use_with sqlite sqlite3)
+		$(use_with zlib)
+
+		--build-tool=ninja
+		--cpu=${chostarch}
+		--docdir=share/doc
+		--disable-modules=$(IFS=","; echo "${disable_modules[*]}")
+		--distribution-info="Gentoo ${PVR}"
+		--libdir="$(get_libdir)"
+		# Avoid collisions between slots for tools (bug #905700)
+		--program-suffix=$(ver_cut 1)
+
+		# Don't install Python bindings automatically
+		# (do it manually later in the right place)
+		# bug #723096
+		--no-install-python-module
+
+		--os=${myos}
+		--prefix="${EPREFIX}"/usr
+		--with-endian="$(tc-endian)"
+		--with-python-version=$(IFS=","; echo "${pythonvers[*]}")
+	)
+
+	local build_targets=(
+		shared
+		$(usev static-libs static)
+		$(usev tools cli)
+		$(usev test tests)
+	)
+
+	myargs+=(
+		--build-targets=$(IFS=","; echo "${build_targets[*]}")
+	)
+
+	if ( use elibc_glibc || use elibc_musl ) && use kernel_linux ; then
+		myargs+=(
+			--with-os-features=getrandom,getentropy
+		)
+	fi
+
+	local sanitizers=()
+	if is-flagq -fsanitize=address ; then
+		sanitizers+=( address )
+	fi
+	if is-flagq -fsanitize=undefined ; then
+		sanitizers+=( undefined )
+	fi
+	filter-flags '-fsanitize=*'
+	myargs+=(
+		--enable-sanitizers=$(IFS=","; echo "${sanitizers[*]}")
+	)
+
+	edo ${EPYTHON} configure.py --verbose "${myargs[@]}"
+}
+
+src_compile() {
+	eninja
+}
+
+src_test() {
+	LD_LIBRARY_PATH="${S}" edo ./botan-test$(ver_cut 1) --test-threads="$(makeopts_jobs)"
+}
+
+src_install() {
+	DESTDIR="${D}" eninja install
+
+	if [[ -d "${ED}"/usr/share/doc/${P} && ${P} != ${PF} ]] ; then
+		# --docdir in configure controls the parent directory unfortunately
+		mv "${ED}"/usr/share/doc/${P} "${ED}"/usr/share/doc/${PF} || die
+	fi
+
+	# Manually install the Python bindings (bug #723096)
+	if use python ; then
+		python_foreach_impl python_domodule src/python/botan$(ver_cut 1).py
+	fi
+}
diff --git a/dev-libs/nspr/Manifest b/dev-libs/nspr/Manifest
index e50ed2286cdb..723fc1b01678 100644
--- a/dev-libs/nspr/Manifest
+++ b/dev-libs/nspr/Manifest
@@ -7,5 +7,5 @@ AUX nspr-4.8.4-darwin-install_name.patch 1046 BLAKE2B 1182149b03bd2c03fc4051bf98
 AUX nspr-4.8.9-link-flags.patch 931 BLAKE2B 6aa6aa1cf3b856a95b7baa20f58e9ed83b8b29ccce37bab39e10e0e76c433ae5c79839b5f7f9bdaf8b2475c8e3692ff4a57c246dfa4e1fed6866ab284826ee0d SHA512 0bb61dc09d287f1324749c983404e1f03fdf7014fbbd32cc5abe452fc2f32b90b759d8f18d964a61da044b5a7221f5ba274d94c93c07c8a7359e3c937e44b975
 AUX nspr-4.9.5_nspr_config.patch 251 BLAKE2B 65ae8b981e758e2955b7a3358f24b7b17dc1ef59f0e78f9fd9ddee740a4da3825bafea34f3900200b3f6edefed7d0797c194cb0339d4e36551615d599156108d SHA512 3f118b7142a19dcc7e26b348cec6029c78d585a57cc2bfc2ab7ca13d2ef953e576dab0ac044316e3165d0201bf27253afa732109f914da6f7a39f19facff8310
 DIST nspr-4.35.tar.gz 1096974 BLAKE2B c80402d7be9e69ab6d1e768a18d271a8d28900f4cae7df2709d1ab26e100d908f508762bb771d4042aa7152934ce83d495e2102e894c56574187be8040d65629 SHA512 502815833116e25f79ddf71d1526484908aa92fbc55f8a892729cb404a4daafcc0470a89854cd080d2d20299fdb7d9662507c5362c7ae661cbacf308ac56ef7f
-EBUILD nspr-4.35-r2.ebuild 5241 BLAKE2B 0c82c09e4743270c3da102e4f10dd3b418043a7d0682b24231b94c851abc988650f122e348f9175d3c230fbe46034e73610c9209902ec5a3d3c16290075fd5b9 SHA512 4f89278df422f45c06a4ca5af4e97a1b5ff1ed53954d8be59d70ead631f4c3458c427d63d39f9f74dec85b99d0b1a7fb155b6f885487a55863b6c859287cdbb6
+EBUILD nspr-4.35-r2.ebuild 5275 BLAKE2B 328ac728ccaad4e36f0ac5e923c832254fd70a5bae942c21d6dfb762c58be36c9659db8a31e20e48e2fce89994b3801dd30a045792c24392c540e597dc09dabf SHA512 ec796081cf596dbccb42fb34fc15d1735e35830106f7146515b1a81eb4c1721c9d60b99261d22f1c227d74024d056afba4c19b6dca668562904629763028bace
 MISC metadata.xml 350 BLAKE2B 0f4d7850a3ca725af4e01a47e4db4219d2465b6d4db8c44e12b8f57d2064fd3c6ddbeec16888a316627f96e1f9415777f3fedecbd7065e4d13516bbed473a6f6 SHA512 2cc7f3e6eefcb5ba16c4b2127e751c47ea7a6822eb71080c96c6850ef741acff8d424c520eb60288ca32ccdbe825568d7aced9f57148e304dddd0afb7f4a8883
diff --git a/dev-libs/nspr/nspr-4.35-r2.ebuild b/dev-libs/nspr/nspr-4.35-r2.ebuild
index 6921c9e1b1ab..ec3cb17b0172 100644
--- a/dev-libs/nspr/nspr-4.35-r2.ebuild
+++ b/dev-libs/nspr/nspr-4.35-r2.ebuild
@@ -65,6 +65,9 @@ multilib_src_configure() {
 	# 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}
diff --git a/dev-libs/nss/Manifest b/dev-libs/nss/Manifest
index bce749a55649..8fd55317183b 100644
--- a/dev-libs/nss/Manifest
+++ b/dev-libs/nss/Manifest
@@ -2,6 +2,7 @@ AUX nss-3.21-gentoo-fixup-warnings.patch 178 BLAKE2B b51f80310db3db416d8aeaf9117
 AUX nss-3.23-hppa-byte_order.patch 460 BLAKE2B 97358cc8fbea0b0d3beee0697833e48ef01039ceb08fd00792a7f7ef68409eb076022c03764ab079fdaa971a0358130002fa11c0c182ebeb33dcdf660be26408 SHA512 ad0097bb6cf409d61eb28202d7460c87e983d6db977aba38ff9ef2749b3f7bb8fdadce4174f5bf806350ae33733097a1f444792d31cc43574b28341893642e5a
 AUX nss-3.53-gentoo-fixups.patch 6886 BLAKE2B 1c605d8db02ebe0492c41955207368197a79990e43e219a71962cb28ac0cecd9e0acc2b76e16f5b116fdb8bf8790d96046cb4f376df9b8634ac48e54924589f8 SHA512 51031f92519f57d4b57a547cf549f2d5da1c5a7212d4b304fb0d71d6a85a5aefd64724ec9075c14c9b49c1e99c3ffe91cbec501c3504985aa9b16eacf2aa15ed
 AUX nss-3.87-use-clang-as-bgo892686.patch 2693 BLAKE2B fe8a25c9c8599e0f3e630202c824b854ebfa5b3580e79a61f7172a93a5aad2df3754e2e5aba718a22bb2ad5102f4d638ca10508f0b66cf6e8f21da4ea52bf966 SHA512 67d231aa1b2433e5feeff59af6849eee78f6d5ebf601c0f7baaf0e1b5b44c25ca63f012ced677f5562bb45e3fc0dabe0210b123a78b56de4dfe11c5eaafac3bc
+DIST nss-3.90.2.tar.gz 72215444 BLAKE2B 74b8eebf5f053dcebd9c6e6ef17c6113ac42a01f910f4ba621dadb09739d5a6090d022800d2c3a4bc0c58413f03512ca611ead1098488d303f1ee1e4bca5c222 SHA512 048a0c0a06fef8cd9c363ac511b9d6125ec131a306c5e093525a937f9e8740f1a2163f274c9a3907ed38331b2fb99b22b528b5e89da1e186c9ba9473d959ef4a
 DIST nss-3.91-fixed-certs.tar.xz 11300 BLAKE2B 85f191b85c7caf1ee24f92a2ff76f7660a1afd64d6c8d9da84f521aea18cb12bdf3d08426c47302a4b444b0e4b4ed2f2251ed8234d5bc0006b00cd4b97aacc51 SHA512 88d2a47ba160f93f2f2c88a1e2a591c516d19209bd77cc18111c8538d9cf86498cbfd57c7e36478819bde307d90ba31e0a12a9c17320ae5dc736d02959a32a3a
 DIST nss-3.91.tar.gz 72267945 BLAKE2B 7dcd680311a5503007c0bb738ec24b50e40841470592c2d8dd542b3bdf085a6e4816f1fab4cb6b86220ff3e39a828f57a0a9172e3d1c2c82537eab6558a50226 SHA512 65258a4ea0b8c06ec49dd411eabe860ad5d7c3873beb27f8f43e10ef6be020b1522112df9deaeed27f23fd72f13cc7554e9c1854cd97e4716de419f722aff020
 DIST nss-3.92.tar.gz 72133646 BLAKE2B 251daae56ccf8b8f4fd0b4287fea2049b6e72d1fc57fe02fb3d4f0b8a083aaf00046844145721a1e7620ecfbdbbb93206591e47386c12662765c09cf99db42bc SHA512 dc317ec909433c9026f108b466bc436110b3c77edc3f73aef3d6dc6782f584c205053a368e4a134715bfdf63d2c1ae2185fc23238e5c2dca8f88ec185b1fec2a
@@ -9,6 +10,7 @@ DIST nss-3.96.1.tar.gz 76715092 BLAKE2B 2a9ea65dd89cba82ea10a57887b10109369af81d
 DIST nss-3.97.tar.gz 76664827 BLAKE2B ede68cf0269edd8ffbe1e90682fb51c202d6298f8bfa5ebbd81e12785e29e6a6611ef3f0feceee73bea4d25ae12f251225649a73d249fdd90af179e07e39f3f6 SHA512 1ad6ac6ff626dc187f42b313c1088ef4b4ac0ee3e156d37824c36e778faa977e8f132302ac00d74aa8f9903e791a0fee6cecb5244d2601e0825cc125b6f33d6a
 DIST nss-3.98.tar.gz 76685475 BLAKE2B d382cc65e450b5b7d6b152952a8188822eab5fdbaa0faeefc3f98ef5aa70ed7534abcb7114aaa25c1e49f89dcda7cf75d85957d1a8e5ff964599362757138cb4 SHA512 4f335c5c284eff6424745cc15e32037715a915f6f61687ec36a8ffaef0e45d152602a1be275bbb2f14650c7d258d6488430cdcf512b18ba7cb73cd43ac625681
 DIST nss-cacert-class1-class3-r2.patch 21925 BLAKE2B 7627ff9a09f084c19d72d0490676865e3cab3ca7c920ae1ce4bea2db664f37fd0aa84fcda919809a516891ab2a62e2e7a43a9d6ada4c231adfe4c216525fac7d SHA512 1ce6ff9ab310aaca9005eafb461338b291df8523cc7044e096cd75774ce746c26eed19ec6bb2643c6c67f94650f2f309463492d80a90568f38ce2557f8ada2f4
+EBUILD nss-3.90.2.ebuild 11571 BLAKE2B e37869cece7d551303ca4ba14392eee4f4d48b49225d2658590e7c11f705ff061ef1c76312a50edf480d586f3ab6c429c8693536c6c946f11b15404c81032e6a SHA512 a95608d5046cbdb462faf421f7f9d3a84ec0fe18dbb429a3db66a327bf2e0cad300bf840e4fe5ec967869c0b2cd83a939c0641e4a6d533cbaf340e086e611e0f
 EBUILD nss-3.91.ebuild 11762 BLAKE2B 04104e5221a437db7a8e056b6940bb4b1b3d49ed790c72da8de1244debff478f683186816d2b608a54718407ed6b621f4df0d6e511b2b928aa90142a53c630fa SHA512 f60cda155bf7825d102b75f1924429c90e7e7039cfe3449baa9b5a577839543cdd51dda1d707b4c82ed908eb9680365359095f5617d2672addc6b05e97849c96
 EBUILD nss-3.92.ebuild 11335 BLAKE2B 5f94b4d9687ab37207861670a97d856f91e30f0ea57f0f67c4e3c18066939db2dc3c79cbbddacca53515fd49f3211fda4c84be2cf37e16967e7fd1e7c9d56344 SHA512 313d21c4ea9f4c009b828ee2c3bea5a9b5999822e0a7890950f0952a3c95f59313dba9bff7c18926539b8c2673b295de1dda3f4f678efbe83403180e65454c92
 EBUILD nss-3.96.1.ebuild 11571 BLAKE2B 0cda30f165213942fc117ca1dbf589bff0db5347707f7828f263f2d388e9af4a9797f1470fb59d761c68b14ea4209124b6f68b3ce800d2091825297b37ca314c SHA512 cfbe7cc8dc0bd846f8bf221e17b029ca52282e9f758b56c3990a7ebf35c75a6323600a8ccb486965e9e8180f4b3dca61fb4dcfc2148095a9984ccf4b28b27ddb
diff --git a/dev-libs/nss/nss-3.90.2.ebuild b/dev-libs/nss/nss-3.90.2.ebuild
new file mode 100644
index 000000000000..0977ca4223fb
--- /dev/null
+++ b/dev-libs/nss/nss-3.90.2.ebuild
@@ -0,0 +1,418 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit flag-o-matic multilib toolchain-funcs multilib-minimal
+
+NSPR_VER="4.35"
+RTM_NAME="NSS_${PV//./_}_RTM"
+
+DESCRIPTION="Mozilla's Network Security Services library that implements PKI support"
+HOMEPAGE="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS"
+SRC_URI="https://archive.mozilla.org/pub/security/nss/releases/${RTM_NAME}/src/${P}.tar.gz
+	cacert? ( https://dev.gentoo.org/~whissi/dist/ca-certificates/nss-cacert-class1-class3-r2.patch )"
+
+LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~x64-solaris"
+IUSE="cacert test +utils cpu_flags_ppc_altivec cpu_flags_x86_avx2 cpu_flags_x86_sse3 cpu_flags_ppc_vsx"
+RESTRICT="!test? ( test )"
+# pkg-config called by nss-config -> virtual/pkgconfig in RDEPEND
+RDEPEND="
+	>=dev-libs/nspr-${NSPR_VER}[${MULTILIB_USEDEP}]
+	>=dev-db/sqlite-3.8.2[${MULTILIB_USEDEP}]
+	>=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}]
+	virtual/pkgconfig
+"
+DEPEND="${RDEPEND}"
+BDEPEND="dev-lang/perl"
+
+S="${WORKDIR}/${P}/${PN}"
+
+MULTILIB_CHOST_TOOLS=(
+	/usr/bin/nss-config
+)
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.53-gentoo-fixups.patch"
+	"${FILESDIR}/${PN}-3.21-gentoo-fixup-warnings.patch"
+	"${FILESDIR}"/nss-3.87-use-clang-as-bgo892686.patch
+)
+
+src_prepare() {
+	default
+
+	if use cacert ; then
+		eapply -p2 "${DISTDIR}"/nss-cacert-class1-class3-r2.patch
+	fi
+
+	pushd coreconf >/dev/null || die
+	# hack nspr paths
+	echo 'INCLUDES += -I$(DIST)/include/dbm' \
+		>> headers.mk || die "failed to append include"
+
+	# modify install path
+	sed -e '/CORE_DEPTH/s:SOURCE_PREFIX.*$:SOURCE_PREFIX = $(CORE_DEPTH)/dist:' \
+		-i source.mk || die
+
+	# Respect LDFLAGS
+	sed -i -e 's/\$(MKSHLIB) -o/\$(MKSHLIB) \$(LDFLAGS) -o/g' rules.mk
+
+	# Workaround make-4.4's change to sub-make, bmo#1800237, bgo#882069
+	sed -i -e "s/^CPU_TAG = _.*/CPU_TAG = _$(nssarch)/" Linux.mk || die
+
+	popd >/dev/null || die
+
+	# Fix pkgconfig file for Prefix
+	sed -i -e "/^PREFIX =/s:= /usr:= ${EPREFIX}/usr:" \
+		config/Makefile || die
+
+	# use host shlibsign if need be #436216
+	if tc-is-cross-compiler ; then
+		sed -i \
+			-e 's:"${2}"/shlibsign:shlibsign:' \
+			cmd/shlibsign/sign.sh || die
+	fi
+
+	# dirty hack
+	sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../freebl/\$(OBJDIR):" \
+		lib/ssl/config.mk || die
+	sed -i -e "/CRYPTOLIB/s:\$(SOFTOKEN_LIB_DIR):../../lib/freebl/\$(OBJDIR):" \
+		cmd/platlibs.mk || die
+
+	multilib_copy_sources
+
+	strip-flags
+}
+
+multilib_src_configure() {
+	# Ensure we stay multilib aware
+	sed -i -e "/@libdir@/ s:lib64:$(get_libdir):" config/Makefile || die
+}
+
+nssarch() {
+	# Most of the arches are the same as $ARCH
+	local t=${1:-${CHOST}}
+	case ${t} in
+		*86*-pc-solaris2*) echo "i86pc"   ;;
+		aarch64*)          echo "aarch64" ;;
+		hppa*)             echo "parisc"  ;;
+		i?86*)             echo "i686"    ;;
+		x86_64*)           echo "x86_64"  ;;
+		*)                 tc-arch ${t}   ;;
+	esac
+}
+
+nssbits() {
+	local cc cppflags="${1}CPPFLAGS" cflags="${1}CFLAGS"
+	if [[ ${1} == BUILD_ ]]; then
+		cc=$(tc-getBUILD_CC)
+	else
+		cc=$(tc-getCC)
+	fi
+	# TODO: Port this to toolchain-funcs tc-get-ptr-size/tc-get-build-ptr-size
+	echo > "${T}"/test.c || die
+	${cc} ${!cppflags} ${!cflags} -fno-lto -c "${T}"/test.c -o "${T}/${1}test.o" || die
+	case $(file -S "${T}/${1}test.o") in
+		*32-bit*x86-64*) echo USE_X32=1;;
+		*64-bit*|*ppc64*|*x86_64*) echo USE_64=1;;
+		*32-bit*|*ppc*|*i386*) ;;
+		*) die "Failed to detect whether ${cc} builds 64bits or 32bits, disable distcc if you're using it, please";;
+	esac
+}
+
+multilib_src_compile() {
+	# use ABI to determine bit'ness, or fallback if unset
+	local buildbits mybits
+	case "${ABI}" in
+		n32) mybits="USE_N32=1";;
+		x32) mybits="USE_X32=1";;
+		s390x|*64) mybits="USE_64=1";;
+		${DEFAULT_ABI})
+			einfo "Running compilation test to determine bit'ness"
+			mybits=$(nssbits)
+			;;
+	esac
+	# bitness of host may differ from target
+	if tc-is-cross-compiler; then
+		buildbits=$(nssbits BUILD_)
+	fi
+
+	local makeargs=(
+		CC="$(tc-getCC)"
+		CCC="$(tc-getCXX)"
+		AR="$(tc-getAR) rc \$@"
+		RANLIB="$(tc-getRANLIB)"
+		OPTIMIZER=
+		${mybits}
+		disable_ckbi=0
+	)
+
+	# Take care of nspr settings #436216
+	local myCPPFLAGS="${CPPFLAGS} $($(tc-getPKG_CONFIG) nspr --cflags)"
+	unset NSPR_INCLUDE_DIR
+
+	export NSS_ALLOW_SSLKEYLOGFILE=1
+	export NSS_ENABLE_WERROR=0 #567158
+	export BUILD_OPT=1
+	export NSS_USE_SYSTEM_SQLITE=1
+	export NSDISTMODE=copy
+	export FREEBL_NO_DEPEND=1
+	export FREEBL_LOWHASH=1
+	export NSS_SEED_ONLY_DEV_URANDOM=1
+	export USE_SYSTEM_ZLIB=1
+	export ZLIB_LIBS=-lz
+	export ASFLAGS=""
+	# Fix build failure on arm64
+	export NS_USE_GCC=1
+	# Detect compiler type and set proper environment value
+	if tc-is-gcc; then
+		export CC_IS_GCC=1
+	elif tc-is-clang; then
+		export CC_IS_CLANG=1
+	fi
+
+	export NSS_DISABLE_GTESTS=$(usex !test 1 0)
+
+	# Include exportable custom settings defined by users, #900915
+	# Two examples uses:
+	#   EXTRA_NSSCONF="MYONESWITCH=1"
+	#   EXTRA_NSSCONF="MYVALUE=0 MYOTHERVALUE=1 MYTHIRDVALUE=1"
+	# e.g.
+	#   EXTRA_NSSCONF="NSS_ALLOW_SSLKEYLOGFILE=0"
+	# or
+	#   EXTRA_NSSCONF="NSS_ALLOW_SSLKEYLOGFILE=0 NSS_ENABLE_WERROR=1"
+	# etc.
+	if [[ -n "${EXTRA_NSSCONF}" ]]; then
+		ewarn "EXTRA_NSSCONF applied, please disable custom settings before reporting bugs."
+		read -a myextranssconf <<< "${EXTRA_NSSCONF}"
+
+		for (( i=0; i<${#myextranssconf[@]}; i++ )); do
+			export "${myextranssconf[$i]}"
+			echo "exported ${myextranssconf[$i]}"
+		done
+	fi
+
+	# explicitly disable altivec/vsx if not requested
+	# https://bugs.gentoo.org/789114
+	case ${ARCH} in
+		ppc*)
+			use cpu_flags_ppc_altivec || export NSS_DISABLE_ALTIVEC=1
+			use cpu_flags_ppc_vsx || export NSS_DISABLE_CRYPTO_VSX=1
+			;;
+	esac
+
+	use cpu_flags_x86_avx2 || export NSS_DISABLE_AVX2=1
+	use cpu_flags_x86_sse3 || export NSS_DISABLE_SSE3=1
+
+	local d
+
+	# Build the host tools first.
+	LDFLAGS="${BUILD_LDFLAGS}" \
+	XCFLAGS="${BUILD_CFLAGS}" \
+	NSPR_LIB_DIR="${T}/fakedir" \
+	emake -C coreconf \
+		CC="$(tc-getBUILD_CC)" \
+			${buildbits-${mybits}}
+	makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" )
+
+	# Then build the target tools.
+	for d in . lib/dbm ; do
+		CPPFLAGS="${myCPPFLAGS}" \
+		XCFLAGS="${CFLAGS} ${CPPFLAGS}" \
+		NSPR_LIB_DIR="${T}/fakedir" \
+		emake "${makeargs[@]}" -C ${d} OS_TEST="$(nssarch)"
+	done
+}
+
+multilib_src_test() {
+	einfo "Tests can take a *long* time, especially on a multilib system."
+	einfo "30-45+ minutes per lib configuration. Bug #852755"
+
+	# https://www.linuxfromscratch.org/blfs/view/svn/postlfs/nss.html
+	# https://firefox-source-docs.mozilla.org/security/nss/legacy/nss_sources_building_testing/index.html#running_the_nss_test_suite
+	# https://www-archive.mozilla.org/projects/security/pki/nss/testnss_32.html (older)
+	export BUILD_OPT=1
+	export HOST="localhost"
+	export DOMSUF="localdomain"
+	export USE_IP=TRUE
+	export IP_ADDRESS="127.0.0.1"
+
+	# Only run the standard cycle instead of full, reducing testing time from 45 minutes to 15
+	# per lib implementation.
+	export NSS_CYCLES=standard
+
+	NSINSTALL="${PWD}/$(find -type f -name nsinstall)"
+
+	cd "${BUILD_DIR}"/tests || die
+	# Hack to get current objdir (prefixed dir where built binaries are)
+	# Without this, at least multilib tests go wrong when building the amd64 variant
+	# after x86.
+	local objdir=$(find "${BUILD_DIR}"/dist -maxdepth 1 -iname Linux* | rev | cut -d/ -f1 | rev)
+
+	# Can tweak to a subset of tests in future if we need to, but would prefer not
+	OBJDIR="${objdir}" DIST="${BUILD_DIR}/dist" MOZILLA_ROOT="${BUILD_DIR}" ./all.sh || die
+}
+
+# Altering these 3 libraries breaks the CHK verification.
+# All of the following cause it to break:
+# - stripping
+# - prelink
+# - ELF signing
+# http://www.mozilla.org/projects/security/pki/nss/tech-notes/tn6.html
+# Either we have to NOT strip them, or we have to forcibly resign after
+# stripping.
+#local_libdir="$(get_libdir)"
+#export STRIP_MASK="
+#	*/${local_libdir}/libfreebl3.so*
+#	*/${local_libdir}/libnssdbm3.so*
+#	*/${local_libdir}/libsoftokn3.so*"
+
+export NSS_CHK_SIGN_LIBS="freebl3 nssdbm3 softokn3"
+
+generate_chk() {
+	local shlibsign="$1"
+	local libdir="$2"
+	einfo "Resigning core NSS libraries for FIPS validation"
+	shift 2
+	local i
+	for i in ${NSS_CHK_SIGN_LIBS} ; do
+		local libname=lib${i}.so
+		local chkname=lib${i}.chk
+		"${shlibsign}" \
+			-i "${libdir}"/${libname} \
+			-o "${libdir}"/${chkname}.tmp \
+		&& mv -f \
+			"${libdir}"/${chkname}.tmp \
+			"${libdir}"/${chkname} \
+		|| die "Failed to sign ${libname}"
+	done
+}
+
+cleanup_chk() {
+	local libdir="$1"
+	shift 1
+	local i
+	for i in ${NSS_CHK_SIGN_LIBS} ; do
+		local libfname="${libdir}/lib${i}.so"
+		# If the major version has changed, then we have old chk files.
+		[ ! -f "${libfname}" -a -f "${libfname}.chk" ] \
+			&& rm -f "${libfname}.chk"
+	done
+}
+
+multilib_src_install() {
+	pushd dist >/dev/null || die
+
+	dodir /usr/$(get_libdir)
+	cp -L */lib/*$(get_libname) "${ED}"/usr/$(get_libdir) || die "copying shared libs failed"
+	local i
+	for i in crmf freebl nssb nssckfw ; do
+		cp -L */lib/lib${i}.a "${ED}"/usr/$(get_libdir) || die "copying libs failed"
+	done
+
+	# Install nss-config and pkgconfig file
+	dodir /usr/bin
+	cp -L */bin/nss-config "${ED}"/usr/bin || die
+	dodir /usr/$(get_libdir)/pkgconfig
+	cp -L */lib/pkgconfig/nss.pc "${ED}"/usr/$(get_libdir)/pkgconfig || die
+
+	# create an nss-softokn.pc from nss.pc for libfreebl and some private headers
+	# bug 517266
+	sed 	-e 's#Libs:#Libs: -lfreebl#' \
+		-e 's#Cflags:#Cflags: -I${includedir}/private#' \
+		*/lib/pkgconfig/nss.pc >"${ED}"/usr/$(get_libdir)/pkgconfig/nss-softokn.pc \
+		|| die "could not create nss-softokn.pc"
+
+	# all the include files
+	insinto /usr/include/nss
+	doins public/nss/*.{h,api}
+	insinto /usr/include/nss/private
+	doins private/nss/{blapi,alghmac,cmac}.h
+
+	popd >/dev/null || die
+
+	local f nssutils
+	# Always enabled because we need it for chk generation.
+	nssutils=( shlibsign )
+
+	if multilib_is_native_abi ; then
+		if use utils; then
+			# The tests we do not need to install.
+			#nssutils_test="bltest crmftest dbtest dertimetest
+			#fipstest remtest sdrtest"
+			# checkcert utils has been removed in nss-3.22:
+			# https://bugzilla.mozilla.org/show_bug.cgi?id=1187545
+			# https://hg.mozilla.org/projects/nss/rev/df1729d37870
+			# certcgi has been removed in nss-3.36:
+			# https://bugzilla.mozilla.org/show_bug.cgi?id=1426602
+			nssutils+=(
+				addbuiltin
+				atob
+				baddbdir
+				btoa
+				certutil
+				cmsutil
+				conflict
+				crlutil
+				derdump
+				digest
+				makepqg
+				mangle
+				modutil
+				multinit
+				nonspr10
+				ocspclnt
+				oidcalc
+				p7content
+				p7env
+				p7sign
+				p7verify
+				pk11mode
+				pk12util
+				pp
+				rsaperf
+				selfserv
+				signtool
+				signver
+				ssltap
+				strsclnt
+				symkeyutil
+				tstclnt
+				vfychain
+				vfyserv
+			)
+			# install man-pages for utils (bug #516810)
+			doman doc/nroff/*.1
+		fi
+		pushd dist/*/bin >/dev/null || die
+		for f in ${nssutils[@]}; do
+			dobin ${f}
+		done
+		popd >/dev/null || die
+	fi
+}
+
+pkg_postinst() {
+	multilib_pkg_postinst() {
+		# We must re-sign the libraries AFTER they are stripped.
+		local shlibsign="${EROOT}/usr/bin/shlibsign"
+		# See if we can execute it (cross-compiling & such). #436216
+		"${shlibsign}" -h >&/dev/null
+		if [[ $? -gt 1 ]] ; then
+			shlibsign="shlibsign"
+		fi
+		generate_chk "${shlibsign}" "${EROOT}"/usr/$(get_libdir)
+	}
+
+	multilib_foreach_abi multilib_pkg_postinst
+}
+
+pkg_postrm() {
+	multilib_pkg_postrm() {
+		cleanup_chk "${EROOT}"/usr/$(get_libdir)
+	}
+
+	multilib_foreach_abi multilib_pkg_postrm
+}
-- 
cgit v1.2.3