dev86: don't require dev86-native to build dev86

Instead of installing binaries and patching the makefiles to run external commands, simply
build ifdef using BUILD_CC instead of CC.

This patch is now upstreamable, the recipe is less complicated, and nativesdk works.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
This commit is contained in:
Ross Burton 2021-12-01 17:41:36 +01:00 committed by Bruce Ashfield
parent a395014a7d
commit 811a59d82b
3 changed files with 32 additions and 45 deletions

View File

@ -1,36 +0,0 @@
From 9b347a5ee9604d4ec972506328ee44a0d8eb1bf0 Mon Sep 17 00:00:00 2001
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Fri, 14 May 2021 06:32:02 -0700
Subject: [PATCH] Makefile: use ifdefg from dev86-native instead of target
* recipe is restricted to:
COMPATIBLE_HOST = "(i.86|x86_64).*-linux"
so it's less likely to reproduce invalid combination of
host and target, but I guess if you have aarch64 build
machine and build for x86 then it might fail as for Bruce:
| ./ifdefg -MU makefile.in >tmp.mak
| /bin/sh: 1: ./ifdefg: not found
| make[1]: *** [Makefile:46: make.fil] Error 127
use ifdefg from native build to increase chances that it
will be compatible with your host system
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8a61b65..7fdf861 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,7 @@ realclean:
-for X in */; do cd $$X && make clean; cd $(WD); done
make.fil: $(IFDEFNAME) makefile.in
- ./$(IFDEFNAME) -MU $(IFDEFOPTS) makefile.in >tmp.mak
+ $(IFDEFNAME) -MU $(IFDEFOPTS) makefile.in >tmp.mak
echo > tmp.sed
[ "$(BINDIR)" != "//bin" ] || echo >> tmp.sed "s:%BINDIR%:/bin:"
[ "$(LIBDIR)" != "//lib/bcc" ] || echo >> tmp.sed "s:%LIBDIR%:/lib/bcc:"

View File

@ -0,0 +1,29 @@
Build ifdef using BUILD_CC, not CC.
Upstream-Status: Pending
Signed-off-by: Ross Burton <ross.burton@arm.com>
diff --git a/Makefile b/Makefile
index 8a61b65..99f41de 100644
--- a/Makefile
+++ b/Makefile
@@ -22,6 +22,10 @@ CFLAGS= -O
IFDEFNAME= ifdef
WD=$(shell pwd)
+BUILD_CC ?= $(CC)
+BUILD_CFLAGS ?= $(CFLAGS)
+BUILD_LDFLAGS ?= $(LDFLAGS)
+
# Some makes take the last of a list as the default ...
all: make.fil
PATH="`pwd`/bin:$$PATH" $(MAKE) -f make.fil VERSION=$(VERSION) TOPDIR=`pwd` $@
@@ -65,7 +69,7 @@ make.fil: $(IFDEFNAME) makefile.in
@rm -f tmp.mak tmp.sed
$(IFDEFNAME): ifdef.c
- $(CC) $(IFDEFARCH) $(CFLAGS) $(IFDEFFLAGS) $(LDFLAGS) -o $(IFDEFNAME) ifdef.c
+ $(BUILD_CC) $(IFDEFARCH) $(BUILD_CFLAGS) $(IFDEFFLAGS) $(BUILD_LDFLAGS) -o $(IFDEFNAME) ifdef.c
uninstall:
@echo 'Sorry, no go; it was just wrong.'

View File

@ -11,16 +11,14 @@ SRC_URI = "git://github.com/jbruchon/${BPN}.git;protocol=https \
file://0001-cpp-Makefile-respect-LDFLAGS-when-building-bcc-cpp.patch \
file://0003-cpp-update-token1.tok-to-make-new-gperf-happy-regen..patch \
file://0004-regen-token2.h-token1.h-with-gperf-3.1.patch \
"
SRC_URI_append_class-target = " \
file://0002-Makefile-use-ifdefg-from-dev86-native-instead-of-tar.patch \
file://cross.patch \
"
S = "${WORKDIR}/git"
DEPENDS = "gperf-native dev86-native"
DEPENDS = "gperf-native"
BBCLASSEXTEND = "native"
BBCLASSEXTEND = "native nativesdk"
EXTRA_OEMAKE = "VERSION=${BASE_PV} PREFIX=${prefix} DIST=${D} LDFLAGS='${LDFLAGS}' INEXE=''"
do_compile() {
@ -41,8 +39,4 @@ do_install() {
ln -s ../lib/bcc/bcc-cc1 ${D}${prefix}/bin/bcc-cc1
}
do_install_append_class-native() {
install -v -m 755 ${B}/ifdefg ${D}${bindir}
}
FILES_${PN} += "${libdir}/bcc"