commit: 257f3c38e0a5f82c5e0b325c7bd170eaf3ca80ed Author: James Le Cuirot <chewi <AT> gentoo <DOT> org> AuthorDate: Fri Jan 16 15:22:15 2026 +0000 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org> CommitDate: Sat Jan 17 15:18:15 2026 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=257f3c38
dev-libs/nss: Determine arch make args using tc-get(-build)-ptr-size USE_N32 was dropped years ago. That leaves USE_X32 as the only special case. We cannot rely on the abi_x86_x32 USE flag here as we also need this for the build host. We were previously only doing this for the build host when cross-compiling, but it's now also needed for multilib. Now that the test is simpler, just do it unconditionally. Also call tc-export_build_env to populate BUILD_CFLAGS and BUILD_LDFLAGS from CFLAGS and LDFLAGS when appropriate. Closes: https://bugs.gentoo.org/968798 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org> Part-of: https://codeberg.org/gentoo/gentoo/pulls/17 Merges: https://codeberg.org/gentoo/gentoo/pulls/17 dev-libs/nss/nss-3.120.ebuild | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/dev-libs/nss/nss-3.120.ebuild b/dev-libs/nss/nss-3.120.ebuild index d6646ca62696..2fbc02a2874f 100644 --- a/dev-libs/nss/nss-3.120.ebuild +++ b/dev-libs/nss/nss-3.120.ebuild @@ -12,6 +12,7 @@ DESCRIPTION="Mozilla's Network Security Services library that implements PKI sup 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/~juippis/mozilla/patchsets/nss-3.104-cacert-class1-class3.patch )" +S="${WORKDIR}/${P}/${PN}" LICENSE="|| ( MPL-2.0 GPL-2 LGPL-2.1 )" SLOT="0" @@ -33,8 +34,6 @@ RDEPEND=" DEPEND="${RDEPEND}" BDEPEND="dev-lang/perl" -S="${WORKDIR}/${P}/${PN}" - MULTILIB_CHOST_TOOLS=( /usr/bin/nss-config ) @@ -109,40 +108,16 @@ nssarch() { esac } +# @USAGE: <pointer bytes> <tuple> 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";; + case $1 in + 4) [[ $2 == x86_64* ]] && echo USE_X32=1 ;; + 8) echo USE_64=1 ;; 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 + tc-export_build_env local makeargs=( CC="$(tc-getCC)" @@ -150,8 +125,8 @@ multilib_src_compile() { AR="$(tc-getAR) rc \$@" RANLIB="$(tc-getRANLIB)" OPTIMIZER= - ${mybits} disable_ckbi=0 + $(nssbits "$(tc-get-ptr-size)" "${CHOST}") ) # Take care of nspr settings #436216 @@ -222,7 +197,7 @@ multilib_src_compile() { NSPR_LIB_DIR="${T}/fakedir" \ emake -C coreconf \ CC="$(tc-getBUILD_CC)" \ - ${buildbits-${mybits}} + $(nssbits "$(tc-get-build-ptr-size)" "${CBUILD}") makeargs+=( NSINSTALL="${PWD}/$(find -type f -name nsinstall)" ) # Then build the target tools.
