$NetBSD: patch-nss_coreconf_nsinstall_Makefile,v 1.1 2023/06/27 10:44:47 riastradh Exp $

Avoid passing target's EXTRA_SHARED_LIBS for tool build when
cross-compiling.

--- nss/coreconf/nsinstall/Makefile.orig	2023-05-05 17:06:27.000000000 +0000
+++ nss/coreconf/nsinstall/Makefile
@@ -38,6 +38,16 @@ ifdef NATIVE_LDFLAGS
 LDFLAGS=$(NATIVE_LDFLAGS)
 endif
 
+# Note: `ifdef' is not actually `if defined', it's `if defined with a
+# non-empty definition pre-expansion', which means that even if you
+# explicitly set NATIVE_EXTRA_SHARED_LIBS= on the command-line, the
+# `ifdef NATIVE_EXTRA_SHARED_LIBS' branch is ignored.  Using this
+# bizarre `ifneq ($(origin NATIVE_EXTRA_SHARED_LIBS),undefined)'
+# contraption works around that misfeature of gmake.
+ifneq ($(origin NATIVE_EXTRA_SHARED_LIBS),undefined)
+EXTRA_SHARED_LIBS=$(NATIVE_EXTRA_SHARED_LIBS)
+endif
+
 include $(DEPTH)/coreconf/rules.mk
 
 # Redefine MAKE_OBJDIR for just this directory
