1From e826f68c68e05b0f5cc3b3c10d7d9e4deb135114 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:14:15 +0100
4Subject: [PATCH 04/15] patching fastboot.mk to build in yocto environment.
5
6Changes include:
7Introduced an output folder which will keep all the outputs from the
8android-tools.
9
10Adding an include file that is setting the common flags.
11Changed the cppflag to include the headers from other components
12of android-tools
13
14Modified LDflags so that the libraries that are coming from other android-tools
15are searched in the output folder.
16
17Modified the build rule so that it outputs the binary to the OUT_DIR
18
19Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
20
21Upstream-Status: Pending
22---
23 debian/fastboot.mk | 12 +++++++-----
24 1 file changed, 7 insertions(+), 5 deletions(-)
25
26diff --git a/debian/fastboot.mk b/debian/fastboot.mk
27index d1aba626..e75fa87c 100644
28--- a/debian/fastboot.mk
29+++ b/debian/fastboot.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = fastboot
33 fastboot_SOURCES = \
34           bootimg_utils.cpp \
35@@ -38,11 +39,11 @@ CPPFLAGS += \
36             -Ifs_mgr/liblp/include \
37             -I/usr/include/android/openssl \
38             -Ilibsparse/include \
39-            -Ilibziparchive/include
40+            -Ilibziparchive/include -I$(OUT_DIR)/usr/include/
41 LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
42            -fuse-ld=gold \
43-           -Wl,-rpath-link=. \
44-           -L. -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \
45+           -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
46+           -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lziparchive -lsparse -lbase -lcutils -ladb -lcrypto -lext4_utils \
47            -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
48            -l7z \
49
50@@ -53,7 +54,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
51 endif
52
53 build: $(SOURCES)
54-	$(CXX) $^ -o fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
55+	mkdir --parents $(OUT_DIR)/usr/bin/fastboot
56+	$(CXX) $^ -o $(OUT_DIR)/usr/bin/fastboot/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
57
58 clean:
59-	$(RM) fastboot/$(NAME)
60+	$(RM) $(OUT_DIR)/usr/bin/fastboot/$(NAME)
61--
622.36.1.vfs.0.0
63
64