mtce: add patches to fix build failures on CentOS

- Add a patch to avoid using 'which' to check CC since
  the 'which' on CentOS doesn't allow options.

- Add a patch to fix the libamon link failure.

Story: 2008204
Task: 40988

Change-Id: I1ee37c049d9d1286b5d1a1afa0dc7e9516eb6b49
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
This commit is contained in:
Jackie Huang 2020-09-27 09:39:25 +08:00
parent ff8142bed3
commit 8242257228
5 changed files with 110 additions and 0 deletions

@ -0,0 +1,29 @@
From 840f382ee691596474966f74bd1be37722bbc91c Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Tue, 9 Jun 2020 20:52:31 +0800
Subject: [PATCH] mtce-common: do not use which to check CC
Upstream-Status: Inappropriate [OE cross-compile specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
common/Makefile | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index e0a5574..d44eef6 100755
--- a/common/Makefile
+++ b/common/Makefile
@@ -54,9 +54,7 @@ CCFLAGS = -g -O2 -Wall -Wextra -Werror -std=c++11
STATIC_ANALYSIS_TOOL = cppcheck
STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0)
-ifeq (,$(shell which ${CC}))
-CC=g++
-endif
+CC ?= g++
.cpp.o:
$(CXX) $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) -c $< -o $@
--
2.7.4

@ -0,0 +1,45 @@
From 840f382ee691596474966f74bd1be37722bbc91c Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Tue, 9 Jun 2020 20:52:31 +0800
Subject: [PATCH] mtce: do not use which to check CC
Upstream-Status: Inappropriate [OE cross-compile specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
common/Makefile | 4 +---
public/Makefile | 4 +---
2 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/common/Makefile b/common/Makefile
index 229a1a3..f797724 100755
--- a/common/Makefile
+++ b/common/Makefile
@@ -17,9 +17,7 @@ CCFLAGS = -g -O2 -Wall -Wextra -Werror -std=c++11
STATIC_ANALYSIS_TOOL = cppcheck
STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0)
-ifeq (,$(shell which ${CC}))
-CC=g++
-endif
+CC ?= g++
.cpp.o:
$(CXX) $(CCFLAGS) $(INCLUDES) $(EXTRACCFLAGS) -c $< -o $@
diff --git a/public/Makefile b/public/Makefile
index 403638f..7dd80e4 100644
--- a/public/Makefile
+++ b/public/Makefile
@@ -13,9 +13,7 @@ LDFLAGS = -shared
CFLAGS = -fPIC -g -O2 -Wall -Wextra -Werror
TARGET_LIB = libamon.so
lib: build
-ifeq (,$(shell which ${CC}))
-CC=gcc
-endif
+CC ?= gcc
STATIC_ANALYSIS_TOOL = cppcheck
STATIC_ANALYSIS_TOOL_EXISTS = $(shell [[ -e `which $(STATIC_ANALYSIS_TOOL)` ]] && echo 1 || echo 0)
--
2.7.4

@ -0,0 +1,30 @@
From d233ae2930996102bbdd16085b29058a4d01179c Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Tue, 9 Jun 2020 22:49:56 +0800
Subject: [PATCH] libamon: add shared option
The -shared option is set in the parent Makefile, but somehow
it's lost on CentOS, so add it diretly in the target command.
Upstream-Status: Inappropriate [OE cross-compile specific]
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
public/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/Makefile b/public/Makefile
index 7dd80e4..1967a90 100644
--- a/public/Makefile
+++ b/public/Makefile
@@ -37,7 +37,7 @@ ${TARGET_LIB}.${VER_MJR}: ${TARGET_LIB}.${VER}
ln -sf $^ $@
${TARGET_LIB}.${VER}: $(OBJS)
- $(CC) ${LDFLAGS} -Wl,-soname,${TARGET_LIB}.${VER_MJR} -o $@ $^
+ $(CC) ${LDFLAGS} -shared -Wl,-soname,${TARGET_LIB}.${VER_MJR} -o $@ $^
$(SRCS:.c=.d):%.d:%.c
$(CC) $(CFLAGS) -MM $< >$@
--
2.7.4

@ -5,6 +5,10 @@ SUBPATH0 = "mtce-common/src/"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
SRC_URI += " \
file://mtce-common-do-not-use-which-to-check-CC.patch \
"
RDEPENDS_${PN}_append = " \
util-linux \
bash \

@ -12,6 +12,8 @@ SRC_URI += " \
file://0002-mtce-Adjust-paths.patch \
file://mtce-set-systemctl-path.patch \
file://pmon_send_pulse.patch;striplevel=3 \
file://mtce-do-not-use-which-to-check-CC.patch \
file://mtce-libamon-add-shared-option.patch \
"
PACKAGES += " ${PN}-pmon"