#!/usr/bin/make -f
#
# redumper-rgui — repackage of upstream's statically-linked linux-x64 binary at a
# PINNED build (b729), installed as /usr/bin/redumper-rgui.
#
# Nothing is compiled, and unlike the rolling redumper package nothing is
# documented either: this carries no manpage on purpose. It is a compatibility
# build for consumers that pinned it, not a tool to reach for on the command
# line -- the rolling redumper package is, and it is the one that ships
# redumper(1). Both install at once; the binary name keeps them apart.

%:
	dh $@

# The upstream binary is prebuilt and statically linked — there is nothing to
# compile. What does have to happen is the rename: upstream's release zip (which
# IS the .orig tarball, fetched straight from the URL the spec names) carries the
# binary under its own name, bin/redumper. A pinned build installs as
# /usr/bin/redumper-rgui — that rename is the whole reason it can sit alongside the
# rolling redumper and the other pins.
#
# It lives in the OVERRIDE, not in an execute_before_dh_auto_build hook: an empty
# override REPLACES the step and the hook never fires. Measured — dh_install then
# looked for bin/redumper-rgui and found upstream's bin/redumper.
#
# On arm64 the same rename happens, but from the linux-arm64 binary: the .orig
# tarball (Debtransform-Tar) is the linux-x64 zip, so bin/redumper is the x86-64
# build; the arm64 zip travels as a Debtransform-Files extra (obs-build covers it
# with --include-binaries), and we unpack it and install its binary as
# bin/redumper-rgui. This runs AFTER dpkg-source has built the source package, so
# it does not perturb the .dsc. arm64 ships UNTESTED (no hardware proof).
override_dh_auto_build:
ifeq ($(DEB_HOST_ARCH),arm64)
	unzip -o redumper-b*-linux-arm64.zip
	install -m 0755 redumper-b*-linux-arm64/bin/redumper bin/redumper-rgui
else
	test ! -e bin/redumper || mv bin/redumper bin/redumper-rgui
endif

override_dh_auto_test:

# Do not touch the upstream release binary: it is statically linked and shipped
# as-is by upstream. Stripping / dwz would only risk corrupting it and would
# make the packaged binary differ from the published release — which is the one
# thing a pinned package must never do.
override_dh_strip:

override_dh_dwz:
