File: rules

package info (click to toggle)
phrog 0.46.0-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 700 kB
  • sloc: makefile: 35; sh: 28; xml: 25
file content (48 lines) | stat: -rwxr-xr-x 1,617 bytes parent folder | download | duplicates (2)
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
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

include /usr/share/dpkg/default.mk
include /usr/share/rustc/architecture.mk
export DEB_HOST_RUST_TYPE DEB_HOST_GNU_TYPE
export CARGO=/usr/share/cargo/bin/cargo
export CARGO_HOME=$(CURDIR)/debian/cargo_home
export CARGO_REGISTRY=$(CURDIR)/debian/cargo_registry
export DEB_CARGO_CRATE=$(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM)
export INSTALL_DIR=$(CURDIR)/debian/phrog

%:
	dh $@

# The custom build.rs works under $HOME to ensure the glib schemas
# compile cleanly, so let's ensure there's a valid/writable $HOME
# during build and delete it afterwards
override_dh_auto_build:
	HOME=$(CURDIR)/debian/tmp_home $(CARGO) build

override_dh_auto_install:
	install -D -m0755 target/$(DEB_HOST_RUST_TYPE)/debug/phrog \
		$(INSTALL_DIR)/usr/bin/phrog
	install -D -m0755 data/phrog-greetd-session \
		$(INSTALL_DIR)/usr/libexec/phrog-greetd-session

override_dh_auto_test:
# Don't run tests on 32 bits systems as we might run out of memory
ifneq ($(DEB_HOST_ARCH_BITS),32)
ifeq ($(filter nocheck,$(DEB_BUILD_OPTIONS)),)
	mkdir -p $(CURDIR)/debian/tmp_home $(CURDIR)/debian/tmp_run
	LC_ALL=C.UTF-8 XDG_RUNTIME_DIR=$(CURDIR)/debian/tmp_run \
		HOME=$(CURDIR)/debian/tmp_home dbus-run-session xvfb-run -a \
			phoc -C $(CURDIR)/debian/config/phoc.ini -E "$(CARGO) test"
endif
endif

execute_after_dh_auto_clean:
	$(CARGO) clean
	rm -rf $(CARGO_HOME)
	rm -rf $(CARGO_REGISTRY)
	rm -rf $(CURDIR)/debian/tmp_home $(CURDIR)/debian/tmp_run

execute_before_dh_auto_configure:
	$(CARGO) prepare-debian $(CARGO_REGISTRY) --link-from-system
	rm -f .cargo/config Cargo.lock