#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
DH_VERBOSE = 1

# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

PACKAGE_NAME = $(shell dpkg-parsechangelog -S Source)

# main packaging script based on dh7 syntax
%:
	dh $@

override_dh_shlibdeps:
	# The proprietary sensor libraries are over-linked: their DT_NEEDED
	# entries include libatomic, libpthread, librt, and libglib-2.0 even
	# though no symbols are actually used (confirmed via dpkg-shlibdeps).
	# Since we cannot rebuild these vendor binaries to fix the linkage,
	# skip dh_shlibdeps and manage runtime dependencies explicitly.
	:

override_dh_strip:
	# Proprietary prebuilt .so files must not be stripped
	# Skip dh_strip to preserve vendor's binaries as-is
	:

override_dh_dwz:
	# Proprietary prebuilt .so files must not be DWZ-compressed
	# Skip dh_dwz to preserve vendor's binaries as-is
	:

override_dh_makeshlibs:
	# Proprietary camera libs are not in standard library paths, skip ldconfig
	:

get-orig-source:
	mkdir $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)
	cp -a usr/ etc/ $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)
	tar -czf ../$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.gz $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)
	rm -rf $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM)
