From e0c11cd5d01495c5de7a354a9b16a824b3c8e96d Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Jan 2025 18:58:33 +0000 Subject: [PATCH 1/4] 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; From e872faaec259dbca1797693739eff1dcbedd426d Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Jan 2025 18:58:46 +0000 Subject: [PATCH 2/4] talloc: fix pkgsLLVM build --- pkgs/by-name/ta/talloc/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/ta/talloc/package.nix b/pkgs/by-name/ta/talloc/package.nix index 2a9395a1c41a..0f617b4b04c6 100644 --- a/pkgs/by-name/ta/talloc/package.nix +++ b/pkgs/by-name/ta/talloc/package.nix @@ -67,6 +67,11 @@ stdenv.mkDerivation rec { # module, which works correctly in all cases. PYTHON_CONFIG = "/invalid"; + # https://reviews.llvm.org/D135402 + NIX_LDFLAGS = lib.optional ( + stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17" + ) "--undefined-version"; + # this must not be exported before the ConfigurePhase otherwise waf whines preBuild = lib.optionalString stdenv.hostPlatform.isMusl '' export NIX_CFLAGS_LINK="-no-pie -shared"; From 1e194a33f20ce8080da7184c4023a93103fd1b57 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Jan 2025 18:58:56 +0000 Subject: [PATCH 3/4] tdb: fix pkgsLLVM build --- pkgs/by-name/td/tdb/package.nix | 53 ++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/pkgs/by-name/td/tdb/package.nix b/pkgs/by-name/td/tdb/package.nix index 3cf8aabc948e..439256acb8a6 100644 --- a/pkgs/by-name/td/tdb/package.nix +++ b/pkgs/by-name/td/tdb/package.nix @@ -1,14 +1,16 @@ -{ lib, stdenv -, fetchurl -, pkg-config -, wafHook -, buildPackages -, python3 -, readline -, libxslt -, libxcrypt -, docbook-xsl-nons -, docbook_xml_dtd_45 +{ + lib, + stdenv, + fetchurl, + pkg-config, + wafHook, + buildPackages, + python3, + readline, + libxslt, + libxcrypt, + docbook-xsl-nons, + docbook_xml_dtd_45, }: stdenv.mkDerivation rec { @@ -44,23 +46,32 @@ stdenv.mkDerivation rec { wafPath = "buildtools/bin/waf"; - wafConfigureFlags = [ - "--bundled-libraries=NONE" - "--builtin-libraries=replace" - ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ - "--cross-compile" - "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" - ]; + wafConfigureFlags = + [ + "--bundled-libraries=NONE" + "--builtin-libraries=replace" + ] + ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ + "--cross-compile" + "--cross-execute=${stdenv.hostPlatform.emulator buildPackages}" + ]; - postFixup = if stdenv.hostPlatform.isDarwin - then ''install_name_tool -id $out/lib/libtdb.dylib $out/lib/libtdb.dylib'' - else null; + postFixup = + if stdenv.hostPlatform.isDarwin then + ''install_name_tool -id $out/lib/libtdb.dylib $out/lib/libtdb.dylib'' + else + null; # 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"; + # https://reviews.llvm.org/D135402 + NIX_LDFLAGS = lib.optional ( + stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17" + ) "--undefined-version"; + meta = with lib; { description = "Trivial database"; longDescription = '' From 23b4e3fabb44c2b8294725d1326c8e706f5d2375 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Sun, 12 Jan 2025 18:59:07 +0000 Subject: [PATCH 4/4] tevent: fix pkgsLLVM build --- pkgs/by-name/te/tevent/package.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkgs/by-name/te/tevent/package.nix b/pkgs/by-name/te/tevent/package.nix index ef2a8dd47d3d..15ff833851a7 100644 --- a/pkgs/by-name/te/tevent/package.nix +++ b/pkgs/by-name/te/tevent/package.nix @@ -67,6 +67,11 @@ stdenv.mkDerivation rec { # module, which works correctly in all cases. PYTHON_CONFIG = "/invalid"; + # https://reviews.llvm.org/D135402 + NIX_LDFLAGS = lib.optional ( + stdenv.cc.bintools.isLLVM && lib.versionAtLeast stdenv.cc.bintools.version "17" + ) "--undefined-version"; + meta = with lib; { description = "Event system based on the talloc memory management library"; homepage = "https://tevent.samba.org/";