File debian.rules of Package kopano-python-services

#!/usr/bin/make -f
# -*- makefile -*-

export PATH := /opt/dts4debian:${PATH}
export DH_VERBOSE=1
export DH_OPTIONS
DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_RELEASE_CODE    ?= $(shell lsb_release -cs)
CONFFLAGS = --disable-base \
	--prefix=/usr --localstatedir=/var --sysconfdir=/etc --enable-release \
	TCMALLOC_CFLAGS=" " TCMALLOC_LIBS="-ltcmalloc_minimal"
INSTDIR = debian/tmp

override_dh_auto_configure:
	autoreconf -fi
	dh_auto_configure -Bpy3 -- ${CONFFLAGS} PYTHON="$$(which python3)" PYTHON_CFLAGS="$$(pkg-config python3 --cflags)" PYTHON_LIBS="$$(pkg-config python3 --libs)"

override_dh_auto_build:
	dh_auto_build -Bpy3 -- V=1

override_dh_systemd_start:
	# Restart services, after they have upgraded to minify downtime while
	# upgrading and to ensure all services actually are restarted on upgrade.
	dh_systemd_start --restart-after-upgrade

override_dh_systemd_enable:
	# Move systemd service files into debian folder so they can be correctly
	# installed by dh_systemd.
	mv -v debian/tmp/lib/systemd/system/kopano-*.service debian/
	dh_systemd_enable

override_dh_auto_install:
	dh_auto_install -Bpy3 -- -j1 PHP_SYSCONF_DIR=/usr/share/kopano/php/mapi
	mkdir -p ${INSTDIR}/var/lib/kopano/autorespond
	mkdir -p ${INSTDIR}/var/lib/kopano/rrd
	mkdir -p ${INSTDIR}/var/run/kopano

	if [ -x /usr/bin/php-config ]; then \
		PHP_VER=$(shell php-config --version | cut -c 1); \
		PHP_MAPI="php$$PHP_VER-mapi"; \
		sed -i s/php-mapi/$$PHP_MAPI/g debian/control; \
		if [ $$PHP_VER -eq 7 ] ; then \
			sed -i s/php-other-mapi/php5-mapi/g debian/control; \
		elif [ $$PHP_VER -eq 5 ] ; then \
			sed -i s/php-other-mapi/php7-mapi/g debian/control; \
		fi; \
		echo php:Depends=phpapi-$(shell php-config --phpapi) > debian/$$PHP_MAPI.substvars; \
	elif [ -x /usr/bin/php-config5 ]; then \
		sed -i s/php-mapi/php5-mapi/g debian/control; \
		sed -i s/php-other-mapi/php7-mapi/g debian/control; \
		echo php:Depends=phpapi-$(shell php-config5 --phpapi) > debian/php5-mapi.substvars; \
	fi
	mkdir -p ${INSTDIR}/usr/share/doc/kopano-common
	gzip -c <RELNOTES.txt >${INSTDIR}/usr/share/doc/kopano-common/changelog.gz

%:
	dh $@ --parallel --with python3,systemd
openSUSE Build Service is sponsored by