File: rules

package info (click to toggle)
android-platform-tools 34.0.5-12
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 150,900 kB
  • sloc: cpp: 805,786; java: 293,500; ansic: 128,288; xml: 127,491; python: 41,481; sh: 14,245; javascript: 9,665; cs: 3,846; asm: 2,049; makefile: 1,917; yacc: 440; awk: 368; ruby: 183; sql: 140; perl: 88; lex: 67
file content (243 lines) | stat: -rwxr-xr-x 8,479 bytes parent folder | download | duplicates (2)
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk
include /usr/share/dpkg/pkg-info.mk

## Security Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# https://android.googlesource.com/platform/build/soong/+/refs/tags/platform-tools-34.0.5/cc/config/global.go#356
export DEB_CFLAGS_MAINT_APPEND = -fPIC -std=gnu17
export DEB_CXXFLAGS_MAINT_APPEND = -fPIC -std=gnu++2a
export DEB_LDFLAGS_MAINT_APPEND = -fPIC
export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG -UDEBUG \
  -fmessage-length=0 \
  -fno-exceptions \
  -fno-strict-aliasing \
  -no-canonical-prefixes \

## For get-orig-source
export DEB_SOURCE

## system
export DEB_HOST_MULTIARCH
export DEB_VERSION
# https://android.googlesource.com/platform/development/+/refs/tags/platform-tools-34.0.5/sdk/plat_tools_source.prop_template
export PLATFORM_TOOLS_VERSION = 34.0.5

ifneq (, $(shell which clang))
  export CC = clang
  export CXX = clang++
  export DEB_CFLAGS_MAINT_APPEND += -gdwarf-4
  export DEB_CXXFLAGS_MAINT_APPEND += -gdwarf-4
  export DEB_CPPFLAGS_MAINT_APPEND += \
    -Wno-c99-designator \
    -Wno-gnu-designator \
    -Wno-gnu-folding-constant \

endif
ifneq (, $(shell which lld))
  export DEB_LDFLAGS_MAINT_APPEND += -fuse-ld=lld -Wl,--build-id=sha1
endif

%:
	dh $@ --with bash-completion

# Depends: git-buildpackage repo ssh
get-orig-source:
	debian/scripts/get-orig-source

ifeq ("$(wildcard ../$(DEB_SOURCE)_$(PLATFORM_TOOLS_VERSION).orig.tar.xz)","")
update: get-orig-source
else
update:
endif
	gbp import-orig ../$(DEB_SOURCE)_$(PLATFORM_TOOLS_VERSION).orig.tar.xz \
		--no-interactive --debian-branch=$(shell git symbolic-ref --short HEAD) \
		--postimport="\
		dch -b -v\$$GBP_DEBIAN_VERSION \"New upstream release \$$GBP_UPSTREAM_VERSION\"; \
		git add debian/changelog; \
		git commit -m\"dch: Note new upstream version \$$GBP_UPSTREAM_VERSION\""

## system

s/lib%.a: debian/system/lib%.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

s/lib%.so: debian/system/lib%.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

debian/manpages/system/%.1: debian/manpages/system/%.1.md
ifneq (, $(shell which pandoc))
	pandoc --standalone --from=markdown-smart --to=man --output=$@ $<
else
	ronn -r $<
endif

s/libbacktrace.so: debian/system/libbacktrace.mk s/libcutils.so e/libcpu_features.so
	dh_auto_build --buildsystem=makefile -- --file=$<

s/libbase.so: debian/system/libbase.mk s/liblog.so
	dh_auto_build --buildsystem=makefile -- --file=$<

s/libcutils.so: debian/system/libcutils.mk s/libbase.so
	dh_auto_build --buildsystem=makefile -- --file=$<

s/adb: debian/system/adb.mk s/libziparchive.so s/libadb.a s/libcrypto_utils.a s/libcutils.so debian/manpages/system/adb.1
	dh_auto_build --buildsystem=makefile -- --file=$<

s/adbd: debian/system/adbd.mk s/libadb.a s/libcrypto_utils.a s/libcutils.so
	dh_auto_build --buildsystem=makefile -- --file=$<

s/fastboot: debian/system/fastboot.mk s/adb s/extras/libext4_utils.a s/libsparse.so debian/manpages/system/fastboot.1
	dh_auto_build --buildsystem=makefile -- --file=$<

s/simg2img: debian/system/simg2img.mk s/libbase.so s/libsparse.so
	dh_auto_build --buildsystem=makefile -- --file=$<

s/simg2simg: debian/system/simg2simg.mk s/simg2img
	dh_auto_build --buildsystem=makefile -- --file=$<

s/img2simg: debian/system/img2simg.mk s/simg2img
	dh_auto_build --buildsystem=makefile -- --file=$<

s/append2simg: debian/system/append2simg.mk s/simg2img
	dh_auto_build --buildsystem=makefile -- --file=$<

COMPONENTS = \
  e/libcpu_features.so \
  s/append2simg \
  s/img2simg \
  s/libbacktrace.so \
  s/libbase.so \
  s/libcutils.so \
  s/liblog.so \
  s/libsparse.so \
  s/libutils.so \
  s/libziparchive.so \
  s/simg2img \
  s/simg2simg \

# Whatever depends on BoringSSL must be disabled on MIPS
NON_MIPS_COMPONENTS = s/adb s/adbd s/fastboot
ifneq ($(filter amd64 i386 armel armhf arm64 loong64 mipsel mips64el ppc64el riscv64,$(DEB_HOST_ARCH)),)
  COMPONENTS += $(NON_MIPS_COMPONENTS)
endif

# Most components only support ARM, x86 and MIPS, but some can be built
# on all architectures.
COMPONENTS_ANY_ARCH = \
  s/append2simg \
  s/img2simg \
  s/libbase.so \
  s/libcutils.so \
  s/liblog.so \
  s/libsparse.so \
  s/libziparchive.so \
  s/simg2img \
  s/simg2simg \

ifeq ($(filter amd64 i386 armel armhf arm64 loong64 mipsel mips64el ppc64el riscv64,$(DEB_HOST_ARCH)),)
  COMPONENTS := $(filter $(COMPONENTS_ANY_ARCH), $(COMPONENTS))
endif

## development

debian/manpages/development/%.1: debian/manpages/development/%.1.md
ifneq (, $(shell which pandoc))
	pandoc --standalone --from=markdown-smart --to=man --output=$@ $<
else
	ronn -r $<
endif

development/etc1tool: debian/development/etc1tool.mk debian/manpages/development/etc1tool.1 f/native/libETC1.a
	dh_auto_build --buildsystem=makefile -- --file=$<

COMPONENTS += development/etc1tool

## frameworks/native

f/native/libETC1.a: debian/frameworks/native/libETC1.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

COMPONENTS += f/native/libETC1.a

## system/extras

s/extras/libext4_utils.a: debian/system/extras/libext4_utils.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

## libnativehelper

libnativehelper/libnativehelper.so: debian/libnativehelper/libnativehelper.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

COMPONENTS += libnativehelper/libnativehelper.so

## dalvik

dalvik/hprof-conv: debian/dalvik/hprof-conv.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

COMPONENTS += dalvik/hprof-conv

## external

e/lib%.so: debian/external/lib%.mk
	dh_auto_build --buildsystem=makefile -- --file=$<

override_dh_auto_build-arch: $(COMPONENTS)

ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
override_dh_auto_test-arch:
	debian/out/development/etc1tool development/tools/templates/ic_launcher_ldpi.png --encode && debian/out/development/etc1tool development/tools/templates/ic_launcher_ldpi.pkm --decode
ifneq ($(filter amd64 i386 armel armhf arm64 loong64 mipsel mips64el ppc64el riscv64,$(DEB_HOST_ARCH)),)
	LD_LIBRARY_PATH=debian/out/system debian/out/system/adb version
	LD_LIBRARY_PATH=debian/out/system debian/out/system/adb help
	LD_LIBRARY_PATH=debian/out/system debian/out/system/adb keygen key.txt && ls -l key.txt* && rm key.txt*
	LD_LIBRARY_PATH=debian/out/system debian/out/system/adbd --version
	LD_LIBRARY_PATH=debian/out/system debian/out/system/fastboot --version
	LD_LIBRARY_PATH=debian/out/system debian/out/system/fastboot devices
endif
endif

override_dh_auto_install:
	echo ignore upstream build system install procedure

override_dh_auto_configure-arch:
	rm -rf development/[a-s]* development/v* development/testrunner \
		external/lzma/{Asm,CPP,CS,DOC,Java} external/lzma/C/*.c external/lzma/C/Util
	mkdir -p debian/out/dalvik/tools debian/out/development debian/out/external \
		debian/out/frameworks/native debian/out/system/extras debian/out/libnativehelper
ifneq ($(filter amd64 i386 armel armhf arm64 loong64 mipsel mips64el ppc64el riscv64,$(DEB_HOST_ARCH)),)
	for proto in packages/modules/adb/fastdeploy/proto packages/modules/adb/proto; do \
		(cd $$proto && \
			find . -name '*.proto' -printf 'Regenerate %p\n' \
			-exec protoc --cpp_out=. {} \;) \
	done
endif

override_dh_gencontrol:
	dh_gencontrol
	dh_gencontrol -padb -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libbacktrace -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libbacktrace-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libbase -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libbase-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libcutils -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libcutils-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-liblog -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-liblog-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libsparse -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libsparse-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libutils -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libutils-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libziparchive -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-libziparchive-dev -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-platform-frameworks-native-headers -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-platform-system-core-headers -- -v1:$(DEB_VERSION)
	dh_gencontrol -pandroid-sdk-libsparse-utils -- -v1:$(DEB_VERSION)
	dh_gencontrol -pfastboot -- -v1:$(DEB_VERSION)
	dh_gencontrol -pmkbootimg -- -v1:$(DEB_VERSION)

override_dh_installsystemd:
	dh_installsystemd --no-stop-on-upgrade --no-restart-after-upgrade