| 1 |
|
| 2 |
|
| 3 |
include /usr/share/dpkg/architecture.mk |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
|
| 6 |
export CC = clang |
| 7 |
export CXX = clang++ |
| 8 |
|
| 9 |
|
| 10 |
export ANDROID_BUILD_TOOLS_VERSION = 33.0.0 |
| 11 |
export DEB_HOST_MULTIARCH |
| 12 |
|
| 13 |
VERSION_UPSTREAM=$(DEB_VERSION_UPSTREAM) |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+all optimize=-lto |
| 19 |
|
| 20 |
export DEB_CFLAGS_MAINT_APPEND = -fPIC -std=gnu17 -gdwarf-4 |
| 21 |
export DEB_CXXFLAGS_MAINT_APPEND = -fPIC -std=gnu++2a -gdwarf-4 |
| 22 |
export DEB_LDFLAGS_MAINT_APPEND = -fPIC |
| 23 |
export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG -UDEBUG \ |
| 24 |
-I/usr/include/android \ |
| 25 |
-Wno-c99-designator \ |
| 26 |
-Wno-gnu-designator \ |
| 27 |
-Wno-gnu-folding-constant \ |
| 28 |
-fmessage-length=0 \ |
| 29 |
-fno-exceptions \ |
| 30 |
-fno-strict-aliasing \ |
| 31 |
-no-canonical-prefixes \ |
| 32 |
|
| 33 |
ifneq (, $(shell which lld)) |
| 34 |
export DEB_LDFLAGS_MAINT_APPEND += -fuse-ld=lld -Wl,--build-id=sha1 |
| 35 |
endif |
| 36 |
|
| 37 |
ifeq ($(IMPORT_VER),) |
| 38 |
GBP_IMPORT = --uscan |
| 39 |
else ifneq ("$(wildcard ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz)","") |
| 40 |
GBP_IMPORT = ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar.xz |
| 41 |
else |
| 42 |
GBP_IMPORT = |
| 43 |
endif |
| 44 |
|
| 45 |
debian/out/aapt2-protobuf.a: debian/aapt2-protobuf.mk |
| 46 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 47 |
|
| 48 |
debian/out/aapt: debian/aapt.mk debian/out/libaapt.so |
| 49 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 50 |
|
| 51 |
debian/out/aapt2: debian/aapt2.mk debian/out/libaapt2.so |
| 52 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 53 |
|
| 54 |
debian/out/lib%.so: debian/lib%.mk debian/out/libandroidfw.so |
| 55 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 56 |
|
| 57 |
debian/out/libandroidfw.so: debian/libandroidfw.mk debian/out/aapt2-protobuf.a |
| 58 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 59 |
|
| 60 |
debian/out/split-select: debian/split-select.mk debian/out/libandroidfw.so debian/out/libaapt.so |
| 61 |
dh_auto_build --buildsystem=makefile -- -f $< |
| 62 |
|
| 63 |
debian/out/%_test: debian/%_test.mk debian/out/libaapt2.so |
| 64 |
dh_auto_build --buildsystem=makefile -- --file=$< |
| 65 |
|
| 66 |
%: |
| 67 |
dh $@ --with bash-completion |
| 68 |
|
| 69 |
override_dh_auto_configure: |
| 70 |
rm -f tools/aapt2/integration-tests/ConvertTest/duplicate_entries.apk |
| 71 |
dh_auto_configure |
| 72 |
|
| 73 |
override_dh_auto_build-arch: debian/out/aapt debian/out/aapt2 debian/out/split-select |
| 74 |
pandoc -s -o debian/out/split-select.1 debian/split-select.1.md |
| 75 |
|
| 76 |
override_dh_auto_build-indep: debian/out/aapt2 |
| 77 |
LD_LIBRARY_PATH=debian/out \ |
| 78 |
debian/out/aapt2 compile --dir core/res/res \ |
| 79 |
-o debian/out/resources.zip |
| 80 |
LD_LIBRARY_PATH=debian/out \ |
| 81 |
debian/out/aapt2 link --manifest core/res/AndroidManifest.xml \ |
| 82 |
debian/out/resources.zip \ |
| 83 |
-o debian/out/framework-res.apk \ |
| 84 |
-A core/res/assets \ |
| 85 |
--min-sdk-version 33 --target-sdk-version 33 \ |
| 86 |
--product default \ |
| 87 |
--version-code 33 --version-name 13.0.0 |
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) |
| 92 |
|
| 93 |
ifeq ($(filter mipsel mips64el,$(DEB_HOST_ARCH)),) |
| 94 |
override_dh_auto_test-arch: debian/out/aapt2_test |
| 95 |
LD_LIBRARY_PATH=debian/out debian/out/aapt version |
| 96 |
LD_LIBRARY_PATH=debian/out debian/out/aapt2 version |
| 97 |
ifneq (, $(shell which wget)) |
| 98 |
for dir in ConvertTest CommandTests CompileTest; do \ |
| 99 |
(mkdir -p debian/out/integration-tests/$$dir; cd debian/out/integration-tests/$$dir; \ |
| 100 |
wget -qO ../$${dir}.tgz \ |
| 101 |
https://android.googlesource.com/platform/frameworks/base/+archive/refs/tags/android-$(subst +,_,$(VERSION_UPSTREAM))/tools/aapt2/integration-tests/$${dir}.tar.gz && \ |
| 102 |
tar xfz ../$${dir}.tgz && rm ../$${dir}.tgz); \ |
| 103 |
done |
| 104 |
endif |
| 105 |
LD_LIBRARY_PATH=debian/out debian/out/aapt2_test |
| 106 |
endif |
| 107 |
endif |
| 108 |
|
| 109 |
|
| 110 |
get-orig-source: |
| 111 |
ifneq ($(GBP_IMPORT),--uscan) |
| 112 |
ifeq ("$(wildcard ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar.xz)","") |
| 113 |
mkdir -p $(DEB_SOURCE)_$(IMPORT_VER) |
| 114 |
tar xfz ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz -C $(DEB_SOURCE)_$(IMPORT_VER) |
| 115 |
(cd $(DEB_SOURCE)_$(IMPORT_VER); tar cf ../../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar --exclude-from ../debian/orig.excludes .) |
| 116 |
rm -r $(DEB_SOURCE)_$(IMPORT_VER) |
| 117 |
mkdir -p $(DEB_SOURCE)_$(IMPORT_VER) |
| 118 |
tar xf ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar -C $(DEB_SOURCE)_$(IMPORT_VER) |
| 119 |
find $(DEB_SOURCE)_$(IMPORT_VER) -type d -empty -delete |
| 120 |
rm ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar |
| 121 |
(cd $(DEB_SOURCE)_$(IMPORT_VER); tar cf ../../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar --mtime=20100517 .) |
| 122 |
xz -9 < ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar > $(GBP_IMPORT) |
| 123 |
rm -r $(DEB_SOURCE)_$(IMPORT_VER) ../$(DEB_SOURCE)_$(IMPORT_VER).orig.tar |
| 124 |
endif |
| 125 |
endif |
| 126 |
gbp import-orig $(GBP_IMPORT) \ |
| 127 |
--no-interactive --debian-branch=$(shell git symbolic-ref --short HEAD) \ |
| 128 |
--postimport="\ |
| 129 |
dch -b -v\$$GBP_DEBIAN_VERSION \"New upstream release \$$GBP_UPSTREAM_VERSION\"; \ |
| 130 |
git add debian/changelog; \ |
| 131 |
git commit -m\"dch: Note new upstream version \$$GBP_UPSTREAM_VERSION\"" |
| 132 |
check-upstream: |
| 133 |
$(eval count = $$(shell git show upstream|wc -l)) |
| 134 |
@test $(count) -gt 10 || ( \ |
| 135 |
git reset --hard HEAD^^; \ |
| 136 |
git tag -d upstream/$(shell echo $(DEB_VERSION_UPSTREAM)|sed "s/~/_/g;s/:/%/g"); \ |
| 137 |
git checkout upstream; git reset --hard HEAD^; git checkout $(shell git symbolic-ref --short HEAD); \ |
| 138 |
echo; \ |
| 139 |
echo error: Line count of upstream/$(DEB_VERSION_UPSTREAM): $(count); \ |
| 140 |
echo Upstream changes does not deserve an update.;\ |
| 141 |
echo; \ |
| 142 |
exit 1; \ |
| 143 |
) |
| 144 |
ifeq ($(GBP_IMPORT),) |
| 145 |
update: |
| 146 |
@echo Cannot find orig to import: ../$(DEB_SOURCE)_$(IMPORT_VER).tar.gz |
| 147 |
else |
| 148 |
update: get-orig-source check-upstream |
| 149 |
@echo Package updated to upstream version: $(shell dpkg-parsechangelog -SVersion|sed 's/-[^-]*$$//'|sed 's/^[0-9]*://') |
| 150 |
endif |