From 77259eae4be3dfb2ec6fe00489daea03477532e6 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Sat, 22 Oct 2022 16:17:22 -0700 Subject: [PATCH] mybw: Pass cflags/ldflags from bitbake This helps in compiling this will e.g. clang/libc++ Signed-off-by: Khem Raj --- ...llow-CFLAGS-LDFLAGS-from-environment.patch | 31 +++++++++++++++++++ recipes-test/mybw/mybw_git.bb | 5 ++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 recipes-test/mybw/mybw/0001-makefile-Allow-CFLAGS-LDFLAGS-from-environment.patch diff --git a/recipes-test/mybw/mybw/0001-makefile-Allow-CFLAGS-LDFLAGS-from-environment.patch b/recipes-test/mybw/mybw/0001-makefile-Allow-CFLAGS-LDFLAGS-from-environment.patch new file mode 100644 index 0000000..77fbc94 --- /dev/null +++ b/recipes-test/mybw/mybw/0001-makefile-Allow-CFLAGS-LDFLAGS-from-environment.patch @@ -0,0 +1,31 @@ +From bde677567226a8b7a6c773f863d3f820eca26000 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sat, 22 Oct 2022 16:13:47 -0700 +Subject: [PATCH] makefile: Allow CFLAGS/LDFLAGS from environment. + +This helps in cross-compilation where the flags passed from environment +will matter much e.g. ABI, architecture etc. + +Upstream-Status: Submitted [https://github.com/andersson/mybw/pull/1] +Signed-off-by: Khem Raj +--- + Makefile | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/Makefile b/Makefile +index dfbba09..28a96bc 100644 +--- a/Makefile ++++ b/Makefile +@@ -1,7 +1,7 @@ + OUT := mybw + +-CFLAGS := -O2 -Wall -fno-builtin +-LDFLAGS := -static -static-libgcc ++CFLAGS += -O2 -Wall -fno-builtin ++LDFLAGS += -static -static-libgcc + + SRCS := mybw.c + OBJS := $(SRCS:.c=.o) +-- +2.38.1 + diff --git a/recipes-test/mybw/mybw_git.bb b/recipes-test/mybw/mybw_git.bb index 9de5f4f..17e2336 100644 --- a/recipes-test/mybw/mybw_git.bb +++ b/recipes-test/mybw/mybw_git.bb @@ -4,7 +4,9 @@ LICENSE = "BSD-3-Clause" LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD-3-Clause-Clear;md5=7a434440b651f4a472ca93716d01033a" SRCREV = "f4bdeee1266c273e308d0651522bb59afb5b8211" -SRC_URI = "git://github.com/andersson/mybw;protocol=https;branch=main" +SRC_URI = "git://github.com/andersson/mybw;protocol=https;branch=main \ + file://0001-makefile-Allow-CFLAGS-LDFLAGS-from-environment.patch \ + " S = "${WORKDIR}/git" @@ -19,3 +21,4 @@ do_install () { install -m 0755 mybw ${D}${bindir}/mybw } +LDFLAGS += "-lgcc"