From 98fea10888ea511f5cc589a8fd980531abff88e0 Mon Sep 17 00:00:00 2001 From: Jonathan Conder Date: Sat, 15 Jul 2023 13:36:40 +1200 Subject: [PATCH] lvm2: fix libdevmapper SONAME when onlyLib is on Building cryptsetup with onlyLib on leads to linker errors, because the SONAME of libdevmapper includes a version number, and the library is installed without one. This patch fixes that by delegating more of the install to make. That uncovered another issue, where invalid placeholder strings were being passed to the build, so I fixed that as well. Tested on x86_64-linux by building .#cryptsetup, which succeeds. The shared libraries are identical, but the new one is now a symlink to libdevmapper.so.1.02. The store paths in the pkgconfig file also changed (as expected). After building .#pkgsStatic.cryptsetup, the only difference are the paths in pkgconfig file (one of which was a placeholder anyway). --- pkgs/os-specific/linux/lvm2/common.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/os-specific/linux/lvm2/common.nix b/pkgs/os-specific/linux/lvm2/common.nix index 27a160033b11..c1ee23a1495c 100644 --- a/pkgs/os-specific/linux/lvm2/common.nix +++ b/pkgs/os-specific/linux/lvm2/common.nix @@ -52,7 +52,7 @@ stdenv.mkDerivation rec { "--with-default-run-dir=/run/lvm" "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" "--with-systemd-run=/run/current-system/systemd/bin/systemd-run" - ] ++ lib.optionals (!enableCmdlib) [ + ] ++ lib.optionals (!enableCmdlib && !onlyLib) [ "--bindir=${placeholder "bin"}/bin" "--sbindir=${placeholder "bin"}/bin" "--libdir=${placeholder "lib"}/lib" @@ -126,7 +126,7 @@ stdenv.mkDerivation rec { ]; installPhase = lib.optionalString onlyLib '' - install -D -t $out/lib libdm/ioctl/libdevmapper.${if stdenv.hostPlatform.isStatic then "a" else "so"} + make -C libdm install_${if stdenv.hostPlatform.isStatic then "static" else "dynamic"} make -C libdm install_include make -C libdm install_pkgconfig '';