1From e284ceac2b10133ca916bbae8055f040607b506c Mon Sep 17 00:00:00 2001
2From: Etienne Cordonnier <ecordonnier@snap.com>
3Date: Fri, 3 Mar 2023 13:21:49 +0100
4Subject: [PATCH 1/2] libext4_utils.mk: modifications to make it build in yocto
5 environment
6
7Adding an include file that is setting the common flags.
8Changed the cppflag to include the headers from other components
9of android-tools
10
11Modified LDflags so that the libraries that are coming from other android-tools
12are searched in the output folder.
13
14Modified the build rule so that it outputs the binary and header to the OUT_DIR
15
16Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>
17---
18 debian/libext4_utils.mk | 13 ++++++++-----
19 1 file changed, 8 insertions(+), 5 deletions(-)
20
21diff --git a/debian/libext4_utils.mk b/debian/libext4_utils.mk
22index 868e790..2e93158 100644
23--- a/debian/libext4_utils.mk
24+++ b/debian/libext4_utils.mk
25@@ -1,3 +1,4 @@
26+include ../../rules_yocto.mk
27 NAME = libext4_utils
28
29 ext4_utils_SOURCES := \
30@@ -17,14 +18,16 @@ CPPFLAGS += \
31             -Iext4_utils/include \
32             -Ilibfec/include \
33             -Isquashfs_utils \
34-            -I/usr/include/android \
35+            -I/usr/include/android -I$(OUT_DIR)/usr/include \
36             -D_GNU_SOURCE -DFEC_NO_KLOG -DSQUASHFS_NO_KLOG -D_LARGEFILE64_SOURCE
37 LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 \
38            -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android \
39-           -L/usr/lib/$(DEB_HOST_MULTIARCH)/android \
40+           -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
41            -lbase -lsparse -lselinux
42
43 build: $(SOURCES)
44-	mkdir --parents $(OUT_DIR)
45-	$(CC) $^ -o $(OUT_DIR)/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
46-	ln -s $(NAME).so.0 $(OUT_DIR)/$(NAME).so
47+	mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/
48+	$(CC) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so.0 $(CFLAGS) $(CPPFLAGS) $(LDFLAGS)
49+	ln -sf $(NAME).so.0 $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/$(NAME).so
50+	cp -r ext4_utils/include/* $(OUT_DIR)/usr/include/
51+
52--
532.36.1.vfs.0.0
54
55