···101101 ln -s zlib1.dll $out/bin/libz.dll
102102 '';
103103104104- # As zlib takes part in the stdenv building, we don't want references
105105- # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
106106- env.NIX_CFLAGS_COMPILE = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-static-libgcc";
104104+ env = lib.optionalAttrs (!stdenv.hostPlatform.isDarwin) {
105105+ # As zlib takes part in the stdenv building, we don't want references
106106+ # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
107107+ NIX_CFLAGS_COMPILE = "-static-libgcc";
108108+ } // lib.optionalAttrs (stdenv.hostPlatform.linker == "lld") {
109109+ # lld 16 enables --no-undefined-version by defualt
110110+ # This makes configure think it can't build dynamic libraries
111111+ # this may be removed when a version is packaged with https://github.com/madler/zlib/issues/960 fixed
112112+ NIX_LDFLAGS = "--undefined-version";
113113+ };
107114108115 # We don't strip on static cross-compilation because of reports that native
109116 # stripping corrupted the target library; see commit 12e960f5 for the report.