| #!/usr/bin/make -f | |
| export DEB_BUILD_MAINT_OPTIONS = hardening=+all | |
| DPKG_EXPORT_BUILDFLAGS = 1 | |
| include /usr/share/dpkg/buildflags.mk | |
| # Final build flags passed to gn. | |
| FINAL_CFLAGS := $(filter-out -Werror=implicit-function-declaration,${CFLAGS}) -D_FORTIFY_SOURCE=2 | |
| FINAL_CXXFLAGS := ${CXXFLAGS} -D_FORTIFY_SOURCE=2 | |
| FINAL_LDFLAGS := ${LDFLAGS} -Wl,-rpath=/usr/lib/perfetto | |
| # Build directory for gn/ninja. | |
| BUILD_DIR := out/release | |
| PANDOC_CMD := pandoc -s -t man --shift-heading-level-by=-1 | |
| %: | |
| dh $@ | |
| override_dh_auto_configure: MAYBE_HOST_CPU=$(shell \ | |
| if [ "${DEB_BUILD_GNU_CPU}" = "i686" ]; then \ | |
| echo "host_cpu=\\\"x86\\\"";\ | |
| elif [ "${DEB_BUILD_GNU_CPU}" = "x86_64" ]; then \ | |
| echo "host_cpu=\\\"x64\\\"";\ | |
| elif [ "${DEB_BUILD_GNU_CPU}" = "aarch64" ]; then \ | |
| echo "host_cpu=\\\"arm64\\\"";\ | |
| elif [ "${DEB_BUILD_GNU_CPU}" = "arm64" ]; then \ | |
| echo "host_cpu=\\\"arm64\\\"";\ | |
| elif [ "${DEB_BUILD_GNU_CPU:0:3}" == "arm" ]; then \ | |
| echo "host_cpu=\\\"arm\\\"";\ | |
| fi\ | |
| ) | |
| override_dh_auto_configure: | |
| env | |
| uname -a | |
| gn gen out/release --args="\ | |
| is_debug=false \ | |
| use_custom_libcxx=false \ | |
| is_hermetic_clang=false \ | |
| is_system_compiler=true \ | |
| is_clang=false \ | |
| skip_buildtools_check=true \ | |
| enable_perfetto_integration_tests=false \ | |
| enable_perfetto_unittests=false \ | |
| perfetto_use_system_protobuf=true \ | |
| perfetto_use_system_zlib=true \ | |
| perfetto_enable_git_rev_version_header=false \ | |
| extra_cflags=\"${FINAL_CFLAGS}\" \ | |
| extra_cxxflags=\"${FINAL_CXXFLAGS}\" \ | |
| extra_ldflags=\"${FINAL_LDFLAGS}\" \ | |
| cc=\"${CC}\" \ | |
| cxx=\"${CXX}\" \ | |
| ${MAYBE_HOST_CPU}" | |
| override_dh_auto_build: | |
| # Build binaries. | |
| ninja -v -C ${BUILD_DIR} perfetto tracebox traced traced_probes | |
| # Generate manpages. | |
| ${PANDOC_CMD} docs/reference/perfetto-cli.md > debian/perfetto.1 | |
| ${PANDOC_CMD} docs/reference/tracebox.md > debian/tracebox.1 | |
| ${PANDOC_CMD} docs/getting-started/system-tracing.md > debian/traced.8 | |
| ${PANDOC_CMD} docs/getting-started/system-tracing.md > debian/traced_probes.8 | |
| override_dh_auto_clean: | |
| rm -rf ${BUILD_DIR} |