1From 65ddf7ea7daae721b2d331164155542820ed3e33 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:36:58 +0100
4Subject: [PATCH 12/15] patching libsparse.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/libsparse.mk | 9 +++++----
24 1 file changed, 5 insertions(+), 4 deletions(-)
25
26diff --git a/debian/libsparse.mk b/debian/libsparse.mk
27index de280def..64caa45f 100644
28--- a/debian/libsparse.mk
29+++ b/debian/libsparse.mk
30@@ -1,3 +1,4 @@
31+include ../../rules_yocto.mk
32 NAME = libsparse
33 SOURCES = \
34         backed_block.cpp \
35@@ -18,16 +19,16 @@ LDFLAGS += \
36   -shared -Wl,-soname,$(NAME).so.0 \
37   -lz \
38   -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
39-  -L. \
40+  -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41   -lbase
42
43
44 build: $(COBJECTS) $(CXXOBJECTS)
45-	$(CXX) $^ -o $(NAME).so.0 $(LDFLAGS)
46-	ln -s $(NAME).so.0 $(NAME).so
47+	$(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(LDFLAGS)
48+	ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
49
50 clean:
51-	$(RM) $(CXXOBJECTS) $(COBJECTS) $(NAME).so*
52+	$(RM) $(CXXOBJECTS) $(COBJECTS) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
53
54 $(COBJECTS): %.o: %.c
55 	$(CC) $< -o $@ $(CFLAGS) $(CPPFLAGS)
56--
572.36.1.vfs.0.0
58
59