Signed-off-by: Khem Raj <[email protected]>
---
 ...Makefile-Detect-compiler-in-makefile.patch | 45 +++++++++++++++++++
 .../libfaketime/libfaketime_0.9.10.bb         |  7 +--
 2 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 
meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch

diff --git 
a/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch
 
b/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch
new file mode 100644
index 0000000000..ff04837652
--- /dev/null
+++ 
b/meta-oe/recipes-test/libfaketime/libfaketime/0001-Makefile-Detect-compiler-in-makefile.patch
@@ -0,0 +1,45 @@
+From 735bb5d053efad274aa4ea5a6682e656ff792909 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Thu, 24 Aug 2023 01:49:48 -0700
+Subject: [PATCH] Makefile: Detect compiler in makefile
+
+Add compiler specific options based on detected compiler gcc/clang
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ src/Makefile | 18 +++++++++++++++++-
+ 1 file changed, 17 insertions(+), 1 deletion(-)
+
+diff --git a/src/Makefile b/src/Makefile
+index 62e924c..c15eb33 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -110,7 +110,23 @@ PREFIX ?= /usr/local
+ LIBDIRNAME ?= /lib/faketime
+ PLATFORM ?=$(shell uname)
+ 
+-CFLAGS += -std=gnu99 -Wall -Wextra -Werror -Wno-nonnull-compare 
-DFAKE_PTHREAD -DFAKE_STAT -DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS 
-DFAKE_INTERNAL_CALLS -fPIC -DPREFIX='"'$(PREFIX)'"' 
-DLIBDIRNAME='"'$(LIBDIRNAME)'"' $(FAKETIME_COMPILE_CFLAGS)
++ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
++COMPILER := clang
++else
++COMPILER := gcc
++endif
++export COMPILER
++
++CFLAGS += -std=gnu99 -Wall -Wextra -Werror -DFAKE_PTHREAD -DFAKE_STAT 
-DFAKE_UTIME -DFAKE_SLEEP -DFAKE_TIMERS -DFAKE_INTERNAL_CALLS -fPIC 
-DPREFIX='"'$(PREFIX)'"' -DLIBDIRNAME='"'$(LIBDIRNAME)'"' 
$(FAKETIME_COMPILE_CFLAGS)
++
++ifeq ($(COMPILER),clang)
++CFLAGS += -Wno-tautological-pointer-compare
++endif
++
++ifeq ($(COMPILER),gcc)
++CFLAGS += -Wno-nonnull-compare
++endif
++
+ ifeq ($(PLATFORM),SunOS)
+ CFLAGS += -D__EXTENSIONS__ -D_XOPEN_SOURCE=600
+ endif
+-- 
+2.42.0
+
diff --git a/meta-oe/recipes-test/libfaketime/libfaketime_0.9.10.bb 
b/meta-oe/recipes-test/libfaketime/libfaketime_0.9.10.bb
index 7500e57658..49f68bf629 100644
--- a/meta-oe/recipes-test/libfaketime/libfaketime_0.9.10.bb
+++ b/meta-oe/recipes-test/libfaketime/libfaketime_0.9.10.bb
@@ -4,9 +4,10 @@ LICENSE = "GPL-2.0-only"
 LIC_FILES_CHKSUM = "file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
 SRCREV = "d475b925943ad404c6c728ac868dc73949e7281c"
-SRC_URI = "\
-    git://[email protected]/wolfcw/libfaketime.git;branch=master;protocol=https \
-    "
+
+SRC_URI = 
"git://github.com/wolfcw/libfaketime.git;branch=master;protocol=https \
+           file://0001-Makefile-Detect-compiler-in-makefile.patch \
+           "
 
 S = "${WORKDIR}/git"
 
-- 
2.42.0

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#104590): 
https://lists.openembedded.org/g/openembedded-devel/message/104590
Mute This Topic: https://lists.openembedded.org/mt/100939620/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to