lm_sensors: fix glibc-2.30

This commit is contained in:
MilhouseVH 2019-08-07 16:44:04 +01:00
parent e595ad2644
commit 8e7cd6279c

View File

@ -0,0 +1,48 @@
From ee1aba92d670701b2aa3d798f1c3c84061eca554 Mon Sep 17 00:00:00 2001
From: Lucas Magasweran <lucas.magasweran@ieee.org>
Date: Wed, 7 Aug 2019 14:43:23 +0200
Subject: [PATCH] makefile: use target arch when determining what programs to
compile
`uname -m` lists the host machine architecture. To support cross-compilation
the Makefile should detect the compiler's target architecture. This approach
uses the `gcc`/`clang` compatible `-dumpmachine` option and parses the first
word in the tuple representing the target architecture.
Renaming `MACHINE` to `ARCH` to match cross-compiler conventions for
specifying the target architecture (e.g.
`make ARCH=arm CC=arm-linux-gnueabi-gcc`)
Just like for PPC the `isadump` and `isaset` tools should not be compiled
on ARM. This has the side affect of "fixing" the ARM build with glibc-2.30,
which removed `sys/io.h` I/O port functions.
Fixes #190
Signed-off-by: Lucas Magasweran <lucas.magasweran@ieee.org>
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index 2f5859f0..47ffe788 100644
--- a/Makefile
+++ b/Makefile
@@ -77,7 +77,7 @@ LIBINCLUDEDIR := $(INCLUDEDIR)/sensors
# manual pages will be installed.
MANDIR := $(PREFIX)/man
-MACHINE := $(shell uname -m)
+ARCH := $(firstword $(subst -, ,$(shell $(CC) -dumpmachine)))
# Extra non-default programs to build; e.g., sensord
#PROG_EXTRA := sensord
@@ -109,7 +109,7 @@ BUILD_STATIC_LIB := 1
SRCDIRS := lib prog/detect prog/pwm \
prog/sensors ${PROG_EXTRA:%=prog/%} etc
# Only build isadump and isaset on x86 machines.
-ifneq (,$(findstring $(MACHINE), i386 i486 i586 i686 x86_64))
+ifneq (,$(findstring $(ARCH), i386 i486 i586 i686 x86_64))
SRCDIRS += prog/dump
endif
SRCDIRS += lib/test