File: rules

package info (click to toggle)
postgresql-11 11.9-0+deb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 141,456 kB
  • sloc: ansic: 816,751; sql: 84,486; yacc: 32,981; xml: 31,044; perl: 24,002; lex: 8,075; makefile: 5,031; sh: 4,639; cpp: 655; python: 121; asm: 65; sed: 15
file content (246 lines) | stat: -rwxr-xr-x 9,700 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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

MAJOR_VER := 11
#CASSERT_FLAGS := --enable-cassert

CATVERSION = $(shell awk '/CATALOG_VERSION_NO/ { print $$3 }' src/include/catalog/catversion.h)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#PIE# # On jessie/zesty and older, uncomment the #PIE# lines
#PIE# # "-pie" because it would break linking our .so files
#PIE# export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-pie
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
#PIE# # skip -pie on 32bit archs for performance and stability reasons
#PIE# # (http://www.postgresql.org/message-id/20140519115318.GB7296@msgid.df7cb.de, #797530)
#PIE# ifneq ($(DEB_HOST_ARCH_BITS || :),32)
#PIE# CFLAGS+= -fPIC -pie
#PIE# else
#PIE# # if gcc recognizes -no-pie, add it to CFLAGS (exit is 4 for unknown options)
#PIE# CFLAGS+= $(shell gcc -no-pie 2> /dev/null; [ $$? = 1 ] && echo "-no-pie")
#PIE# endif

# Facilitate hierarchical profile generation on amd64 (#730134)
ifeq ($(DEB_HOST_ARCH),amd64)
CFLAGS+= -fno-omit-frame-pointer
endif

export DPKG_GENSYMBOLS_CHECK_LEVEL=4

# if LLVM is installed, use it
ifneq ($(wildcard /usr/bin/llvm-config*),)
LLVM_FLAGS = --with-llvm
endif

# PostgreSQL 9.5+ does not have native spinlock support on alpha
# No spinlock support for RISC-V yet
ifneq ($(findstring $(DEB_HOST_ARCH), alpha riscv64),)
SPINLOCK_FLAGS = --disable-spinlocks
endif

ifeq ($(DEB_HOST_ARCH_OS),linux)
SYSTEMD_FLAGS = --with-systemd
SELINUX_FLAGS= --with-selinux
endif

COMMON_CONFIGURE_FLAGS= \
  --mandir=/usr/share/postgresql/$(MAJOR_VER)/man \
  --docdir=/usr/share/doc/postgresql-doc-$(MAJOR_VER) \
  --sysconfdir=/etc/postgresql-common \
  --datarootdir=/usr/share/ \
  --datadir=/usr/share/postgresql/$(MAJOR_VER) \
  --bindir=/usr/lib/postgresql/$(MAJOR_VER)/bin \
  --libdir=/usr/lib/$(DEB_HOST_MULTIARCH)/ \
  --libexecdir=/usr/lib/postgresql/ \
  --includedir=/usr/include/postgresql/ \
  --with-extra-version=" ($(shell dpkg-vendor --query vendor) $(shell dpkg-parsechangelog | awk '/^Version:/ { print $$2 }'))" \
  --enable-nls \
  --enable-integer-datetimes \
  --enable-thread-safety \
  --enable-tap-tests \
  --enable-debug \
  --enable-dtrace \
  $(CASSERT_FLAGS) \
  --disable-rpath \
  --with-uuid=e2fs \
  --with-gnu-ld \
  --with-pgport=5432 \
  --with-system-tzdata=/usr/share/zoneinfo \
  $(LLVM_FLAGS) \
  $(SYSTEMD_FLAGS) \
  $(SELINUX_FLAGS) \
  $(SPINLOCK_FLAGS) \
  MKDIR_P='/bin/mkdir -p' \
  TAR='/bin/tar' \
  CFLAGS='$(CFLAGS)' \
  LDFLAGS='$(LDFLAGS)'

# allow missing krb5 and ldap during bootstrapping
ifeq ($(DEB_STAGE),stage1)
BOOTSTRAP_FLAGS=
else
BOOTSTRAP_FLAGS= --with-gssapi --with-ldap \
		 --with-includes=/usr/include/mit-krb5 \
		 --with-libs=/usr/lib/mit-krb5 \
		 --with-libs=/usr/lib/$(DEB_HOST_MULTIARCH)/mit-krb5
endif

%:
	dh $@

override_dh_auto_configure-indep: stamp/configure-build
override_dh_auto_configure-arch: stamp/configure-build stamp/configure-build-py3

stamp/configure-build:
	mkdir -p stamp
	dh_auto_configure --builddirectory=build -- \
           --with-icu \
           --with-tcl \
           --with-perl \
           --with-python \
           --with-pam \
           --with-openssl \
           --with-libxml \
           --with-libxslt \
           PYTHON=/usr/bin/python \
           $(COMMON_CONFIGURE_FLAGS) \
           $(BOOTSTRAP_FLAGS)
	# remove pre-built documentation
	rm -fv doc/src/sgml/*-stamp
	touch "$@"

stamp/configure-build-py3:
	mkdir -p stamp
	dh_auto_configure --builddirectory=build-py3 -- \
           --with-python \
           PYTHON=/usr/bin/python3 \
           $(COMMON_CONFIGURE_FLAGS)
	touch "$@"

override_dh_auto_build-indep:
	$(MAKE) -C build/doc all # build man + html

override_dh_auto_build-arch: stamp/build stamp/build-py3

stamp/build: stamp/configure-build
	# set MAKELEVEL to 0 to force building submake-generated-headers in src/Makefile.global(.in)
	MAKELEVEL=0 $(MAKE) -C build/src all
	$(MAKE) -C build/doc man # build man only
	$(MAKE) -C build/config all
	$(MAKE) -C build/contrib all
	# build tutorial stuff
	$(MAKE) -C build/src/tutorial NO_PGXS=1
	touch "$@"

stamp/build-py3: stamp/configure-build-py3
	MAKELEVEL=0 $(MAKE) -C build-py3/src/pl/plpython
	$(MAKE) -C build-py3/contrib/hstore_plpython
	$(MAKE) -C build-py3/contrib/jsonb_plpython
	$(MAKE) -C build-py3/contrib/ltree_plpython
	touch "$@"

override_dh_auto_install-arch:
	$(MAKE) -C build/doc/src/sgml install-man DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C build/src install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C build/config install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C build/contrib install DESTDIR=$(CURDIR)/debian/tmp
	$(MAKE) -C build-py3/src/pl/plpython install DESTDIR=$(CURDIR)/debian/postgresql-plpython3-$(MAJOR_VER)
	$(MAKE) -C build-py3/contrib/hstore_plpython install DESTDIR=$(CURDIR)/debian/postgresql-plpython3-$(MAJOR_VER)
	$(MAKE) -C build-py3/contrib/jsonb_plpython install DESTDIR=$(CURDIR)/debian/postgresql-plpython3-$(MAJOR_VER)
	$(MAKE) -C build-py3/contrib/ltree_plpython install DESTDIR=$(CURDIR)/debian/postgresql-plpython3-$(MAJOR_VER)
	# remove files duplicated from postgresql and -server-dev
	rm -rf debian/postgresql-plpython3-$(MAJOR_VER)/usr/include
	rm -rf debian/postgresql-plpython3-$(MAJOR_VER)/usr/share/locale
	rm debian/postgresql-plpython3-$(MAJOR_VER)/usr/lib/postgresql/$(MAJOR_VER)/lib/pgxs/src/pl/plpython/regress-python3-mangle.mk
	# remove files from the "wrong" python package
	rm -v debian/postgresql-plpython3-$(MAJOR_VER)/usr/share/postgresql/$(MAJOR_VER)/extension/*plpython[2u]*
	# move SPI examples into server package (they wouldn't be in the doc package in an -A build)
	mkdir -p debian/postgresql-$(MAJOR_VER)/usr/share/doc/postgresql-$(MAJOR_VER)
	mv debian/tmp/usr/share/doc/postgresql-doc-$(MAJOR_VER)/extension debian/postgresql-$(MAJOR_VER)/usr/share/doc/postgresql-$(MAJOR_VER)/examples

override_dh_auto_install-indep:
	$(MAKE) -C build/doc install DESTDIR=$(CURDIR)/debian/tmp

override_dh_makeshlibs:
	dh_makeshlibs -Xusr/lib/postgresql/$(MAJOR_VER)

override_dh_auto_clean:
	rm -rf build* stamp

override_dh_installchangelogs:
	dh_installchangelogs HISTORY

override_dh_compress:
	dh_compress -X.source -X.c
	# compress manpages
	gzip -9n $(CURDIR)/debian/*/usr/share/postgresql/*/man/man*/*.[137]

override_dh_install-arch:
	dh_install --fail-missing

	# link README.Debian.gz to postgresql-common
	mkdir -p debian/postgresql-$(MAJOR_VER)/usr/share/doc/postgresql-$(MAJOR_VER)
	ln -s ../postgresql-common/README.Debian.gz debian/postgresql-$(MAJOR_VER)/usr/share/doc/postgresql-$(MAJOR_VER)/README.Debian.gz

	# assemble perl version of pg_config in libpq-dev
	sed -ne '1,/__DATA__/p' debian/pg_config.pl > debian/libpq-dev/usr/bin/pg_config
	LC_ALL=C debian/postgresql-server-dev-$(MAJOR_VER)/usr/lib/postgresql/$(MAJOR_VER)/bin/pg_config >> debian/libpq-dev/usr/bin/pg_config
	LC_ALL=C debian/postgresql-server-dev-$(MAJOR_VER)/usr/lib/postgresql/$(MAJOR_VER)/bin/pg_config --help >> debian/libpq-dev/usr/bin/pg_config
	chmod 755 debian/libpq-dev/usr/bin/pg_config

	# remove actual build path from Makefile.global for reproducibility
	sed -i -e "s!^abs_top_builddir.*!abs_top_builddir = /build/postgresql-$(MAJOR_VER)/build!" \
	       -e "s!^abs_top_srcdir.*!abs_top_srcdir = /build/postgresql-$(MAJOR_VER)/build/..!" \
	       -e 's!-f\(debug\|file\)-prefix-map=[^ ]* !!g' \
	       debian/postgresql-server-dev-$(MAJOR_VER)/usr/lib/postgresql/$(MAJOR_VER)/lib/pgxs/src/Makefile.global

	# these are shipped in the pl packages
	bash -c "rm debian/postgresql-$(MAJOR_VER)/usr/share/postgresql/$(MAJOR_VER)/extension/{plperl,plpython,pltcl,*_pl}*"
	bash -c "rm debian/postgresql-$(MAJOR_VER)/usr/lib/postgresql/$(MAJOR_VER)/lib/{plperl,plpython,pltcl,*_pl}*"

	# record catversion in a file
	echo $(CATVERSION) > debian/postgresql-$(MAJOR_VER)/usr/share/postgresql/$(MAJOR_VER)/catalog_version

override_dh_install-indep:
	dh_install --fail-missing

	if [ -d debian/postgresql-doc-$(MAJOR_VER) ]; then set -e; \
		install -d debian/postgresql-doc-$(MAJOR_VER)/usr/share/doc/postgresql-doc-$(MAJOR_VER)/tutorial; \
		install src/tutorial/*.c src/tutorial/*.source src/tutorial/Makefile src/tutorial/README debian/postgresql-doc-$(MAJOR_VER)/usr/share/doc/postgresql-doc-$(MAJOR_VER)/tutorial; \
	fi

override_dh_auto_test-indep:
	# nothing to do

override_dh_auto_test-arch:
ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# when tests fail, print newest 3 log files
	# initdb doesn't like LANG and LC_ALL to contradict, unset LANG and LC_CTYPE here
	# temp-install wants to be invoked from a top-level make, unset MAKELEVEL here
	# hurd doesn't implement semaphores shared between processes yet; succeed anyway so they at least have libpq5
	# plperl currently fails on kfreebsd-*
	unset LANG LC_CTYPE MAKELEVEL; if ! make -C build check-world EXTRA_REGRESS_OPTS='--port=$(shell perl -le 'print 1024 + int(rand(64000))')'; then \
	    for l in `find build \( -name regression.diffs -o -name initdb.log -o -name postmaster.log \) | perl -we 'print map { "$$_\n"; } sort { (stat $$a)[9] <=> (stat $$b)[9] } map { chomp; $$_; } <>' | tail -3`; do \
		echo "******** $$l ********"; \
		cat $$l; \
	    done; \
	    case $(DEB_HOST_ARCH) in \
	        hurd-*|kfreebsd-*) exit 0 ;; \
	        *) exit 1 ;; \
	    esac; \
	fi
endif

#dbg#override_dh_strip:
#dbg#	dh_strip --dbg-package=postgresql-$(MAJOR_VER)-dbg

override_dh_installdeb-arch:
	dh_installdeb
	# record catversion in preinst
	sed -i -e 's/@CATVERSION@/$(CATVERSION)/' debian/postgresql-$(MAJOR_VER)/DEBIAN/preinst

override_dh_gencontrol:
	# record catversion in .deb control file
	dh_gencontrol -- -Vpostgresql:Catversion=$(CATVERSION)