File: rules

package info (click to toggle)
android-platform-frameworks-base 1%3A14~beta1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 326,096 kB
  • sloc: java: 2,032,373; xml: 343,016; cpp: 304,183; python: 3,683; ansic: 2,090; sh: 1,871; makefile: 120; sed: 19
file content (150 lines) | stat: -rwxr-xr-x 5,953 bytes parent folder | download
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
#!/usr/bin/make -f

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

export CC = clang
export CXX = clang++

# https://android.googlesource.com/platform/development/+/refs/tags/android-u-beta-1-gpl/sdk/build_tools_source.prop_template
export ANDROID_BUILD_TOOLS_VERSION = 33.0.0
export DEB_HOST_MULTIARCH

VERSION_UPSTREAM=$(DEB_VERSION_UPSTREAM)
## Only need below if we need to pull an unofficial release version, e.g. from a devel branch
#VERSION_UPSTREAM=u-beta-1-gpl

## Security Hardening
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto
# https://android.googlesource.com/platform/build/soong/+/refs/tags/android-u-beta-1-gpl/cc/config/global.go#307
export DEB_CFLAGS_MAINT_APPEND = -fPIC -std=gnu17 -gdwarf-4
export DEB_CXXFLAGS_MAINT_APPEND = -fPIC -std=gnu++2a -gdwarf-4
export DEB_LDFLAGS_MAINT_APPEND = -fPIC
export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG -UDEBUG \
  -I/usr/include/android \
  -Wno-c99-designator \
  -Wno-gnu-designator \
  -Wno-gnu-folding-constant \
  -fmessage-length=0 \
  -fno-exceptions \
  -fno-strict-aliasing \
  -no-canonical-prefixes \

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

ifeq ($(IMPORT_VER),)
	GBP_IMPORT = --uscan
else ifneq ("$(wildcard ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz)","")
	GBP_IMPORT = ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar.xz
else
	GBP_IMPORT =
endif

debian/out/aapt2-protobuf.a: debian/aapt2-protobuf.mk
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/aapt: debian/aapt.mk debian/out/libaapt.so
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/aapt2: debian/aapt2.mk debian/out/libaapt2.so
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/lib%.so: debian/lib%.mk debian/out/libandroidfw.so
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/libandroidfw.so: debian/libandroidfw.mk debian/out/aapt2-protobuf.a
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/split-select: debian/split-select.mk debian/out/libandroidfw.so debian/out/libaapt.so
	dh_auto_build --buildsystem=makefile -- -f $<

debian/out/%_test: debian/%_test.mk debian/out/libaapt2.so
	dh_auto_build --buildsystem=makefile -- --file=$<

%:
	dh $@ --with bash-completion

override_dh_auto_configure:
	rm -f tools/aapt2/integration-tests/ConvertTest/duplicate_entries.apk
	dh_auto_configure

override_dh_auto_build-arch: debian/out/aapt debian/out/aapt2 debian/out/split-select
	pandoc -s -o debian/out/split-select.1 debian/split-select.1.md

override_dh_auto_build-indep: debian/out/aapt2
	LD_LIBRARY_PATH=debian/out \
	debian/out/aapt2 compile --dir core/res/res \
				-o debian/out/resources.zip
	LD_LIBRARY_PATH=debian/out \
	debian/out/aapt2 link --manifest core/res/AndroidManifest.xml \
				debian/out/resources.zip \
				-o debian/out/framework-res.apk \
				-A core/res/assets \
				--min-sdk-version 33 --target-sdk-version 33 \
				--product default \
				--version-code 33 --version-name 13.0.0

# Build-Depends (for dh_auto_test): wget
# If there's no wget, some tests in aapt2_test will be skipped
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
# Skip building aapt2_test for mipsel and mips64el, due to ftbfs: tools/aapt2/filter/AbiFilter_test.cpp:58:8: error: expected unqualified-id
ifeq ($(filter mipsel mips64el,$(DEB_HOST_ARCH)),)
override_dh_auto_test-arch: debian/out/aapt2_test
	LD_LIBRARY_PATH=debian/out debian/out/aapt version
	LD_LIBRARY_PATH=debian/out debian/out/aapt2 version
ifneq (, $(shell which wget))
	for dir in ConvertTest CommandTests CompileTest; do \
		(mkdir -p debian/out/integration-tests/$$dir; cd debian/out/integration-tests/$$dir; \
		wget -qO ../$${dir}.tgz \
			https://android.googlesource.com/platform/frameworks/base/+archive/refs/tags/android-$(subst +,_,$(VERSION_UPSTREAM))/tools/aapt2/integration-tests/$${dir}.tar.gz && \
		tar xfz ../$${dir}.tgz && rm ../$${dir}.tgz); \
	done
endif
	LD_LIBRARY_PATH=debian/out debian/out/aapt2_test
endif
endif

# Depends: git-buildpackage
get-orig-source:
ifneq ($(GBP_IMPORT),--uscan)
ifeq ("$(wildcard ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar.xz)","")
	mkdir -p $(DEB_SOURCE)_$(IMPORT_VER)
	tar xfz ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz -C $(DEB_SOURCE)_$(IMPORT_VER)
	(cd $(DEB_SOURCE)_$(IMPORT_VER); tar cf ../../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar --exclude-from ../debian/orig.excludes .)
	rm -r $(DEB_SOURCE)_$(IMPORT_VER)
	mkdir -p $(DEB_SOURCE)_$(IMPORT_VER)
	tar xf ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar -C $(DEB_SOURCE)_$(IMPORT_VER)
	find $(DEB_SOURCE)_$(IMPORT_VER) -type d -empty -delete
	rm ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar
	(cd $(DEB_SOURCE)_$(IMPORT_VER); tar cf ../../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar --mtime=20100517 .)
	xz -9 < ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar > $(GBP_IMPORT)
	rm -r $(DEB_SOURCE)_$(IMPORT_VER) ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar
endif
endif
	gbp import-orig $(GBP_IMPORT) \
		--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\""
check-upstream:
	$(eval count = $$(shell git show upstream|wc -l))
	@test $(count) -gt 10 || ( \
		git reset --hard HEAD^^; \
		git tag -d upstream/$(shell echo $(DEB_VERSION_UPSTREAM)|sed "s/~/_/g;s/:/%/g"); \
		git checkout upstream; git reset --hard HEAD^; git checkout $(shell git symbolic-ref --short HEAD); \
		echo; \
		echo error: Line count of upstream/$(DEB_VERSION_UPSTREAM): $(count); \
		echo Upstream changes does not deserve an update.;\
		echo; \
		exit 1; \
	)
ifeq ($(GBP_IMPORT),)
update:
	@echo Cannot find orig to import: ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz
else
update: get-orig-source check-upstream
	@echo Package updated to upstream version: $(shell dpkg-parsechangelog -SVersion|sed 's/-[^-]*$$//'|sed 's/^[0-9]*://')
endif