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).
This commit is contained in:
Jonathan Conder
2023-07-15 13:36:40 +12:00
parent 110489e12a
commit 98fea10888
+2 -2
View File
@@ -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
'';