Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 11 additions & 32 deletions pkgs/by-name/lm/lm_sensors/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
bash,
bison,
flex,
Expand All @@ -13,7 +12,7 @@
}:

let
version = "3.6.0";
version = "3.6.2";
tag = "V" + lib.replaceStrings [ "." ] [ "-" ] version;

in
Expand All @@ -22,21 +21,12 @@ stdenv.mkDerivation {
inherit version;

src = fetchFromGitHub {
owner = "lm-sensors";
owner = "hramrach"; # openSUSE fork used by openSUSE and Gentoo
repo = "lm-sensors";
inherit tag;
hash = "sha256-9lfHCcODlS7sZMjQhK0yQcCBEoGyZOChx/oM0CU37sY=";
hash = "sha256-EmS9H3TQac6bHs2G8t1C2cQNAjN13zPoKDysny6aTFw=";
};

patches = [
# Fix compile failure on GCC 14 with `sensord` enabled.
# From: https://github.com/lm-sensors/lm-sensors/pull/483
(fetchpatch {
url = "https://github.com/lm-sensors/lm-sensors/pull/483/commits/7a6170f07d05cc6601b4668f211e9389f2e75286.patch";
hash = "sha256-Q49quv3eXeMvY3jgZFs/F7Rljbq4YyehIDIlsgmloBQ=";
})
];

outputs = [
"bin"
"out"
Expand All @@ -51,13 +41,6 @@ stdenv.mkDerivation {
''
substituteInPlace lib/init.c \
--replace-fail 'ETCDIR "/sensors.d"' '"/etc/sensors.d"'
''
# Upstream build system have knob to enable and disable building of static
# library, shared library is built unconditionally.
+ lib.optionalString stdenv.hostPlatform.isStatic ''
sed -i 'lib/Module.mk' -e '/LIBTARGETS :=/,+1d; /-m 755/ d'
substituteInPlace prog/sensors/Module.mk \
--replace-fail 'lib/$(LIBSHBASENAME)' ""
'';

nativeBuildInputs = [
Expand All @@ -80,28 +63,24 @@ stdenv.mkDerivation {
"MANDIR=${placeholder "man"}/share/man"
# This is a dependency of the library.
"ETCDIR=${placeholder "out"}/etc"
"BUILD_SHARED_LIB=${if stdenv.hostPlatform.isStatic then "0" else "1"}"
"BUILD_STATIC_LIB=${if stdenv.hostPlatform.isStatic then "1" else "0"}"
Comment on lines 66 to 67
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does ${toString stdenv.hostPlatform.isStatic} work? The only difference is that toString false == "". Not sure if it breaks stuff.1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While verbose, it's very clear what is going on so I favour this way of doing it for readability's sake.


"CC=${stdenv.cc.targetPrefix}cc"
"AR=${stdenv.cc.targetPrefix}ar"
] ++ lib.optional sensord "PROG_EXTRA=sensord";

enableParallelBuilding = true;

# Making regexp to patch-out installing of .so symlinks from Makefile is
# complicated, it is easier to remove them post-install.
postInstall =
''
mkdir -p $doc/share/doc/lm_sensors
cp -r configs doc/* $doc/share/doc/lm_sensors
''
+ lib.optionalString stdenv.hostPlatform.isStatic ''
rm $out/lib/*.so*
'';
postInstall = ''
mkdir -p $doc/share/doc/lm_sensors
cp -r configs doc/* $doc/share/doc/lm_sensors
'';

meta = {
homepage = "https://hwmon.wiki.kernel.org/lm_sensors";
changelog = "https://raw.githubusercontent.com/lm-sensors/lm-sensors/${tag}/CHANGES";
description = "Tools for reading hardware sensors";
changelog = "https://raw.githubusercontent.com/hramrach/lm-sensors/${tag}/CHANGES";
description = "Tools for reading hardware sensors - maintained fork";
license = with lib.licenses; [
lgpl21Plus
gpl2Plus
Expand Down
Loading