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
|
#!/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 optimize=-lto
# https://android.googlesource.com/platform/build/soong/+/refs/tags/platform-tools-29.0.6/cc/config/global.go#121
export DEB_CFLAGS_MAINT_APPEND = -fPIC -gdwarf-4
export DEB_CXXFLAGS_MAINT_APPEND = -fPIC -gdwarf-4
export DEB_LDFLAGS_MAINT_APPEND = -fPIC
export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG -UDEBUG \
-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
## For get-orig-source
export DEB_SOURCE
export DEB_VERSION_UPSTREAM
## system/core
export DEB_HOST_MULTIARCH
export DEB_VERSION
# https://android.googlesource.com/platform/development/+/refs/tags/platform-tools-29.0.6/sdk/plat_tools_source.prop_template
export PLATFORM_TOOLS_VERSION = 29.0.6
ifneq (, $(shell which clang))
export CC=clang
export CXX=clang++
export DEB_CPPFLAGS_MAINT_APPEND += \
-Wno-c99-designator \
-Wno-gnu-designator \
-Wno-gnu-folding-constant \
endif
%:
dh $@ --with bash-completion
get-orig-source:
debian/scripts/get-orig-source
## system/core
s/core/lib%.a: debian/system/core/lib%.mk
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/lib%.so: debian/system/core/lib%.mk
dh_auto_build --buildsystem=makefile -- --file=$<
debian/manpages/system/core/%.1: debian/manpages/system/core/%.1.md
ifneq (, $(shell which pandoc))
pandoc --standalone --from=markdown-smart --to=man --output=$@ $<
else
ronn -r $<
endif
s/core/libbacktrace.so: debian/system/core/libbacktrace.mk s/core/libbase.so
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/libbase.so: debian/system/core/libbase.mk s/core/liblog.so
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/libcutils.so: debian/system/core/libcutils.mk s/core/libbase.so
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/adb: debian/system/core/adb.mk s/core/libadb.a s/core/libcrypto_utils.a s/core/libcutils.so debian/manpages/system/core/adb.1
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/fastboot: debian/system/core/fastboot.mk s/core/adb s/extras/libext4_utils.a s/core/libziparchive.so s/core/libsparse.so debian/manpages/system/core/fastboot.1
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/simg2img: debian/system/core/simg2img.mk s/core/libbase.so s/core/libsparse.so
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/simg2simg: debian/system/core/simg2simg.mk s/core/simg2img
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/img2simg: debian/system/core/img2simg.mk s/core/simg2img
dh_auto_build --buildsystem=makefile -- --file=$<
s/core/append2simg: debian/system/core/append2simg.mk s/core/simg2img
dh_auto_build --buildsystem=makefile -- --file=$<
COMPONENTS = \
s/core/libbacktrace.so \
s/core/libbase.so \
s/core/libcutils.so \
s/core/liblog.so \
s/core/libsparse.so \
s/core/libutils.so \
s/core/libziparchive.so \
s/core/simg2img \
s/core/img2simg \
s/core/append2simg \
s/core/simg2simg \
# Whatever depends on BoringSSL must be disabled on MIPS
NON_MIPS_COMPONENTS = s/core/adb s/core/fastboot
ifneq ($(filter amd64 i386 armel armhf arm64 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/core/append2simg \
s/core/img2simg \
s/core/libbase.so \
s/core/libcutils.so \
s/core/liblog.so \
s/core/libsparse.so \
s/core/libziparchive.so \
s/core/simg2img \
s/core/simg2simg \
ifeq ($(filter amd64 i386 armel armhf arm64 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
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 mipsel mips64el ppc64el riscv64,$(DEB_HOST_ARCH)),)
LD_LIBRARY_PATH=debian/out/system/core debian/out/system/core/adb version
LD_LIBRARY_PATH=debian/out/system/core debian/out/system/core/adb help
LD_LIBRARY_PATH=debian/out/system/core debian/out/system/core/adb keygen key.txt && ls -l key.txt* && rm key.txt*
LD_LIBRARY_PATH=debian/out/system/core debian/out/system/core/fastboot --version
LD_LIBRARY_PATH=debian/out/system/core debian/out/system/core/fastboot devices
endif
endif
override_dh_auto_install:
echo ignore upstream build system install procedure
override_dh_auto_configure-arch:
rm -rf external/boringssl external/libunwind external/selinux development/[a-s]* development/v* development/testrunner art
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)
|