librtmp2 0.3.0

librtmp2 — RTMP/RTMPS protocol library
Documentation
#!/usr/bin/make -f

# librtmp2 vendors its crates.io dependencies into vendor/ before the source
# package is built (see .github/workflows/publish-ppa.yml) because Launchpad
# PPA builders have no network access. .cargo/config.toml (also generated by
# the workflow) points cargo at that vendor directory.
export CARGO_HOME := $(CURDIR)/debian/cargo_home
export CARGO_NET_OFFLINE := true
export DEB_BUILD_MAINT_OPTIONS := hardening=+all

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
UPSTREAM_VERSION := $(shell dpkg-parsechangelog -SVersion | sed 's/-.*//')

# Per docs/abi-policy.md the soname only bumps on a major (ABI-breaking)
# release, not expected before 1.0.0 - so the soname major tracks "0" for
# the whole 0.x series.
SONAME_MAJOR := 0
SONAME := liblibrtmp2.so.$(SONAME_MAJOR)

export RUSTFLAGS := -C link-arg=-Wl,-soname,$(SONAME)

%:
	dh $@

override_dh_auto_build:
	cargo build --release --offline --all-features --verbose

override_dh_auto_test:
	cargo test --release --offline --all-features --verbose

override_dh_auto_install:
	install -D -m0644 target/release/liblibrtmp2.so \
		debian/librtmp2/usr/lib/$(DEB_HOST_MULTIARCH)/liblibrtmp2.so.$(UPSTREAM_VERSION)
	ln -s liblibrtmp2.so.$(UPSTREAM_VERSION) \
		debian/librtmp2/usr/lib/$(DEB_HOST_MULTIARCH)/$(SONAME)
	install -D -m0644 target/release/liblibrtmp2.a \
		debian/librtmp2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/liblibrtmp2.a
	ln -s $(SONAME) \
		debian/librtmp2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/liblibrtmp2.so
	sed -e 's/@VERSION@/$(UPSTREAM_VERSION)/' \
		-e 's/@MULTIARCH@/$(DEB_HOST_MULTIARCH)/' \
		debian/librtmp2.pc.in > debian/librtmp2.pc
	install -D -m0644 debian/librtmp2.pc \
		debian/librtmp2-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/librtmp2.pc

override_dh_shlibdeps:
	dh_shlibdeps -l$(CURDIR)/debian/librtmp2/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_dwz:
	# liblibrtmp2.so is a Rust cdylib; dwz on Rust debug info is unreliable.