summaryrefslogtreecommitdiffstats
path: root/debian/rules
diff options
context:
space:
mode:
Diffstat (limited to 'debian/rules')
-rwxr-xr-xdebian/rules50
1 files changed, 50 insertions, 0 deletions
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..2ef5bb0
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,50 @@
+#!/usr/bin/make -f
+
+VERSION := $(shell dpkg-parsechangelog | awk '/^Version:/ { print $$2 }')
+ifneq ($(findstring bpo,$(VERSION)),)
+ FLAVOR := debian-backports
+else ifneq ($(findstring pgdg,$(VERSION)),)
+ FLAVOR := pgdg
+ # for apt.postgresql.org builds, pull in the repository key package
+ PGDG_DEPENDS := pgdg-keyring
+else
+ FLAVOR := default
+endif
+SUPPORTED_VERSIONS := $(shell PG_SUPPORTED_VERSIONS="$(FLAVOR)" debian/supported-versions)
+DEFAULT_VER := $(lastword $(SUPPORTED_VERSIONS))
+LIBREADLINE := $(shell dpkg-query -W --showformat '$${Status} $${Package}\n' 'libreadline[0-9]'| sed -n '/ installed / {s/^.* //; p}'|sort -ru | head -n1)
+
+#py2#PYTHON2_PACKAGE=postgresql-plpython-$v
+WITH_SYSTEMD=--with systemd
+
+%:
+ dh $@ $(WITH_SYSTEMD)
+
+override_dh_auto_configure:
+ @echo "### Building postgresql-common flavor $(FLAVOR)"
+ @echo "### Supported PostgreSQL versions: $(SUPPORTED_VERSIONS) (default version: $(DEFAULT_VER))"
+
+override_dh_install:
+ dh_install -X.gitignore
+ $(MAKE) -C systemd install DESTDIR=$(CURDIR)/debian/postgresql-common
+ install -m 644 -D debian/postgresql-common.sysctl debian/postgresql-common/etc/sysctl.d/30-postgresql-shm.conf
+ /bin/echo -e "# See /usr/share/postgresql-common/supported-versions for documentation of this file\n$(FLAVOR)" > debian/postgresql-client-common/etc/postgresql-common/supported_versions
+
+override_dh_installinit:
+ dh_installinit -ppostgresql-common --name=postgresql -u'defaults 19 21' -r
+
+override_dh_gencontrol:
+ dh_gencontrol -ppostgresql-server-dev-all -- -Vserver-dev-all-depends="$(foreach v,$(SUPPORTED_VERSIONS),postgresql-server-dev-$v,)"
+
+ # the versionless metapackages need to have version numbers which match
+ # the server version, not the p-common version
+ dh_gencontrol -ppostgresql -ppostgresql-client -ppostgresql-doc -ppostgresql-contrib -- \
+ -Vdefault-version="$(DEFAULT_VER)" -v'$(DEFAULT_VER)+$${source:Version}'
+
+ dh_gencontrol -ppostgresql-client-common -- \
+ -Vpgdg:Depends="$(PGDG_DEPENDS)" -Vreadline:Recommends=$(LIBREADLINE)
+
+ dh_gencontrol -ppostgresql-all -- \
+ -Vpostgresql-all-depends="$(foreach v,$(SUPPORTED_VERSIONS),postgresql-contrib-$v,postgresql-plperl-$v,$(if $(filter 8.% 9.% 10 11, $v), $(PYTHON2_PACKAGE)),postgresql-plpython3-$v,postgresql-pltcl-$v,)"
+
+ dh_gencontrol --remaining-packages