File: rules

package info (click to toggle)
google-android-installers 1743526702-1
  • links: PTS, VCS
  • area: non-free
  • in suites: trixie
  • size: 1,184 kB
  • sloc: xml: 9,711; sh: 1,753; makefile: 266
file content (132 lines) | stat: -rwxr-xr-x 7,468 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
#!/usr/bin/make -f

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

# Since we use regex tests with =~, we need bash
SHELL := /bin/bash

DH_VERBOSE=1

PLATFORMS_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh PLATFORMS_VERSIONS_TO_PACKAGE)
BUILD_TOOLS_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh BUILD_TOOLS_VERSIONS_TO_PACKAGE)
PATCHER_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh PATCHER_VERSIONS_TO_PACKAGE)
CMDLINE_TOOLS_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh CMDLINE_TOOLS_VERSIONS_TO_PACKAGE)
PLATFORM_TOOLS_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh PLATFORM_TOOLS_VERSIONS_TO_PACKAGE)
NDK_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh NDK_VERSIONS_TO_PACKAGE)
SOURCES_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh SOURCES_VERSIONS_TO_PACKAGE)
EMULATOR_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh EMULATOR_VERSIONS_TO_PACKAGE)
EXTRAS_GOOGLE_AUTO_VERSIONS_TO_PACKAGE=$(shell debian/scripts/components_to_package.sh EXTRAS_GOOGLE_AUTO_VERSIONS_TO_PACKAGE)

WITH_ZIPS := $(shell if grep "XS-With-Zips: yes" debian/control.in > /dev/null; then echo yes; else echo no; fi)

%:
	dh $@ --with bash-completion

override_dh_clean:
	dh_clean

	@echo "Remove per package autogenerated files"
	@debian/scripts/run_dh_clean.sh

	@echo "Run debian/scripts/update_debian.sh"
	@debian/scripts/update_debian.sh

	debconf-updatepo

ifneq ($(WITH_ZIPS),yes)
	rm -fr zips/
endif

execute_after_dh_prep:
	@echo "Generating files for components"
	debian/scripts/run_after_dh_prep.sh

execute_after_dh_installdirs:
	@debian/scripts/zip_file_install.sh

override_dh_gencontrol:
	debian/scripts/run_dh_gencontrol.sh "$(DEB_VERSION)"

execute_before_dh_installalternatives:
	# build-tools: create files used in $package.alternatives file so that dh_installalternatives can run
	@echo "Prepare dh_installalternatives for build-tools"
	@for version in ${BUILD_TOOLS_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  PATH_DIRNAME=$$(dirname $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  PATH_BASENAME=$$(basename $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  for file in $$(grep "Name:" debian/google-android-build-tools-$$VER-installer.alternatives | cut -d ' ' -f2); do \
	    mkdir -p debian/google-android-build-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME/$$PATH_BASENAME ;\
	    touch debian/google-android-build-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME/$$PATH_BASENAME/$$file ;\
	  done ;\
	done

	# cmdline-tools: create files used in $package.alternatives file so that dh_installalternatives can run
	@echo "Prepare dh_installalternatives for cmdline-tools"
	@for version in ${CMDLINE_TOOLS_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  PATH_DIRNAME=$$(dirname $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  PATH_BASENAME=$$(basename $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  for file in $$(grep "Name:" debian/google-android-cmdline-tools-$$VER-installer.alternatives | cut -d ' ' -f2); do \
	    mkdir -p debian/google-android-cmdline-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME/$$PATH_BASENAME/bin ;\
	    touch debian/google-android-cmdline-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME/$$PATH_BASENAME/bin/$$file ;\
	  done ;\
	done

	# ndk: create files used in $package.alternatives file so that dh_installalternatives can run
	@echo "Prepare dh_installalternatives for ndk"
	@for version in ${NDK_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  ver_major=$$(echo "$$VER" | cut -d . -f 1) ;\
	  ver_letter=$$(echo "$$VER" | cut -d . -f 2 | tr '1-9' 'b-z' | tr -d '0') ;\
	  VER="r$${ver_major}$${ver_letter}" ;\
	  PATH_DIRNAME=$$(dirname $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  PATH_BASENAME=$$(basename $$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | sed "s,;,/,g")) ;\
	  for file in $$(grep "Name:" debian/google-android-ndk-$$VER-installer.alternatives | cut -d ' ' -f2); do \
	    mkdir -p debian/google-android-ndk-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME ;\
	    touch debian/google-android-ndk-$$VER-installer/usr/lib/android-sdk/$$PATH_DIRNAME/$$PATH_BASENAME ;\
	  done ;\
	done

execute_after_dh_installalternatives:
	# build-tools: delete files created so that dh_installalternatives can run
	@echo "Cleanup preparation of dh_installalternatives for build-tools"
	@for version in ${BUILD_TOOLS_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  PATH_FIRSTDIR=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | cut -d ";" -f 1) ;\
	  rm -rf debian/google-android-build-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_FIRSTDIR ;\
	  rmdir -p --ignore-fail-on-non-empty debian/google-android-build-tools-$$VER-installer/usr/lib/android-sdk ;\
	done

	# cmdline-tools: delete files created so that dh_installalternatives can run
	@echo "Cleanup preparation of dh_installalternatives for cmdline-tools"
	@for version in ${CMDLINE_TOOLS_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  PATH_FIRSTDIR=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | cut -d ";" -f 1) ;\
	  rm -rf debian/google-android-cmdline-tools-$$VER-installer/usr/lib/android-sdk/$$PATH_FIRSTDIR ;\
	  rmdir -p --ignore-fail-on-non-empty debian/google-android-cmdline-tools-$$VER-installer/usr/lib/android-sdk ;\
	done

	# ndk: delete files created so that dh_installalternatives can run
	@echo "Cleanup preparation of dh_installalternatives for ndk"
	@for version in ${NDK_VERSIONS_TO_PACKAGE}; do \
	  version=$$(echo $$version | sed "s/,/;/g");\
	  VER=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f3) ;\
	  ver_major=$$(echo "$$VER" | cut -d . -f 1) ;\
	  ver_letter=$$(echo "$$VER" | cut -d . -f 2 | tr '1-9' 'b-z' | tr -d '0') ;\
	  VER="r$${ver_major}$${ver_letter}" ;\
	  PATH_FIRSTDIR=$$(grep --perl-regex "^$$version\t" debian/version_list.txt | cut -d "	" -f1 | cut -d ";" -f 1) ;\
	  rm -rf debian/google-android-ndk-$$VER-installer/usr/lib/android-sdk/$$PATH_FIRSTDIR ;\
	  rmdir -p --ignore-fail-on-non-empty debian/google-android-ndk-$$VER-installer/usr/lib/android-sdk ;\
	done

override_dh_builddeb:
	# On Ubuntu, by default, compression format is "zstd" while it is "xz" in Debian.
	# However dpkg in Debian supports unpacking zstd deb's only since 1.21.18 which
	# is only released since bookworm (debian 12). So that the deb can be used on older
	# Debian, especially when taken from Ubuntu, set the compression format to xz.
	dh_builddeb -- -Zxz