From e0c11cd5d01495c5de7a354a9b16a824b3c8e96d Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Jan 2025 18:58:33 +0000 Subject: [PATCH] ldb: fix pkgsLLVM build --- pkgs/by-name/ld/ldb/package.nix | 70 ++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/pkgs/by-name/ld/ldb/package.nix b/pkgs/by-name/ld/ldb/package.nix index 763eaa05c644..a83148a6b8e0 100644 --- a/pkgs/by-name/ld/ldb/package.nix +++ b/pkgs/by-name/ld/ldb/package.nix @@ -1,20 +1,22 @@ -{ lib, stdenv -, fetchurl -, python3 -, pkg-config -, readline -, tdb -, talloc -, tevent -, popt -, libxslt -, docbook-xsl-nons -, docbook_xml_dtd_42 -, cmocka -, wafHook -, buildPackages -, libxcrypt -, testers +{ + lib, + stdenv, + fetchurl, + python3, + pkg-config, + readline, + tdb, + talloc, + tevent, + popt, + libxslt, + docbook-xsl-nons, + docbook_xml_dtd_42, + cmocka, + wafHook, + buildPackages, + libxcrypt, + testers, }: stdenv.mkDerivation (finalAttrs: { @@ -26,7 +28,10 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-0VWIQALHnbscPYZC+LEBPy5SCzru/W6WQSrexbjWy8A="; }; - outputs = [ "out" "dev" ]; + outputs = [ + "out" + "dev" + ]; nativeBuildInputs = [ pkg-config @@ -59,21 +64,32 @@ stdenv.mkDerivation (finalAttrs: { wafPath = "buildtools/bin/waf"; - wafConfigureFlags = [ - "--bundled-libraries=NONE" - "--builtin-libraries=replace" - "--without-ldb-lmdb" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "--cross-compile" - "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" - ]; + wafConfigureFlags = + [ + "--bundled-libraries=NONE" + "--builtin-libraries=replace" + "--without-ldb-lmdb" + ] + ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" + ]; # python-config from build Python gives incorrect values when cross-compiling. # If python-config is not found, the build falls back to using the sysconfig # module, which works correctly in all cases. PYTHON_CONFIG = "/invalid"; - stripDebugList = [ "bin" "lib" "modules" ]; + # https://reviews.llvm.org/D135402 + NIX_LDFLAGS = lib.optional ( + stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17" + ) "--undefined-version"; + + stripDebugList = [ + "bin" + "lib" + "modules" + ]; passthru.tests.pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage;