File: rules

package info (click to toggle)
apktool 2.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 8,496 kB
  • sloc: java: 11,932; xml: 372; sh: 201; makefile: 31
file content (41 lines) | stat: -rwxr-xr-x 1,578 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
#!/usr/bin/make -f
PKD   = $(abspath $(dir $(MAKEFILE_LIST)))
PKG   = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
UVER  = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(?:\d+:)?(\d.*)(?:\-\d+.*)};')

export JAVA_HOME=/usr/lib/jvm/default-java

%:
	dh $@ --buildsystem=gradle

override_dh_auto_build:
	dh_auto_build -- -Dfile.encoding=UTF-8 assemble

override_dh_missing:
	dh_missing --fail-missing

## http://wiki.debian.org/onlyjob/get-orig-source
.PHONY: get-orig-source
get-orig-source: $(PKG)_$(UVER).orig.tar.xz $(info I: $(PKG)_$(UVER))
	@

$(PKG)_$(UVER).orig.tar.xz:
	@echo "# Downloading..."
	uscan --noconf --verbose --rename --destdir=$(CURDIR) check-dirname-level=0 --force-download --download-version $(UVER) $(PKD)
	$(if $(wildcard $(PKG)-$(UVER)),$(error $(PKG)-$(UVER) exist, aborting..))
	@echo "# Extracting..."
	mkdir $(PKG)-$(UVER) \
	&& tar -xf $(PKG)_$(UVER).orig.tar.* --directory $(PKG)-$(UVER) --strip-components 1 \
	|| $(RM) -r $(PKG)-$(UVER)
	@echo "# Cleaning-up..."
	cd $(PKG)-$(UVER) \
	&& find . -depth -name '*.jar' -exec $(RM) -r {} \; -printf 'removed %p\n' \
	&& $(RM) -r -v \
		brut.apktool/apktool-lib/src/main/resources/prebuilt \
		brut.apktool/apktool-lib/src/test/resources/aapt1/testapp/res/drawable-ldpi/data.jpg
	#$(RM) -v $(PKG)_$(VER).orig.tar.*
	@echo "# Packing..."
	find -L "$(PKG)-$(UVER)" -xdev -type f -print | LC_ALL=C sort \
	| XZ_OPT="-6v" tar -caf "$(PKG)_$(UVER).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
	&& $(RM) -r "$(PKG)-$(UVER)"