]> git.sesse.net Git - bcachefs-tools-debian/blobdiff - debian/rules
Enable Rust parts, including mount.bcachefs.
[bcachefs-tools-debian] / debian / rules
index fd523507ca0a417387107635177daaccc694a8bf..177294571ca59f4c27e968fb93a17ac9525faf6e 100755 (executable)
@@ -1,15 +1,20 @@
 #!/usr/bin/make -f
 
+include /usr/share/dpkg/architecture.mk
+include /usr/share/rustc/architecture.mk
+
+export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
+
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all
-# Do not build rust code (dependencies currently unmet)
-export NO_RUST=-true
+export CARGO=/usr/share/cargo/bin/cargo
+export CARGO_HOME=$(CURDIR)/debian/cargo_home
+export DEB_CARGO_CRATE=bcachefs-tools_$(DEB_VERSION_UPSTREAM)
 
 PREFIX := /usr
 ROOT_SBINDIR := /usr/sbin
 
 DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
 
-
 ifeq ($(DEB_BUILD_ARCH),amd64)
     DEB_BUILD_MAINT_OPTIONS += optimize=-lto
 endif
@@ -17,7 +22,20 @@ endif
 %:
        dh $@
 
+override_dh_auto_configure:
+       $(CARGO) prepare-debian $(CURDIR)/vendor --link-from-system
+
+override_dh_auto_build:
+       $(RM) Cargo.lock
+       dh_auto_build -- CARGO="$(CARGO)"
+
 override_dh_auto_install:
        dh_auto_install -- "PREFIX=$(PREFIX)" "ROOT_SBINDIR=$(ROOT_SBINDIR)"
 
+override_dh_auto_clean:
+       ! [ -d $(CURDIR)/vendor ] || $(RM) -r $(CURDIR)/vendor
+       ! [ -d $(CARGO_HOME) ] || $(RM) -r $(CARGO_HOME)
+       $(RM) Cargo.lock
+       dh_auto_clean
+
 override_dh_auto_test: