File debian.rules of Package kopano

#!/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 = \
	--prefix=/usr --localstatedir=/var --sysconfdir=/etc --enable-release \
	--disable-python --enable-pybind \
	TCMALLOC_CFLAGS=" " TCMALLOC_LIBS="-ltcmalloc_minimal"
INSTDIR = debian/tmp

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

override_dh_auto_build:
	dh_auto_build -- V=1

override_dh_auto_test:
	make test-short PYTEST=py.test-3

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_prep:
	dh_prep

	if [ -x /usr/bin/php-config ]; then \
		PHP_VER=$(shell /usr/bin/php-config --version | cut -c -3); \
		sed -i s/unknown/$$PHP_VER/g debian/php7-mapi.postinst; \
		sed -i s/unknown/$$PHP_VER/g debian/php7-mapi.postrm; \
		sed -i s/unknown/$$PHP_VER/g debian/php7-mapi.dirs; \
		sed -i s/unknown/$$PHP_VER/g debian/php7-mapi.triggers; \
		echo php:Depends=phpapi-$(shell /usr/bin/php-config --phpapi) > debian/php7-mapi.substvars; \
	fi

override_dh_auto_install:
	dh_auto_install -- -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

	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