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
|
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk
# getting DEB_VERSION from helper without manually parsing the changlog file
include /usr/share/dpkg/pkg-info.mk
DEB_BUILD_DIR=debian/build
INSTDIR=$(CURDIR)/debian/tmp
PHP_API_DATE=$(shell php-config --phpapi)
PHP_VERSION=$(shell echo $$(readlink -f /usr/bin/php-config) | sed 's/\/usr\/bin\/php-config//g')
PREPROCESS_FILES := $(wildcard debian/*.in)
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CONFFLAG = ""
else
CONFFLAG = "--enable-release"
endif
DEB_CONFIGURE_EXTRA_ARGS := \
--host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr \
--localstatedir=/var \
--sysconfdir=/etc \
--with-systemunitdir=/usr/lib/systemd/system \
--mandir=\$${prefix}/share/man \
--infodir=\$${prefix}/share/info \
--with-php-config=/usr/bin/php-config \
--with-quotatemplate-prefix=/etc/kopano/quotamail \
--disable-static \
--enable-epoll \
--with-distro=debian \
--enable-python \
PYTHON="python3" \
$(CONFFLAG) \
$(NULL)
$(PREPROCESS_FILES:.in=): %: %.in
sed -e 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH:%=%)/g' \
-e 's/@PHP_VERSION@/$(PHP_VERSION:%=%)/g' \
$< > $@
%:
dh $@ --builddirectory=$(DEB_BUILD_DIR) --with php,python3
override_dh_auto_configure: $(PREPROCESS_FILES:.in=)
echo ${DEB_VERSION} > $(CURDIR)/revision
[ -x ./bootstrap.sh ] && ./bootstrap.sh || true
dh_auto_configure -- $(DEB_CONFIGURE_EXTRA_ARGS)
override_dh_auto_clean:
rm -rf $(DEB_BUILD_DIR)
rm -f revision
[ ! -f Makefile ] || dh_auto_clean
override_dh_install:
# Install docs
$(MAKE) DESTDIR=$(INSTDIR) install -C $(DEB_BUILD_DIR)/swig/python/kopano
# Don't ship any .la files
find $(INSTDIR) -name '*.la' | xargs rm
# Make sure docs end up in kopano-server
mv $(INSTDIR)/usr/share/doc/kopano $(INSTDIR)/usr/share/doc/kopano-server
# 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
# dbconfig-common
mkdir -p $(INSTDIR)/usr/share/kopano/debian
cp -a debian/sql/debian-db.cfg.template $(INSTDIR)/usr/share/kopano/debian
# remove compiled python files
find $(INSTDIR) -name \*.pyc -exec rm {} \;
mv debian/tmp/usr/share/doc/kopano-server/example-config/*.cfg \
debian/tmp/usr/share/doc/kopano-server/example-config/autorespond \
debian/tmp/etc/kopano/
dh_install
# remove obsolete zarafa Python things
rm -rf debian/tmp/usr/lib/python3/dist-packages/zarafa*
for p in server dagent search; do \
dh_apparmor --profile-name=usr.sbin.kopano-$${p} -pkopano-$${p}; \
done
# Don't ship upstream's profiles as example-config
rm -r debian/tmp/usr/share/doc/kopano-server/example-config/apparmor.d/
# Use upstream version
rm debian/tmp/usr/lib/python3/dist-packages/kopano/lockfile.py
override_dh_installinit:
dh_installinit --name kopano-dagent
dh_installinit --name kopano-gateway
dh_installinit --name kopano-ical
dh_installinit --name kopano-monitor
dh_installinit --name kopano-presence
dh_installinit --name kopano-search
dh_installinit --name kopano-server
dh_installinit --name kopano-spooler
override_dh_compress:
dh_compress -X.py -X.pl
override_dh_makeshlibs:
dh_makeshlibs -O--builddirectory=$(DEB_BUILD_DIR) -O--parallel \
-Xdbplugin \
-Xldapplugin \
-Xlibkcclient \
-Xlibkccontacts \
-Xunixplugin
override_dh_shlibdeps:
dh_shlibdeps -a -l $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/kopano \
-l $(CURDIR)/debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)
|