pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

btop-git: fix build in netbsd 10.



Module Name:	pkgsrc-wip
Committed By:	Santhosh Raju <fox%NetBSD.org@localhost>
Pushed By:	fox
Date:		Sat Mar 2 15:02:30 2024 +0100
Changeset:	acb8facbb8003273924c179c0ffcf0c33b083c64

Modified Files:
	btop-git/Makefile
	btop-git/distinfo
	btop-git/patches/patch-src_netbsd_btop__collect.cpp

Log Message:
btop-git: fix build in netbsd 10.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=acb8facbb8003273924c179c0ffcf0c33b083c64

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 btop-git/Makefile                                  |  2 +-
 btop-git/distinfo                                  |  2 +-
 .../patches/patch-src_netbsd_btop__collect.cpp     | 34 +++++++++++++++++-----
 3 files changed, 29 insertions(+), 9 deletions(-)

diffs:
diff --git a/btop-git/Makefile b/btop-git/Makefile
index 6980ccb9b6..9a6203f8f2 100644
--- a/btop-git/Makefile
+++ b/btop-git/Makefile
@@ -16,7 +16,7 @@ USE_TOOLS+=	gmake
 GCC_REQD+=	10 # needs --std=c++20
 
 CXXFLAGS+=	-DNDEBUG
-MAKE_ENV+=	STATIC=true STRIP=true VERBOSE=true
+MAKE_ENV+=	STRIP=true VERBOSE=true
 
 .include "../../graphics/hicolor-icon-theme/buildlink3.mk"
 .include "../../mk/pthread.buildlink3.mk"
diff --git a/btop-git/distinfo b/btop-git/distinfo
index de5b5f657a..3bf2c38c32 100644
--- a/btop-git/distinfo
+++ b/btop-git/distinfo
@@ -5,4 +5,4 @@ SHA512 (btop-1.2.13.20240301-c6fbfd1e27c27cfe89b2e272c0419e57193ea8c5.tar.gz) =
 Size (btop-1.2.13.20240301-c6fbfd1e27c27cfe89b2e272c0419e57193ea8c5.tar.gz) = 1145548 bytes
 SHA1 (patch-Makefile) = 851febd30b48556be117091f806c2939af23ce38
 SHA1 (patch-src_btop.cpp) = 60c805d6a5343d2e46f8f7cb0b03059426871fe9
-SHA1 (patch-src_netbsd_btop__collect.cpp) = 9d7924f00345c28187e1eb5e75bf85ddb31d7baa
+SHA1 (patch-src_netbsd_btop__collect.cpp) = 4b2e4b5b55a736729ae22da8fc954f39836d0fa8
diff --git a/btop-git/patches/patch-src_netbsd_btop__collect.cpp b/btop-git/patches/patch-src_netbsd_btop__collect.cpp
index 0d3a4c86a0..86a47357eb 100644
--- a/btop-git/patches/patch-src_netbsd_btop__collect.cpp
+++ b/btop-git/patches/patch-src_netbsd_btop__collect.cpp
@@ -2,9 +2,9 @@ $NetBSD$
 
 Add support for NetBSD.
 
---- src/netbsd/btop_collect.cpp.orig	2024-03-01 12:39:33.067157726 +0000
+--- src/netbsd/btop_collect.cpp.orig	2024-03-01 14:23:27.335179971 +0000
 +++ src/netbsd/btop_collect.cpp
-@@ -0,0 +1,1416 @@
+@@ -0,0 +1,1436 @@
 +/* Copyright 2021 Aristocratos (jakob%qvantnet.com@localhost)
 +
 +   Licensed under the Apache License, Version 2.0 (the "License");
@@ -269,6 +269,16 @@ Add support for NetBSD.
 +	bool get_sensors() {
 +		got_sensors = false;
 +		prop_dictionary_t dict;
++		prop_object_t fields_array;
++		// List of common thermal sensors in NetBSD.
++		const string sensors[6] = {
++			"acpitz0",
++			"acpitz1",
++			"coretemp0",
++			"coretemp1",
++			"thinkpad0",
++			"amdzentemp0"
++		};
 +
 +		int fd = open(_PATH_SYSMON, O_RDONLY);
 +		if (fd == -1) {
@@ -292,12 +302,20 @@ Add support for NetBSD.
 +			return got_sensors;
 +		}
 +
-+		prop_object_t fields_array = prop_dictionary_get(prop_dictionary_t(dict), "acpitz0");
++		// Search through a known list of sensors and break the loop on finding the first.
++		for(const string &sensor : sensors) {
++			fields_array = prop_dictionary_get(prop_dictionary_t(dict), sensor.c_str());
++			if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) {
++				Logger::warning("unknown device " + sensor);
++			} else {
++				Cpu::cpu_sensor = sensor;
++				break;
++			}
++		}
 +		if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) {
 +			if (fd != -1) {
 +				close(fd);
 +			}
-+			Logger::warning("unknown device 'acpitz0'");
 +			return got_sensors;
 +		}
 +
@@ -336,12 +354,12 @@ Add support for NetBSD.
 +			return;
 +		}
 +
-+		prop_object_t fields_array = prop_dictionary_get(prop_dictionary_t(dict), "acpitz0");
++		prop_object_t fields_array = prop_dictionary_get(prop_dictionary_t(dict), Cpu::cpu_sensor.c_str());
 +		if (prop_object_type(fields_array) != PROP_TYPE_ARRAY) {
 +			if (fd != -1) {
 +				close(fd);
 +			}
-+			Logger::warning("unknown device 'acpitz0'");
++			Logger::warning("unknown device " + Cpu::cpu_sensor);
 +			return;
 +		}
 +
@@ -371,7 +389,9 @@ Add support for NetBSD.
 +
 +			if (prop_description == "temperature") {
 +				current_temp = prop_number_integer_value(prop_number_t(cur_value));
-+				current_cpu.temp_max = MUKTOC(prop_number_integer_value(prop_number_t(max_value)));
++				if (max_value != NULL) {
++					current_cpu.temp_max = MUKTOC(prop_number_integer_value(prop_number_t(max_value)));
++				}
 +			}
 +		}
 +


Home | Main Index | Thread Index | Old Index