1 |
commit: c578a4e87a66dd39ebaf96aea13b06f4ceaca8b9 |
2 |
Author: Marek Szuba <marecki <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Sep 7 13:04:01 2022 +0000 |
4 |
Commit: Marek Szuba <marecki <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Sep 7 14:30:06 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c578a4e8 |
7 |
|
8 |
sys-apps/lm-sensors: recommend new module for Nuvoton W83677HG-I in sensors-detect |
9 |
|
10 |
Backported patch from upstream Git master. |
11 |
|
12 |
Closes: https://bugs.gentoo.org/811327 |
13 |
Signed-off-by: Marek Szuba <marecki <AT> gentoo.org> |
14 |
|
15 |
.../files/lm-sensors-3.6.0-w83627ehf-nct6775.patch | 46 +++++ |
16 |
sys-apps/lm-sensors/lm-sensors-3.6.0-r1.ebuild | 226 +++++++++++++++++++++ |
17 |
2 files changed, 272 insertions(+) |
18 |
|
19 |
diff --git a/sys-apps/lm-sensors/files/lm-sensors-3.6.0-w83627ehf-nct6775.patch b/sys-apps/lm-sensors/files/lm-sensors-3.6.0-w83627ehf-nct6775.patch |
20 |
new file mode 100644 |
21 |
index 000000000000..e4493c414a49 |
22 |
--- /dev/null |
23 |
+++ b/sys-apps/lm-sensors/files/lm-sensors-3.6.0-w83627ehf-nct6775.patch |
24 |
@@ -0,0 +1,46 @@ |
25 |
+From 23c53b457407ab3ed217f963fc0329d0ae4bdeac Mon Sep 17 00:00:00 2001 |
26 |
+From: Jean Delvare <jdelvare@××××.de> |
27 |
+Date: Tue, 12 May 2020 16:22:06 +0200 |
28 |
+Subject: [PATCH] sensors-detect: Fix the driver for Nuvoton W83677HG-I |
29 |
+ |
30 |
+Originally, support for the Nuvoton W83677HG-I and derivatives was |
31 |
+first added to the w83627ehf driver, so that's the driver recommended |
32 |
+by sensors-detect. Later, support for the same device was added to |
33 |
+the nct6775 driver. In kernel v5.6, support was removed from the |
34 |
+w83627ehf driver to get rid of the duplicate code. |
35 |
+ |
36 |
+So sensors-detect should now point users of this device to the |
37 |
+nct6775 driver. We can't do that for very old kernels though, as this |
38 |
+driver did not exist back then. I chose v3.10 for the cut-over, as |
39 |
+this is when support for the Nuvoton W83677HG-I was finalized in the |
40 |
+nct6775 driver, at least according to git log. |
41 |
+ |
42 |
+Signed-off-by: Jean Delvare <jdelvare@××××.de> |
43 |
+--- |
44 |
+ prog/detect/sensors-detect | 6 ++++-- |
45 |
+ 1 file changed, 4 insertions(+), 2 deletions(-) |
46 |
+ |
47 |
+diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect |
48 |
+index 6fc441aa6..319b1b7b9 100755 |
49 |
+--- a/prog/detect/sensors-detect |
50 |
++++ b/prog/detect/sensors-detect |
51 |
+@@ -2273,7 +2273,7 @@ use constant FEAT_SMBUS => (1 << 7); |
52 |
+ features => FEAT_IN | FEAT_FAN | FEAT_TEMP, |
53 |
+ }, { |
54 |
+ name => "Nuvoton W83677HG-I (NCT5572D/NCT6771F/NCT6772F/NCT6775F) Super IO Sensors", |
55 |
+- driver => "w83627ehf", |
56 |
++ driver => sub { kernel_version_at_least(3, 10, 0) ? "nct6775" : "w83627ehf" }, |
57 |
+ devid => 0xB470, |
58 |
+ devid_mask => 0xFFF0, |
59 |
+ logdev => 0x0b, |
60 |
+@@ -4574,7 +4574,9 @@ sub scan_cpu |
61 |
+ sub chip_special_cases |
62 |
+ { |
63 |
+ # Some chip to driver mappings depend on the environment |
64 |
+- foreach my $chip (@chip_ids) { |
65 |
++ foreach my $chip (@chip_ids, @superio_ids_natsemi, @superio_ids_smsc, |
66 |
++ @superio_ids_smsc_ns, @superio_ids_winbond, |
67 |
++ @superio_ids_ite) { |
68 |
+ if (ref($chip->{driver}) eq 'CODE') { |
69 |
+ $chip->{driver} = $chip->{driver}->(); |
70 |
+ } |
71 |
|
72 |
diff --git a/sys-apps/lm-sensors/lm-sensors-3.6.0-r1.ebuild b/sys-apps/lm-sensors/lm-sensors-3.6.0-r1.ebuild |
73 |
new file mode 100644 |
74 |
index 000000000000..69ccb494585d |
75 |
--- /dev/null |
76 |
+++ b/sys-apps/lm-sensors/lm-sensors-3.6.0-r1.ebuild |
77 |
@@ -0,0 +1,226 @@ |
78 |
+# Copyright 1999-2022 Gentoo Authors |
79 |
+# Distributed under the terms of the GNU General Public License v2 |
80 |
+ |
81 |
+EAPI=8 |
82 |
+ |
83 |
+inherit linux-info systemd toolchain-funcs multilib-minimal |
84 |
+ |
85 |
+DESCRIPTION="Hardware Monitoring user-space utilities" |
86 |
+HOMEPAGE="https://hwmon.wiki.kernel.org/ https://github.com/lm-sensors/lm-sensors" |
87 |
+ |
88 |
+if [[ "${PV}" =~ .*_p[[:digit:]]{8}.* ]] ; then |
89 |
+ COMMIT="2c8cca3d6cd60121b401734c1a24cfec7daed4fc" |
90 |
+ SRC_URI="https://github.com/lm-sensors/${PN}/archive/${COMMIT}.tar.gz -> ${P}.tar.gz" |
91 |
+ S="${WORKDIR}/${PN}-${COMMIT}" |
92 |
+else |
93 |
+ SRC_URI="https://github.com/lm-sensors/lm-sensors/archive/V$(ver_rs 1- -).tar.gz -> ${P}.tar.gz" |
94 |
+ S="${WORKDIR}/${PN}-$(ver_rs 1- -)" |
95 |
+fi |
96 |
+ |
97 |
+LICENSE="GPL-2+ LGPL-2.1" |
98 |
+ |
99 |
+# SUBSLOT based on SONAME of libsensors.so |
100 |
+SLOT="0/5.0.0" |
101 |
+ |
102 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~loong ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux" |
103 |
+IUSE="contrib sensord static-libs" |
104 |
+ |
105 |
+COMMON_DEPS=" |
106 |
+ sensord? ( |
107 |
+ net-analyzer/rrdtool |
108 |
+ virtual/logger |
109 |
+ )" |
110 |
+ |
111 |
+RDEPEND="${COMMON_DEPS} |
112 |
+ dev-lang/perl |
113 |
+ !<sys-apps/openrc-0.36" |
114 |
+ |
115 |
+DEPEND="${COMMON_DEPS} |
116 |
+ sys-devel/bison |
117 |
+ sys-devel/flex" |
118 |
+ |
119 |
+CONFIG_CHECK="~HWMON ~I2C_CHARDEV ~I2C" |
120 |
+WARNING_HWMON="${PN} requires CONFIG_HWMON to be enabled for use." |
121 |
+WARNING_I2C_CHARDEV="sensors-detect requires CONFIG_I2C_CHARDEV to be enabled." |
122 |
+WARNING_I2C="${PN} requires CONFIG_I2C to be enabled for most sensors." |
123 |
+ |
124 |
+PATCHES=( |
125 |
+ "${FILESDIR}"/${PN}-3.5.0-sensors-detect-gentoo.patch |
126 |
+ "${FILESDIR}"/${PN}-3.6.0-no-which.patch |
127 |
+ "${FILESDIR}"/${PN}-3.6.0-w83627ehf-nct6775.patch |
128 |
+) |
129 |
+ |
130 |
+DOCS=( CHANGES CONTRIBUTORS INSTALL README ) |
131 |
+DOCS+=( doc/{donations,fancontrol.txt,fan-divisors,libsensors-API.txt,progs,temperature-sensors,vid} ) |
132 |
+ |
133 |
+src_prepare() { |
134 |
+ default |
135 |
+ |
136 |
+ if [[ -n "${COMMIT}" ]]; then |
137 |
+ local _version="${PV%_*}+git_${COMMIT}" |
138 |
+ |
139 |
+ sed -i \ |
140 |
+ -e "s:LM_VERSION.*:LM_VERSION \"${_version}\":" \ |
141 |
+ version.h || \ |
142 |
+ die "Failed to update version.h" |
143 |
+ |
144 |
+ sed -i \ |
145 |
+ -e "s/^\$revision = '.*/\$revision = '${_version}';/" \ |
146 |
+ -e "/^\$revision =~ s.*/d" \ |
147 |
+ prog/detect/sensors-detect || \ |
148 |
+ die "Failed to set revision in prog/detect/sensors-detect" |
149 |
+ |
150 |
+ sed -i \ |
151 |
+ -e "s/^echo \"# pwmconfig revision.*/echo \"# pwmconfig revision ${_version}\"/" \ |
152 |
+ -e "/^REVISION=.*/d" \ |
153 |
+ -e "/^REVDATE=.*/d" \ |
154 |
+ -e "s:^PIDFILE=\".*:PIDFILE=\"/run/fancontrol.pid\":" \ |
155 |
+ prog/pwm/pwmconfig || \ |
156 |
+ die "Failed to adjust prog/pwm/pwmconfig" |
157 |
+ else |
158 |
+ sed -i \ |
159 |
+ -e "s:^PIDFILE=\".*:PIDFILE=\"/run/fancontrol.pid\":" \ |
160 |
+ prog/pwm/pwmconfig || \ |
161 |
+ die "Failed to adjust PIDFILE in prog/pwm/pwmconfig" |
162 |
+ fi |
163 |
+ |
164 |
+ # Respect LDFLAGS |
165 |
+ sed -i -e 's/\$(LIBDIR)$/\$(LIBDIR) \$(LDFLAGS)/g' Makefile || \ |
166 |
+ die "Failed to sed in LDFLAGS" |
167 |
+ |
168 |
+ sed -i \ |
169 |
+ -e "s:^PIDFILE=\".*:PIDFILE=\"/run/fancontrol.pid\":" \ |
170 |
+ prog/pwm/fancontrol || \ |
171 |
+ die "Failed to adjust PIDFILE of prog/pwm/fancontrol" |
172 |
+ |
173 |
+ # Don't use EnvironmentFile in systemd unit |
174 |
+ sed -i \ |
175 |
+ -e '/^EnvironmentFile=/d' \ |
176 |
+ -e '/^Exec.*modprobe.*/d' \ |
177 |
+ prog/init/lm_sensors.service || \ |
178 |
+ die "Failed to remove EnvironmentFile from systemd unit file" |
179 |
+ |
180 |
+ if ! use static-libs; then |
181 |
+ sed -i -e '/^BUILD_STATIC_LIB/d' Makefile || \ |
182 |
+ die "Failed to disable static building" |
183 |
+ fi |
184 |
+ |
185 |
+ # Don't show outdated user instructions |
186 |
+ sed -i -e '/^ @echo "\*\*\* /d' Makefile || \ |
187 |
+ die "Failed to remove outdated user instructions" |
188 |
+ |
189 |
+ multilib_copy_sources |
190 |
+} |
191 |
+ |
192 |
+multilib_src_configure() { |
193 |
+ default |
194 |
+ |
195 |
+ if multilib_is_native_abi && use sensord; then |
196 |
+ # sensord requires net-analyzer/rrdtool which doesn't have real multilib |
197 |
+ # support. To prevent errors like |
198 |
+ # |
199 |
+ # skipping incompatible /usr/lib/librrd.so when searching for -lrrd |
200 |
+ # cannot find -lrrd |
201 |
+ # |
202 |
+ # we only build sensord when we are building for profile's native ABI |
203 |
+ # (it doesn't affect libsensors.so). |
204 |
+ sed -i -e 's:^#\(PROG_EXTRA.*\):\1:' Makefile || \ |
205 |
+ die "Failed to enable building of sensord" |
206 |
+ fi |
207 |
+} |
208 |
+ |
209 |
+multilib_src_compile() { |
210 |
+ emake \ |
211 |
+ CC="$(tc-getCC)" \ |
212 |
+ CXX="$(tc-getCXX)" \ |
213 |
+ LD="$(tc-getLD)" \ |
214 |
+ AR="$(tc-getAR)" |
215 |
+} |
216 |
+ |
217 |
+multilib_src_install() { |
218 |
+ # We need to set CC and friends again here to avoid recompilation for cross |
219 |
+ # bug #799851 |
220 |
+ emake \ |
221 |
+ CC="$(tc-getCC)" \ |
222 |
+ CXX="$(tc-getCXX)" \ |
223 |
+ LD="$(tc-getLD)" \ |
224 |
+ AR="$(tc-getAR)" \ |
225 |
+ DESTDIR="${ED}" \ |
226 |
+ PREFIX="/usr" \ |
227 |
+ MANDIR="/usr/share/man" \ |
228 |
+ ETCDIR="/etc" \ |
229 |
+ LIBDIR="/usr/$(get_libdir)" \ |
230 |
+ install |
231 |
+} |
232 |
+ |
233 |
+multilib_src_install_all() { |
234 |
+ newinitd "${FILESDIR}"/lm_sensors.initd lm_sensors |
235 |
+ newconfd "${FILESDIR}"/lm_sensors.confd lm_sensors |
236 |
+ systemd_dounit prog/init/lm_sensors.service |
237 |
+ |
238 |
+ newinitd "${FILESDIR}"/fancontrol.initd fancontrol |
239 |
+ newconfd "${FILESDIR}"/fancontrol.confd fancontrol |
240 |
+ systemd_newunit "${FILESDIR}"/fancontrol.service-r1 fancontrol.service |
241 |
+ |
242 |
+ if use sensord; then |
243 |
+ newconfd "${FILESDIR}"/sensord.confd sensord |
244 |
+ newinitd "${FILESDIR}"/sensord.initd sensord |
245 |
+ systemd_newunit "${FILESDIR}"/sensord.service-r1 sensord.service |
246 |
+ fi |
247 |
+ |
248 |
+ einstalldocs |
249 |
+ |
250 |
+ docinto developers |
251 |
+ dodoc doc/developers/applications |
252 |
+ |
253 |
+ if use contrib; then |
254 |
+ insinto /usr/share/lm_sensors |
255 |
+ doins -r "${S}"/configs |
256 |
+ fi |
257 |
+} |
258 |
+ |
259 |
+pkg_postinst() { |
260 |
+ local _new_loader='3.4.0_p20160725' |
261 |
+ local _v |
262 |
+ for _v in ${REPLACING_VERSIONS}; do |
263 |
+ if ! ver_test "${_v}" -gt "${_new_loader}"; then |
264 |
+ # This is an upgrade which require migration |
265 |
+ |
266 |
+ elog "" |
267 |
+ elog "Since version 3.4.0_p20160725 ${PN} no longer loads modules on its own" |
268 |
+ elog "instead it is using \"modules-load\" services provided by OpenRC or systemd." |
269 |
+ elog "" |
270 |
+ elog "To migrate your configuration you have 2 options:" |
271 |
+ elog "" |
272 |
+ elog " a) Re-create a new configuration using \"/usr/sbin/sensors-detect\"" |
273 |
+ elog "" |
274 |
+ elog " b) Copy existing \"modules_<n>\", \"HWMON_MODULES\" or \"BUS_MODULES\"" |
275 |
+ elog " variables from \"/etc/conf.d/lm_modules\" to" |
276 |
+ elog " \"/etc/modules-load.d/lm_sensors.conf\" and adjust format." |
277 |
+ elog "" |
278 |
+ elog " For details see https://wiki.gentoo.org/wiki/Systemd#Automatic_module_loading" |
279 |
+ elog "" |
280 |
+ elog " Important: Don't forget to migrate your module's argument" |
281 |
+ elog " (modules_<name>_args variable) if your are not already" |
282 |
+ elog " using \"/etc/modprobe.d\" (which is recommended)." |
283 |
+ |
284 |
+ # Show this elog only once |
285 |
+ break |
286 |
+ fi |
287 |
+ done |
288 |
+ |
289 |
+ if [[ -z "${REPLACING_VERSIONS}" ]]; then |
290 |
+ # New installation |
291 |
+ |
292 |
+ elog "" |
293 |
+ elog "Please run \`/usr/sbin/sensors-detect' in order to setup" |
294 |
+ elog "\"/etc/modules-load.d/lm_sensors.conf\"." |
295 |
+ elog "" |
296 |
+ elog "You might want to add lm_sensors to your default runlevel to make" |
297 |
+ elog "sure the sensors get initialized on the next startup." |
298 |
+ elog "" |
299 |
+ elog "Be warned, the probing of hardware in your system performed by" |
300 |
+ elog "sensors-detect could freeze your system. Also make sure you read" |
301 |
+ elog "the documentation before running ${PN} on IBM ThinkPads." |
302 |
+ fi |
303 |
+} |