1From ae2bf1925fe02ea040005df27842c77c6d02b051 Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:39:24 +0100
4Subject: [PATCH 13/15] patching libziparchive.mk to build in yocto
5 environment.
6
7Changes include:
8Introduced an output folder which will keep all the outputs from the
9android-tools.
10
11Adding an include file that is setting the common flags.
12Changed the cppflag to include the headers from other components
13of android-tools
14
15Modified LDflags so that the libraries that are coming from other android-tools
16are searched in the output folder.
17
18Modified the build rule so that it outputs the binary to the OUT_DIR
19
20Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
21
22Upstream-Status: Pending
23---
24 debian/libziparchive.mk | 12 +++++++-----
25 1 file changed, 7 insertions(+), 5 deletions(-)
26
27diff --git a/debian/libziparchive.mk b/debian/libziparchive.mk
28index 803ea58e..6a697059 100644
29--- a/debian/libziparchive.mk
30+++ b/debian/libziparchive.mk
31@@ -1,3 +1,4 @@
32+include ../../rules_yocto.mk
33 NAME = libziparchive
34 SOURCES = zip_archive.cc \
35           zip_archive_stream_entry.cc\
36@@ -5,14 +6,15 @@ SOURCES = zip_archive.cc \
37 SOURCES := $(foreach source, $(SOURCES), libziparchive/$(source))
38 CXXFLAGS += -std=gnu++17
39 CPPFLAGS += -DZLIB_CONST -D_FILE_OFFSET_BITS=64 \
40-            -Iinclude -Ibase/include -Ilibziparchive/include
41+            -Iinclude -Ibase/include -Ilibziparchive/include -I$(OUT_DIR)/usr/include/
42 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
43            -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
44-           -lz -L. -llog -lbase
45+           -lz -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android -llog -lbase
46
47 build: $(SOURCES)
48-	$(CXX) $^ -o $(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
49-	ln -s $(NAME).so.0 $(NAME).so
50+	$(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
51+	ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
52+	cp -r libziparchive/include/* $(OUT_DIR)/usr/include/
53
54 clean:
55-	$(RM) $(NAME).so*
56+	$(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so*
57--
582.36.1.vfs.0.0
59
60