summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/selinux/android-tools/android-tools/core/0001-patching-adb.mk-to-build-in-yocto-environment.patch
blob: d2ba5255709c1811288ab276370835729b54d7d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
From d133fc2c71fb6b0358af453b03bcb6d1874e902a Mon Sep 17 00:00:00 2001
From: Etienne Cordonnier <ecordonnier@snap.com>
Date: Fri, 3 Mar 2023 12:25:40 +0100
Subject: [PATCH 01/15] patching adb.mk to build in yocto environment.

Changes include:
Introduced an output folder which will keep all the outputs from the
android-tools.

Adding an include file that is setting the common flags.
Changed the cppflag to include the headers from other components
of android-tools

Modified LDflags so that the libraries that are coming from other android-tools
are searched in the output folder.

Modified the build rule so that it outputs the binary to the OUT_DIR

Signed-off-by: Nisha Parrakat <Nisha.Parrakat@kpit.com>

Upstream-Status: Pending
---
 debian/adb.mk | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/debian/adb.mk b/debian/adb.mk
index 8dbacf9a..97c9d6ca 100644
--- a/debian/adb.mk
+++ b/debian/adb.mk
@@ -1,3 +1,4 @@
+include ../../rules_yocto.mk
 NAME = adb
 
 SOURCES = client/adb_client.cpp \
@@ -12,10 +13,10 @@ SOURCES = client/adb_client.cpp \
 
 SOURCES := $(foreach source, $(SOURCES), adb/$(source))
 CXXFLAGS += -std=gnu++2a
-CPPFLAGS += -Iinclude -Iadb -Ibase/include \
+CPPFLAGS += -Iinclude -Iadb -Ibase/include  -I$(OUT_DIR)/usr/include/ \
             -DADB_VERSION='"$(DEB_VERSION)"' -DADB_HOST=1 -D_GNU_SOURCE
-LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=. \
-           -lpthread -L. -ladb -lbase
+LDFLAGS += -Wl,-rpath=/usr/lib/$(DEB_HOST_MULTIARCH)/android -Wl,-rpath-link=$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ \
+           -lpthread -L$(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/ -ladb -lbase
 
 # -latomic should be the last library specified
 # https://github.com/android/ndk/issues/589
@@ -24,7 +25,8 @@ ifneq ($(filter armel mipsel,$(DEB_HOST_ARCH)),)
 endif
 
 build: $(SOURCES)
-	$(CXX) $^ -o adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
+	mkdir --parents $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb
+	$(CXX) $^ -o $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS)
 
 clean:
-	$(RM) adb/$(NAME)
+	$(RM) $(OUT_DIR)/usr/lib/$(DEB_HOST_MULTIARCH)/android/adb/$(NAME)
-- 
2.36.1.vfs.0.0