File debian.rules of Package kopano
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets by Bill Allombert 2001
# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# This has to be exported to make some magic below work.
export DH_OPTIONS
# These are used for cross-compiling and for saving the configure script
# from having to guess our platform (since we know it already)
DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
INSTDIR=$(CURDIR)/debian/tmp
SMARTYVER=2.6.14
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFFLAG = ""
else
CONFFLAG = "--enable-release"
endif
tversion := $(shell tar --version | head -1 | cut -f4 -d\ | head -c 4)
ifeq "$(tversion)" "1.14"
tstrip := --strip-path
else
tstrip := --strip-components
endif
configure: config.status
config.status:
dh_testdir
dpkg-parsechangelog | perl -lne 'if(/^Version: \d+\D+\d+\D+\d+\D+(\d+)/){print$$1;exit}' >revision
cat revision
./bootstrap.sh
./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
--with-distro=debian --prefix=/usr --localstatedir=/var \
--sysconfdir=/etc --mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--with-systemunitdir=/lib/systemd/system \
--with-userscript-prefix=/etc/kopano/userscripts \
--with-quotatemplate-prefix=/etc/kopano/quotamail \
--enable-tcmalloc TCMALLOC_CFLAGS=" " \
TCMALLOC_LIBS="-ltcmalloc_minimal" --enable-epoll \
--enable-unicode $(CONFFLAG) \
--enable-release
# first entry point of dpkg-buildpackage
clean:
dh_testdir
dh_testroot
rm -f build-arch-stamp build-indep-stamp #CONFIGURE-STAMP#
# Add here commands to clean up after the build process.
-$(MAKE) distclean
dh_clean
# second entry point of dpkg-buildpackage
build: build-arch build-indep
build-arch: build-arch-stamp
build-arch-stamp: config.status
# Add here commands to compile the arch part of the package.
# compile kopano
$(MAKE) -j4 V=1
cat common/include/kopano/ecversion.h
touch build-arch-stamp
build-indep: build-indep-stamp
build-indep-stamp: config.status
# Add here commands to compile the indep part of the package.
touch build-indep-stamp
# no install entry point
install-indep:
dh_testdir
dh_testroot
dh_clean -k -i
# Add here commands to install the indep part of the package into
# debian/<package>-doc.
#INSTALLDOC#
# because of the dh_clean and kopano-archiver-extra being arch independant, we need to install these files again
$(MAKE) DESTDIR=$(INSTDIR) install -C swig/python/kopano
$(MAKE) DESTDIR=$(INSTDIR) install -C swig/python/zarafa
$(MAKE) DESTDIR=$(INSTDIR) install -C po
$(MAKE) DESTDIR=$(INSTDIR) install-man1
$(MAKE) DESTDIR=$(INSTDIR) install-man8
# and remove non za-sync files
rm -f $(INSTDIR)/usr/share/man/man1/kopano*
dh_install -i --sourcedir=debian/tmp
install-arch:
dh_testdir
dh_testroot
dh_clean -k -s
# Add here commands to install the arch part of the package into
# debian/tmp.
$(MAKE) DESTDIR=$(INSTDIR) install PHP_SYSCONF_DIR=/usr/share/kopano/php/mapi
mkdir -p ${INSTDIR}/etc/kopano/autorespond
cp -av ${INSTDIR}/usr/share/doc/kopano/example-config/*.cfg ${INSTDIR}/etc/kopano/
rm -fv ${INSTDIR}/etc/kopano/ldap.cfg
# since this is not linked to an initscript anymore, install the file ourselves.
mkdir -p $(INSTDIR)/etc/default
install -o root -g root -m 644 debian/kopano-common.kopano.default $(INSTDIR)/etc/default/kopano
# link userscripts in /usr/share/kopano/userscripts
mkdir -p $(INSTDIR)/usr/share/kopano/userscripts
for file in `find $(INSTDIR)/etc/kopano/userscripts -maxdepth 1 -type f`; do \
mv -v $$file $(INSTDIR)/usr/share/kopano/userscripts; \
ln -sfv /usr/share/kopano/userscripts/`basename $$file` $$file; \
done
# move example-config files
for package in spooler gateway monitor dagent ical search archiver; do \
mkdir -p $(INSTDIR)/usr/share/doc/kopano-$$package/example-config; \
mv -v $(INSTDIR)/usr/share/doc/kopano/example-config/$$package.cfg $(INSTDIR)/usr/share/doc/kopano-$$package/example-config; \
done
mv -v $(INSTDIR)/usr/share/doc/kopano/example-config/autorespond $(INSTDIR)/usr/share/doc/kopano-dagent/example-config
mkdir -p $(INSTDIR)/usr/share/doc/kopano-multiserver/example-config
# generate openssl link
CADIR="$(INSTDIR)/etc/kopano/report-ca"; \
if [ -d "$$CADIR" ]; then for c in $$CADIR/*; do \
ln -sfv `basename $$c` $$CADIR/`openssl x509 -in $$c -noout -hash`.0; \
done; fi
# remove compiled python files
find $(INSTDIR) -name \*.pyc -delete
# php version
if [ -x /usr/bin/php-config ]; then \
PHP_MAPI="php$(shell php-config --version | cut -c 1)-mapi"; \
sed -i s/php-mapi/$$PHP_MAPI/g debian/control; \
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; \
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
# Build architecture independant packages using the common target.
binary-indep: install-indep
dh_testdir -i
dh_testroot -i
dh_installdirs -i
# dh_movefiles -i
# installs NEWS files
dh_installchangelogs -i
dh_installdocs -i
dh_compress -i
dh_fixperms
dh_python2 --no-guessing-versions
dh_installdeb -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
# Build architecture dependant packages using the common target.
binary-arch-real: install-arch
dh_testdir
dh_testroot
# install empty paths not present in 'make install' from <packagename>.dirs file, in actual package directory, not in tmp.
dh_installdirs
dh_install --sourcedir=debian/tmp
dh_installchangelogs
dh_installdocs
# dh_installexamples
# dh_installmenu
# dh_installdebconf
# dh_installlogrotate
# dh_installemacsen
# dh_installpam
# dh_installmime
cp -pv ${CURDIR}/installer/linux/kopano-dagent.init.debi ${CURDIR}/debian/kopano-dagent.kopano-dagent.init
cp -pv ${CURDIR}/installer/linux/kopano-gateway.init.debi ${CURDIR}/debian/kopano-gateway.kopano-gateway.init
cp -pv ${CURDIR}/installer/linux/kopano-ical.init.debi ${CURDIR}/debian/kopano-ical.kopano-ical.init
cp -pv ${CURDIR}/installer/linux/kopano-monitor.init.debi ${CURDIR}/debian/kopano-monitor.kopano-monitor.init
cp -pv ${CURDIR}/installer/linux/kopano-presence.init.debi ${CURDIR}/debian/kopano-presence.kopano-presence.init
cp -pv ${CURDIR}/installer/linux/kopano-search.init.debi ${CURDIR}/debian/kopano-search.kopano-search.init
cp -pv ${CURDIR}/installer/linux/kopano-server.init.debi ${CURDIR}/debian/kopano-server.kopano-server.init
cp -pv ${CURDIR}/installer/linux/kopano-spooler.init.debi ${CURDIR}/debian/kopano-spooler.kopano-spooler.init
dh_installinit -R --name kopano-dagent
dh_installinit -R --name kopano-gateway
dh_installinit -R --name kopano-ical
dh_installinit -R --name kopano-monitor
dh_installinit -R --name kopano-presence
dh_installinit -R --name kopano-search
dh_installinit -R --name kopano-server
dh_installinit -R --name kopano-spooler
# dh_installcron
# dh_installinfo
# dh_installman
dh_link
dh_strip --dbg-package=kopano-dbg
dh_compress -X.py -X.pl -Xusr/share/doc/kopano/kopano7-upgrade
dh_fixperms
# dh_perl
# dh_python
# dh_pysupport
dh_python2 --no-guessing-versions
dh_makeshlibs
dh_installdeb
dh_shlibdeps
dh_gencontrol
dh_md5sums
dh_builddeb
# last entry point of dpkg-buildpackage
# but the ubuntu buildsystem may call 'binary-arch' insteadof 'binary' target as entry point
binary-arch: binary
binary:
# make sure these do not run concurrent
$(MAKE) -f debian/rules DH_OPTIONS=-a binary-arch-real
$(MAKE) -f debian/rules DH_OPTIONS=-i binary-indep
.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch