1 | #!/usr/bin/make -f |
---|
2 | # |
---|
3 | # Finally switching to debhelper. |
---|
4 | # |
---|
5 | # Not using debhelper was an exercise suggested to me by my AM (Gergely |
---|
6 | # Nagy). It was educating at the time but I finally decided that the |
---|
7 | # exercise is over now. |
---|
8 | # |
---|
9 | |
---|
10 | # Include the bitlbee-libpurple variant and OTR plugin by default. |
---|
11 | BITLBEE_LIBPURPLE ?= 1 |
---|
12 | BITLBEE_OTR ?= plugin |
---|
13 | BITLBEE_CONFIGURE_FLAGS ?= |
---|
14 | DEBUG ?= 0 |
---|
15 | |
---|
16 | ifndef BITLBEE_VERSION |
---|
17 | # Want to use the full package version number instead of just the release. |
---|
18 | BITLBEE_CONFIGURE_VERSION ?= BITLBEE_VERSION="$(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')" |
---|
19 | endif |
---|
20 | |
---|
21 | ifneq ($(BITLBEE_LIBPURPLE),1) |
---|
22 | DH_OPTIONS += -Nbitlbee-libpurple |
---|
23 | endif |
---|
24 | |
---|
25 | ifneq ($(BITLBEE_OTR),plugin) |
---|
26 | DH_OPTIONS += -Nbitlbee-plugin-otr |
---|
27 | endif |
---|
28 | |
---|
29 | CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) |
---|
30 | CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) |
---|
31 | LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) |
---|
32 | |
---|
33 | CONFIGURE_OVERRIDES:=CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" |
---|
34 | |
---|
35 | HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | grep -c "ok installed") |
---|
36 | |
---|
37 | build-arch: build |
---|
38 | |
---|
39 | build: build-stamp |
---|
40 | build-stamp: |
---|
41 | dh_testdir |
---|
42 | |
---|
43 | mkdir -p debian/build-native |
---|
44 | ROOT=$$PWD; cd debian/build-native; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --events=libevent --otr=$(BITLBEE_OTR) --systemdsystemunitdir=/lib/systemd/system --pcdir=/usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig $(BITLBEE_CONFIGURE_FLAGS) |
---|
45 | $(MAKE) -C debian/build-native |
---|
46 | |
---|
47 | ifeq ($(BITLBEE_LIBPURPLE),1) |
---|
48 | mkdir -p debian/build-libpurple |
---|
49 | ROOT=$$PWD; cd debian/build-libpurple; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --systemdsystemunitdir=/lib/systemd/system --pcdir=/usr/lib/${DEB_HOST_MULTIARCH}/pkgconfig --purple=1 $(BITLBEE_CONFIGURE_FLAGS) |
---|
50 | $(MAKE) -C debian/build-libpurple |
---|
51 | endif |
---|
52 | |
---|
53 | $(MAKE) -C doc |
---|
54 | $(MAKE) -C doc/user-guide |
---|
55 | |
---|
56 | touch build-stamp |
---|
57 | |
---|
58 | clean: |
---|
59 | dh_testdir |
---|
60 | dh_testroot |
---|
61 | rm -f build-stamp |
---|
62 | |
---|
63 | rm -rf build-arch-stamp debian/build-* debian/bitlbee-libpurple.prerm |
---|
64 | $(MAKE) distclean |
---|
65 | |
---|
66 | dh_clean |
---|
67 | |
---|
68 | install: build |
---|
69 | dh_testdir |
---|
70 | dh_testroot |
---|
71 | dh_prep |
---|
72 | dh_installdirs |
---|
73 | |
---|
74 | $(MAKE) -C debian/build-native install-bin DESTDIR=`pwd`/debian/bitlbee |
---|
75 | $(MAKE) -C debian/build-native install-etc install-doc DESTDIR=`pwd`/debian/bitlbee-common |
---|
76 | $(MAKE) -C debian/build-native install-dev DESTDIR=`pwd`/debian/bitlbee-dev |
---|
77 | $(MAKE) -C debian/build-native install-plugin-otr DESTDIR=`pwd`/debian/bitlbee-plugin-otr |
---|
78 | |
---|
79 | ifeq ($(HAS_DH_SYSTEMD),1) |
---|
80 | $(MAKE) -C debian/build-native install-systemd DESTDIR=`pwd`/debian/bitlbee-common |
---|
81 | endif |
---|
82 | |
---|
83 | ifeq ($(BITLBEE_LIBPURPLE),1) |
---|
84 | $(MAKE) -C debian/build-libpurple install-bin DESTDIR=`pwd`/debian/bitlbee-libpurple |
---|
85 | ln -sf debian/bitlbee.prerm debian/bitlbee-libpurple.prerm |
---|
86 | endif |
---|
87 | |
---|
88 | patch debian/bitlbee-common/etc/bitlbee/bitlbee.conf debian/patches/bitlbee.conf.diff |
---|
89 | chmod 640 debian/bitlbee-common/etc/bitlbee/bitlbee.conf |
---|
90 | |
---|
91 | binary-common: |
---|
92 | dh_testdir |
---|
93 | dh_testroot |
---|
94 | |
---|
95 | dh_installexamples |
---|
96 | dh_installdocs --link-doc=bitlbee-common |
---|
97 | dh_installchangelogs doc/CHANGES |
---|
98 | dh_installdebconf |
---|
99 | ifeq ($(HAS_DH_SYSTEMD),1) |
---|
100 | dh_systemd_enable -p bitlbee-common --no-enable bitlbee.socket |
---|
101 | dh_systemd_enable -p bitlbee-common bitlbee.service |
---|
102 | dh_installinit -p bitlbee-common --init-script=bitlbee |
---|
103 | dh_systemd_start -p bitlbee-common |
---|
104 | else |
---|
105 | dh_installinit -p bitlbee-common --init-script=bitlbee |
---|
106 | endif |
---|
107 | dh_installman |
---|
108 | dh_lintian |
---|
109 | dh_strip |
---|
110 | dh_link |
---|
111 | dh_compress |
---|
112 | dh_fixperms |
---|
113 | dh_installdeb |
---|
114 | dh_shlibdeps |
---|
115 | dh_gencontrol |
---|
116 | dh_md5sums |
---|
117 | dh_builddeb |
---|
118 | |
---|
119 | binary-arch: build install |
---|
120 | DH_OPTIONS=-a $(MAKE) -f debian/rules binary-common |
---|
121 | |
---|
122 | binary-%: build install |
---|
123 | DH_OPTIONS=-p$* $(MAKE) -f debian/rules binary-common |
---|
124 | |
---|
125 | binary: binary-arch |
---|
126 | .PHONY: build clean binary-arch binary-common binary install |
---|