1From 08441cf4334b911dba8c493dca3b1e2166c7d322 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:34:34 +0100
4Subject: [PATCH 10/15] patching simg2img.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/simg2img.mk | 11 ++++++-----
24 1 file changed, 6 insertions(+), 5 deletions(-)
25
26diff --git a/debian/simg2img.mk b/debian/simg2img.mk
27index 07fb56b4..d319c87e 100644
28--- a/debian/simg2img.mk
29+++ b/debian/simg2img.mk
30@@ -1,13 +1,15 @@
31+include ../../rules_yocto.mk
32 NAME = simg2img
33 SOURCES = simg2img.cpp sparse_crc32.cpp
34 SOURCES := $(foreach source, $(SOURCES), libsparse/$(source))
35 CPPFLAGS += -Ilibsparse/include -Iinclude -std=gnu++17
36-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
37-           -Wl,-rpath-link=. \
38-           -L. -lsparse
39+LDFLAGS += -Wl,-rpath=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40+           -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android \
41+           -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -lsparse
42
43 build: $(SOURCES)
44-	$(CXX) $^ -o libsparse/$(NAME) $(CPPFLAGS) $(LDFLAGS)
45+	mkdir --parents $(OUT_DIR)/usr/bin
46+	$(CXX) $^ -o $(OUT_DIR)/usr/bin/$(NAME) $(CPPFLAGS) $(LDFLAGS)
47
48 clean:
49-	$(RM) libsparse/$(NAME)
50+	$(RM) $(OUT_DIR)/usr/bin/$(NAME)
51--
522.36.1.vfs.0.0
53
54