summaryrefslogtreecommitdiffstats
path: root/dynamic-layers/selinux/android-tools/android-tools/adb_mk_change_out_dir.patch
blob: 8c07e133ac703e29bf88bd5d3660a7569ee14ec2 (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
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 
--- git/system/core/debian/adb.mk	2021-04-29 21:11:00.617892503 +0200
+++ git/system/core/debian/adb.mk	2021-04-29 21:17:33.256016600 +0200
@@ -1,3 +1,4 @@
+include ../../rules_yocto.mk
 NAME = adb
 
 SOURCES = client/adb_client.cpp \
@@ -12,10 +13,10 @@
 
 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 @@
 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)