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/-.*//')
VENDOR_ARCHIVE := vendor.tar.xz
SONAME_MAJOR := 0
SONAME := liblibrtmp2.so.$(SONAME_MAJOR)
export RUSTFLAGS := -C link-arg=-Wl,-soname,$(SONAME)
%:
dh $@
.PHONY: unpack-vendor
unpack-vendor:
@if [ ! -d vendor ]; then \
test -f "$(VENDOR_ARCHIVE)" || { \
echo >&2 "error: $(VENDOR_ARCHIVE) is required for the offline Debian build"; \
exit 1; \
}; \
mkdir -p vendor; \
tar -xJf "$(VENDOR_ARCHIVE)" -C vendor; \
fi
override_dh_auto_build: unpack-vendor
cargo build --release --offline --all-features --verbose
override_dh_auto_test: unpack-vendor
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:
override_dh_clean:
dh_clean
rm -rf target debian/cargo_home vendor