File: rules

package info (click to toggle)
graph-tool 2.98%2Bds-4
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 29,356 kB
  • sloc: cpp: 87,937; python: 31,476; makefile: 958; xml: 101; sh: 42
file content (97 lines) | stat: -rwxr-xr-x 2,862 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/make -f
include /usr/share/dpkg/pkg-info.mk
export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
ifeq (,$(filter $(DEB_HOST_ARCH), riscv64))
  DEB_BUILD_MAINT_OPTIONS += optimize=+lto
endif

# disable -O3 in the debianization-no-O3 patch, and
# re-enable it on some faster build architectures
ifneq (,$(filter $(DEB_HOST_ARCH), amd64 arm64 ppc64el))
  export DEB_CXXFLAGS_STRIP=-g -O2
  export DEB_CXXFLAGS_MAINT_APPEND=-g1 -O3
else
  export DEB_CXXFLAGS_STRIP=-g
  export DEB_CXXFLAGS_MAINT_APPEND=-g1
endif

DEB_DISTID=$(shell lsb_release -is)

export VERSION_COMMENT=\"($(DEB_DISTID) $(DEB_VERSION))\"

PY3DOTVERSION=$(shell py3versions -dv)
PY3DOTLESSVERSION=$(shell py3versions -dv | sed -e 's@\.@@')

DEB_PYTHON_VERSION=$(PY3DOTVERSION)
DEB_PYTHON_SITE_PKG=/usr/lib/python$(PY3DOTVERSION)/dist-packages

BUILDDIR=_BUILD

MEM_PER_CPU = 13000
NCPUS := $(or $(subst parallel=,,$(filter parallel=%,$(DEB_BUILD_OPTIONS))),$(shell nproc))
NJOBS := $(shell awk -vn=$(NCPUS) -vm=$(MEM_PER_CPU) '/^(MemAvail|SwapFree)/ { mt += $$2 } \
  END { n2 = int(mt/1024/m); print (n==1 || n2<=1) ? 1 : (n2<=n ? n2 : n) }' /proc/meminfo)

default:
	@uscan --no-conf --dehs --report || true

%:
	dh $@ --with python3 --builddirectory=$(BUILDDIR)

override_dh_auto_configure:
	## see d/patches/upstream-fix-autotools-automake-doc-missing.patch
	cp -vprd -t doc debian/adhoc/provide/doc/*
	PYTHON_VERSION=$(DEB_PYTHON_VERSION) \
	PYTHON_SITE_PKG=$(DEB_PYTHON_SITE_PKG) \
		dh_auto_configure -- \
			--with-sparsehash-prefix=google \
			--with-boost-python=boost_python$(PY3DOTLESSVERSION)

override_dh_auto_build:
	sh debian/show-mem-swap-nproc
	dh_auto_build --max-parallel=$(NJOBS)

override_dh_auto_test:
	true

override_dh_auto_install:
	dh_auto_install
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	@echo "TEST STARTED" `date -u`
	$(RM) $(BUILDDIR)/test.png
	PYTHONPATH=$(CURDIR)/debian/tmp/$(DEB_PYTHON_SITE_PKG) \
		python3 -c "\
from graph_tool.all import *; \
show_config(); \
g = random_graph(10, lambda: 5, directed=False); \
graph_draw(g, output='$(BUILDDIR)/test.png'); \
"
	@echo "TEST ENDED" `date -u`
endif

override_dh_install:
	dh_install -X.la

execute_after_dh_python3-arch:
	sed -i \
			-e 's|/lib/python'$(DEB_PYTHON_VERSION)'/dist-packages/graph_tool/|/lib/python3/dist-packages/graph_tool/|g' \
			-e 's|-I/usr/include ||g' \
		$(CURDIR)/debian/python3-graph-tool/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig/graph-tool-py$(DEB_PYTHON_VERSION).pc

override_dh_installchangelogs:
	dh_installchangelogs --keep ChangeLog

override_dh_missing:
	dh_missing -X.la --list-missing

override_dh_dwz:
	dh_dwz --no-dwz-multifile -Xlibgraph_tool_core -Xlibgraph_tool_inference

execute_before_dh_gencontrol:
	dh_numpy3

override_dh_clean:
	find debian/adhoc/provide/doc/ -type f | sed 's@debian/adhoc/provide/@@g' | xargs rm -vf
	dh_clean