From 26969c3a819dd44cd15812fb50af8127ce15675a Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Sun, 20 Nov 2022 18:14:09 -0500 Subject: [PATCH] pkgsStatic.lm_sensors: fix build --- pkgs/os-specific/linux/lm-sensors/default.nix | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/pkgs/os-specific/linux/lm-sensors/default.nix b/pkgs/os-specific/linux/lm-sensors/default.nix index c40a37940543..895e84f827b4 100644 --- a/pkgs/os-specific/linux/lm-sensors/default.nix +++ b/pkgs/os-specific/linux/lm-sensors/default.nix @@ -24,6 +24,13 @@ stdenv.mkDerivation rec { hash = "sha256-9lfHCcODlS7sZMjQhK0yQcCBEoGyZOChx/oM0CU37sY="; }; + # Upstream build system have knob to enable and disable building of static + # library, shared library is built unconditionally. + postPatch = lib.optionalString stdenv.hostPlatform.isStatic '' + sed -i 'lib/Module.mk' -e '/LIBTARGETS :=/,+1d; /-m 755/ d' + substituteInPlace prog/sensors/Module.mk --replace 'lib/$(LIBSHBASENAME)' "" + ''; + nativeBuildInputs = [ bison flex which ]; # bash is required for correctly replacing the shebangs in all tools for cross-compilation. buildInputs = [ bash perl ] @@ -39,6 +46,12 @@ stdenv.mkDerivation rec { "ETCDIR=${placeholder "out"}/etc" ]; + # Making regexp to patch-out installing of .so symlinks from Makefile is + # complicated, it is easier to remove them post-install. + postInstall = lib.optionalString stdenv.hostPlatform.isStatic '' + rm $out/lib/*.so* + ''; + meta = with lib; { homepage = "https://hwmon.wiki.kernel.org/lm_sensors"; changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/V${dashedVersion}/CHANGES";