File: rules

package info (click to toggle)
mdbook 0.4.52%2Bds-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,376 kB
  • sloc: javascript: 1,140; sh: 75; python: 28; makefile: 26
file content (36 lines) | stat: -rwxr-xr-x 1,072 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/make -f

include /usr/share/dpkg/pkg-info.mk
include /usr/share/rustc/architecture.mk

export DEB_HOST_RUST_TYPE

CRATE_VER = mdbook-$(DEB_VERSION_UPSTREAM:+ds=)
PACKAGE_DIR = target/package/$(CRATE_VER)
REGISTRY_DIR = /usr/share/cargo/registry
DEB_REGISTRY_DIR = debian/librust-mdbook-dev/$(REGISTRY_DIR)
CARGO_BASE_ARGS= --release --target $(DEB_HOST_RUST_TYPE)

%:
	dh $@ --with=shell_completions

execute_before_dh_auto_configure:
	mkdir -p .cargo
	cp debian/cargo-config.toml .cargo/config.toml

override_dh_auto_build:
	cargo build $(CARGO_BASE_ARGS)

override_dh_auto_test:
	cargo test $(CARGO_BASE_ARGS)

execute_before_dh_auto_install:
	cargo package
	rm -rf $(PACKAGE_DIR)/target $(PACKAGE_DIR)/debian $(PACKAGE_DIR)/Cargo.lock
	mkdir -p $(PACKAGE_DIR)/debian $(DEB_REGISTRY_DIR)
	find $(PACKAGE_DIR) -type f -executable -exec chmod -x '{}' +
	cp -a debian/patches $(PACKAGE_DIR)/debian/
	cp -a $(PACKAGE_DIR) $(DEB_REGISTRY_DIR)/

execute_after_dh_auto_install:
	/usr/share/dh-rust/bin/dh-rust-built-using target/$(DEB_HOST_RUST_TYPE)/release mdbook