File: rules

package info (click to toggle)
ejabberd 18.12.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 11,248 kB
  • sloc: erlang: 85,374; sql: 2,416; sh: 2,195; perl: 845; xml: 385; makefile: 329; python: 44
file content (101 lines) | stat: -rwxr-xr-x 3,550 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

DESTDIR=$(CURDIR)/debian/ejabberd


%:
	dh $@


.PHONY: override_dh_auto_configure
override_dh_auto_configure:
	mkdir $(CURDIR)/deps && touch $(CURDIR)/deps/.got $(CURDIR)/deps/.built
	sed -i 's/$(DEB_VERSION_UPSTREAM)/$(DEB_VERSION_UPSTREAM_REVISION)/' configure
	dh_auto_configure -- \
		--enable-iconv \
		--enable-mysql \
		--enable-odbc \
		--enable-pam \
		--enable-pgsql \
		--enable-redis \
		--enable-sip \
		--enable-sqlite \
		--enable-stun \
		--enable-zlib

.PHONY: override_dh_auto_install
override_dh_auto_install:
	dh_auto_install
	
	# symlink version
	ln -s ejabberd-$(DEB_VERSION_UPSTREAM_REVISION) $(DESTDIR)/usr/lib/$(DEB_TARGET_MULTIARCH)/ejabberd-$(DEB_VERSION_UPSTREAM)
	
	# install init script and service file
	install -m 755 $(CURDIR)/ejabberd.init $(CURDIR)/debian/
	install -m 644 $(CURDIR)/ejabberd.service.template $(CURDIR)/debian/ejabberd.service
	
	# ejabberd.yml is generated from the template through debconf and installed as /etc/ejabberd/ejabberd.yml
	rm $(DESTDIR)/etc/ejabberd/ejabberd.yml
	install -m 644 ejabberd.yml.example $(DESTDIR)/usr/share/ejabberd/ejabberd.yml.example
	
	# ejabberdctl.cfg is generated from the template through debconf and installed as /etc/default/ejabberd
	rm $(DESTDIR)/etc/ejabberd/ejabberdctl.cfg
	install -m 644 ejabberdctl.cfg.example $(DESTDIR)/usr/share/ejabberd/ejabberdctl.cfg.example
	
	# set up /etc/ejabberd/modules.d
	cp -v $(CURDIR)/debian/README.modules $(DESTDIR)/etc/ejabberd/modules.d/
	
	# move captcha.sh to /usr/share/ejabberd
	rm $(DESTDIR)/usr/lib/$(DEB_TARGET_MULTIARCH)/ejabberd-$(DEB_VERSION_UPSTREAM_REVISION)/priv/bin/captcha.sh
	rmdir $(DESTDIR)/usr/lib/$(DEB_TARGET_MULTIARCH)/ejabberd-$(DEB_VERSION_UPSTREAM_REVISION)/priv/bin
	install -m 755 tools/captcha.sh $(DESTDIR)/usr/share/ejabberd/
	
	# move image files to /usr/share/ejabberd/img
	mv -v $(DESTDIR)/usr/lib/$(DEB_TARGET_MULTIARCH)/ejabberd-$(DEB_VERSION_UPSTREAM_REVISION)/priv/img $(DESTDIR)/usr/share/ejabberd/img
	ln -s ../../../../share/ejabberd/img $(DESTDIR)/usr/lib/$(DEB_TARGET_MULTIARCH)/ejabberd-$(DEB_VERSION_UPSTREAM_REVISION)/priv/img
	
	# install sql code
	cp -vr sql $(DESTDIR)/usr/share/ejabberd/
	
	# install ufw profile
	install -m 644 debian/ejabberd.ufw.profile $(DESTDIR)/etc/ufw/applications.d/ejabberd
	
	# install AppArmor profile
	install -m 644 debian/usr.sbin.ejabberdctl $(DESTDIR)/etc/apparmor.d/usr.sbin.ejabberdctl
	dh_apparmor --profile-name=usr.sbin.ejabberdctl

.PHONY: override_dh_installinit
override_dh_installinit:
	dh_installinit -vR

.PHONY: override_dh_systemd_start
override_dh_installsystemd:
	dh_installsystemd --restart-after-upgrade

.PHONY: override_dh_compress
override_dh_compress:
	dh_compress --exclude=ejabberd.yml

.PHONY: override_dh_auto_test
override_dh_auto_test:

.PHONY: override_dh_installdeb
override_dh_installdeb:
	erlang-depends
	rm -rf $(DESTDIR)/var/lock $(DESTDIR)/usr/bin
	find $(DESTDIR)/usr/ -name COPYING -delete
	find $(DESTDIR)/usr/ -name COPYING.gz -delete
	dh_installdeb

.PHONY: override_dh_auto_clean
override_dh_auto_clean:
	rm -f Makefile config.log config.status vars.config priv/sql
	rm -rf .rebar deps ebin src/XmppAddr.asn1db src/XmppAddr.erl src/eldap_filter_yecc.erl src/ejabberd.app.src
	rm -f debian/ejabberd.init debian/ejabberd.service ejabberd.init ejabberdctl.example ejabberd.service
	sed -i 's/$(DEB_VERSION_UPSTREAM_REVISION)/$(DEB_VERSION_UPSTREAM)/' configure
	dh_auto_clean
	debconf-updatepo