rules 1.39 KB
Newer Older
1
2
3
4
5
#!/usr/bin/make -f
# -*- makefile -*-

# export DH_VERBOSE = 1

6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Return the minimum value of two integer arguments.
min = $(shell echo $$(( $(1) < $(2) ? $(1) : $(2) )))
max = $(shell echo $$(( $(1) > $(2) ? $(1) : $(2) )))

# Number of CPUs to build Qt.
NO_CPUS := $(call max,$(shell nproc),1)

# There can be multiple builds of Qt in parallel.  The following
# should match the maximum number of per-machine workers used in the
# CI.
MAX_PARALLEL_BUILDS := 4

# qtwebengine (aka chromium) takes a ton of memory per build process,
# up to 2.3 GiB.  Cap the number of jobs based on the amount of
# available memory to try to guard against OOM build failures.
AVAILABLE_MEMORY := $(shell free -g | grep -E '^Mem:' | awk '{print $$7}')
MEMORY_REQUIRED_PER_CORE := 2	# in GiB
COMPUTED_JOB_COUNT := \
  $(call max,$(shell echo $$(( $(AVAILABLE_MEMORY) \
                               / $(MEMORY_REQUIRED_PER_CORE) \
                               / $(MAX_PARALLEL_BUILDS) ))),1)
JOB_COUNT = $(call min,$(NO_CPUS),$(COMPUTED_JOB_COUNT))
28

29
30
31
32
%:
	dh $@

override_dh_auto_configure:
33
34
35
36
37
38
39
40
41
42
	./configure \
	  -opensource \
	  -confirm-license \
	  -nomake examples \
	  -nomake tests \
	  -prefix "${QT_JAMI_PREFIX}"

override_dh_auto_build:
	@echo Building Qt using $(JOB_COUNT) parallel jobs
	$(MAKE) -j$(JOB_COUNT) V=1 NINJAFLAGS="-j$(JOB_COUNT)"
43
44
45

override_dh_auto_install:
	dh_auto_install -Smakefile -- INSTALL_ROOT=$(CURDIR)/debian/tmp/