| 1 |
#! /usr/bin/make -f |
| 2 |
|
| 3 |
export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow |
| 4 |
include /usr/share/dpkg/pkg-info.mk |
| 5 |
ifeq (${DEB_HOST_GNU_TYPE},) |
| 6 |
# Fast version of dpkg/architecture.mk defining all vars in one go |
| 7 |
$(foreach d, $(shell dpkg-architecture | sed 's/=/?=/'), $(eval export $d)) |
| 8 |
endif |
| 9 |
|
| 10 |
# CARGO_HOME *must* end with "/debian/cargo_home" |
| 11 |
export CARGO_HOME=${CURDIR}/b/debian/cargo_home |
| 12 |
export CARGO=/usr/share/cargo/bin/cargo |
| 13 |
|
| 14 |
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4 |
| 15 |
|
| 16 |
V = $(if $(filter terse, ${DEB_BUILD_OPTIONS}),,-v) |
| 17 |
|
| 18 |
# libblkio build system wraps cargo in meson. |
| 19 |
|
| 20 |
build build-arch build-indep \ |
| 21 |
install install-arch install-indep \ |
| 22 |
binary binary-arch binary-indep \ |
| 23 |
: %: |
| 24 |
dh $@ |
| 25 |
|
| 26 |
# /usr/share/cargo/bin/cargo wrapper is stupid and broken in many ways, |
| 27 |
# and apparently needs huge work to fix. Instead of trying to fight all |
| 28 |
# its issues, use it only when absolutely necessary: just to set up |
| 29 |
# the system registry and build flags. |
| 30 |
# The rest is done using regular cargo directly. |
| 31 |
override_dh_auto_configure: |
| 32 |
DEB_CARGO_CRATE=${DEB_SOURCE}_${DEB_VERSION_UPSTREAM} \ |
| 33 |
DEB_HOST_RUST_TYPE=${DEB_HOST_GNU_TYPE} DEB_HOST_GNU_TYPE=${DEB_HOST_GNU_TYPE} \ |
| 34 |
${CARGO} prepare-debian b/cargo-registry --link-from-system $V |
| 35 |
|
| 36 |
meson setup b/ --wrap-mode=nodownload --buildtype=plain \ |
| 37 |
--prefix=/usr --sysconfdir=/etc --localstatedir=/var \ |
| 38 |
--libdir=/usr/lib/${DEB_HOST_MULTIARCH} |
| 39 |
|
| 40 |
override_dh_auto_build: |
| 41 |
meson compile -C b/ -v |
| 42 |
|
| 43 |
override_dh_auto_test: |
| 44 |
ifneq (,$(filter nocheck,${DEB_BUILD_OPTIONS})) |
| 45 |
meson test -C b/ \ |
| 46 |
--suite generic --suite io_uring+parallel --suite examples |
| 47 |
endif |
| 48 |
|
| 49 |
b := libblkio.so.1 |
| 50 |
f := libblkio.so.${DEB_VERSION_UPSTREAM} |
| 51 |
override_dh_auto_install: |
| 52 |
meson install -C b/ --destdir ${CURDIR}/debian/tmp |
| 53 |
|
| 54 |
# cd debian/tmp/usr/lib/${DEB_HOST_MULTIARCH}; \ |
| 55 |
# patchelf --set-soname ${b} ${f}; \ |
| 56 |
# ln -sf ${f} ${b}; \ |
| 57 |
# ln -sf ${b} libblkio.so |
| 58 |
|
| 59 |
# dwz: Allocatable section in libblkio.so.1.4.0 after non-allocatable ones |
| 60 |
override_dh_dwz: |
| 61 |
|
| 62 |
clean: |
| 63 |
dh_clean b/ Cargo.lock |