File: rules

package info (click to toggle)
psycopg3 3.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,836 kB
  • sloc: python: 46,657; sh: 403; ansic: 149; makefile: 73
file content (86 lines) | stat: -rwxr-xr-x 2,813 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
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
#!/usr/bin/make -f

# Allow for silencing build process
ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
export DH_VERBOSE = 1
export PYBUILD_VERBOSE=1
else
export DH_QUIET = 1
endif

# Enable all hardening options
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
DPKG_EXPORT_BUILDFLAGS = 1

# Needed for extracting build-related metadata
include /usr/share/dpkg/buildflags.mk
include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk

# Don't perform optimisation when we want to have all binary symbols
ifneq (,$(filter nostrip,$(DEB_BUILD_OPTIONS)))
DEB_CXXFLAGS_MAINT_STRIP=-O2
DEB_CXXFLAGS_MAINT_APPEND=-O0
endif

# Rename package to avoid potential conflict with psycopg2
export PYBUILD_NAME = psycopg
export PYBUILD_TEST_CUSTOM = 1
export PYBUILD_TEST_ARGS = $(CURDIR)/debian/run-tests {interpreter} {dir} {home_dir}

# Reproducible builds - build date is taken from debian/changelog
BUILD_DATE=$(shell LC_ALL=C date -u "+%B %d, %Y" -d "@$(SOURCE_DATE_EPOCH)")
SPHINXOPTS:=-D today=\"$(BUILD_DATE)\"
SPHINXOPTS+=-D html_last_updated_fmt=\"$(BUILD_DATE)\"

%:
	dh $@ --buildsystem=pybuild

# We need to build 3 different modules, from 3 different directories
override_dh_auto_clean-indep:
	PYBUILD_DIR=psycopg dh_auto_clean -- --name psycopg
	PYBUILD_DIR=psycopg_pool dh_auto_clean -- --name psycopg_pool
	rm -rf docs/_build

override_dh_auto_clean-arch:
	PYBUILD_DIR=psycopg_c dh_auto_clean -- --name psycopg_c

override_dh_auto_configure-indep:
	PYBUILD_DIR=psycopg dh_auto_configure -- --name psycopg
	PYBUILD_DIR=psycopg_pool dh_auto_configure -- --name psycopg_pool

override_dh_auto_configure-arch:
	PYBUILD_DIR=psycopg_c dh_auto_configure -- --name psycopg_c

override_dh_auto_build-indep:
	PYBUILD_DIR=psycopg dh_auto_build -- --name psycopg
	PYBUILD_DIR=psycopg_pool dh_auto_build -- --name psycopg_pool

override_dh_auto_build-arch:
	PYBUILD_DIR=psycopg_c dh_auto_build -- --name psycopg_c

override_dh_auto_install-indep:
	PYBUILD_DIR=psycopg dh_auto_install -- --name psycopg
	PYBUILD_DIR=psycopg_pool dh_auto_install -- --name psycopg_pool

override_dh_auto_install-arch:
	PYBUILD_DIR=psycopg_c dh_auto_install -- --name psycopg_c

execute_before_dh_installdocs-indep:
# Don't build documentation when required not to do it
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
# Documentation requires psycopg module to analyse existing types
	SPHINXOPTS="$(SPHINXOPTS)" pybuild --build -i python3 -s custom --build-args 'make -C {dir}/docs html'
endif

# Don't run tests when required not to do it
override_dh_auto_test-arch:
ifneq ($(DEB_HOST_ARCH),hurd-i386)
	PSYCOPG_IMPL=c dh_auto_test -- --name psycopg_c
endif

override_dh_auto_test-indep:
ifneq ($(DEB_HOST_ARCH),hurd-i386)
	PSYCOPG_IMPL=python dh_auto_test -- --name psycopg
endif