From f0a86e6d119877f47452a790157def800aef5a61 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 2 Sep 2024 15:31:13 +0200 Subject: [PATCH 1/2] libunwind.meta.pkgConfigModules: init This will allow packages like gstreamer that need to find libunwind via pkg-config to check whether the libunwind they've been given has the modules they expect. --- .../development/libraries/libunwind/default.nix | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/libunwind/default.nix b/pkgs/development/libraries/libunwind/default.nix index 1f7074866d589..6f491a5c527f0 100644 --- a/pkgs/development/libraries/libunwind/default.nix +++ b/pkgs/development/libraries/libunwind/default.nix @@ -1,13 +1,16 @@ -{ stdenv, lib, fetchpatch, fetchFromGitHub, autoreconfHook, xz, buildPackages }: +{ stdenv, lib, fetchpatch, fetchFromGitHub, autoreconfHook, buildPackages +, xz +, testers +}: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libunwind"; version = "1.8.1"; src = fetchFromGitHub { owner = "libunwind"; repo = "libunwind"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-rCFBHs6rCSnp5FEwbUR5veNNTqSQpFblAv8ebSPX0qE="; }; @@ -50,12 +53,18 @@ stdenv.mkDerivation rec { doCheck = false; # fails + passthru.tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + versionCheck = true; + }; + meta = with lib; { homepage = "https://www.nongnu.org/libunwind"; description = "Portable and efficient API to determine the call-chain of a program"; maintainers = with maintainers; [ orivej ]; + pkgConfigModules = [ "libunwind" "libunwind-coredump" "libunwind-generic" "libunwind-ptrace" "libunwind-setjmp" ]; # https://github.com/libunwind/libunwind#libunwind platforms = [ "aarch64-linux" "armv5tel-linux" "armv6l-linux" "armv7a-linux" "armv7l-linux" "i686-freebsd" "i686-linux" "loongarch64-linux" "mips64el-linux" "mipsel-linux" "powerpc64-linux" "powerpc64le-linux" "riscv64-linux" "s390x-linux" "x86_64-freebsd" "x86_64-linux" "x86_64-solaris" ]; license = licenses.mit; }; -} +}) From 52b0b4ef3d2b1b6a76f97d0c8c50def5640ab7c1 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 2 Sep 2024 15:33:23 +0200 Subject: [PATCH 2/2] gst_all_1.gstreamer: use a better libunwind check Checking for Darwin didn't take into account that we also use a libunwind implementation without pkg-config on riscv32-linux. Fix by checking for the presence of the pkg-config file required directly, rather than by using platform as a proxy. --- pkgs/development/libraries/gstreamer/core/default.nix | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkgs/development/libraries/gstreamer/core/default.nix b/pkgs/development/libraries/gstreamer/core/default.nix index e8f873555d70b..d1094cfc8794c 100644 --- a/pkgs/development/libraries/gstreamer/core/default.nix +++ b/pkgs/development/libraries/gstreamer/core/default.nix @@ -21,8 +21,9 @@ , buildPackages , withIntrospection ? lib.meta.availableOn stdenv.hostPlatform gobject-introspection && stdenv.hostPlatform.emulatorAvailable buildPackages , libunwind -# darwin.libunwind doesn't have pkg-config definitions so meson doesn't detect it. -, withLibunwind ? !stdenv.isDarwin && lib.meta.availableOn stdenv.hostPlatform libunwind +, withLibunwind ? + lib.meta.availableOn stdenv.hostPlatform libunwind && + lib.elem "libunwind" libunwind.meta.pkgConfigModules or [] # Checks meson.is_cross_build(), so even canExecute isn't enough. , enableDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform, hotdoc }: