[19a8088] | 1 | #!/usr/bin/make -f |
---|
[095a5f0] | 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 | # |
---|
[19a8088] | 9 | |
---|
[6c0fe9b] | 10 | # Include the bitlbee-libpurple variant and OTR plugin by default. |
---|
| 11 | # Don't build skype by default since it depends on deleted/non-free |
---|
| 12 | # packages. Need to at least get python-skype back into Debian. |
---|
[d20ea9f] | 13 | BITLBEE_LIBPURPLE ?= 1 |
---|
[27b407f] | 14 | BITLBEE_OTR ?= plugin |
---|
[6c0fe9b] | 15 | BITLBEE_SKYPE ?= 0 |
---|
[b5b40ff] | 16 | BITLBEE_CONFIGURE_FLAGS ?= |
---|
[19a8088] | 17 | DEBUG ?= 0 |
---|
| 18 | |
---|
[4c03881] | 19 | ifndef BITLBEE_VERSION |
---|
[19a8088] | 20 | # Want to use the full package version number instead of just the release. |
---|
[0edb57f] | 21 | BITLBEE_CONFIGURE_VERSION ?= BITLBEE_VERSION="$(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')" |
---|
[379c08a] | 22 | endif |
---|
[19a8088] | 23 | |
---|
[763a3ab] | 24 | ifneq ($(BITLBEE_LIBPURPLE),1) |
---|
| 25 | DH_OPTIONS += -Nbitlbee-libpurple |
---|
| 26 | endif |
---|
| 27 | |
---|
[27b407f] | 28 | ifneq ($(BITLBEE_OTR),plugin) |
---|
| 29 | DH_OPTIONS += -Nbitlbee-plugin-otr |
---|
| 30 | endif |
---|
| 31 | |
---|
[57da960] | 32 | ifneq ($(BITLBEE_SKYPE),plugin) |
---|
| 33 | DH_OPTIONS += -Nbitlbee-plugin-skype -Nskyped |
---|
| 34 | endif |
---|
| 35 | |
---|
[e01ff50] | 36 | CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS) |
---|
| 37 | CFLAGS:=$(shell dpkg-buildflags --get CFLAGS) |
---|
| 38 | LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS) |
---|
| 39 | |
---|
| 40 | CONFIGURE_OVERRIDES:=CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)" |
---|
| 41 | |
---|
[135271c] | 42 | HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | grep -c "ok installed") |
---|
[53cb4ae] | 43 | |
---|
| 44 | # No difference at the build stage so just call main build target. |
---|
| 45 | # (Well indep could be docs-only but we prebuild them plus it's really |
---|
| 46 | # not that much work.) |
---|
| 47 | build-arch build-indep: build |
---|
[135271c] | 48 | |
---|
[095a5f0] | 49 | build: build-stamp |
---|
| 50 | build-stamp: |
---|
| 51 | dh_testdir |
---|
[19a8088] | 52 | |
---|
[4772500] | 53 | mkdir -p debian/build-native |
---|
[e01ff50] | 54 | 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) --skype=$(BITLBEE_SKYPE) $(BITLBEE_CONFIGURE_FLAGS) |
---|
[095a5f0] | 55 | $(MAKE) -C debian/build-native |
---|
[19a8088] | 56 | |
---|
[d20ea9f] | 57 | ifeq ($(BITLBEE_LIBPURPLE),1) |
---|
[4772500] | 58 | mkdir -p debian/build-libpurple |
---|
[e01ff50] | 59 | ROOT=$$PWD; cd debian/build-libpurple; $(BITLBEE_CONFIGURE_VERSION) $(CONFIGURE_OVERRIDES) $$ROOT/configure --debug=$(DEBUG) --prefix=/usr --etcdir=/etc/bitlbee --purple=1 $(BITLBEE_CONFIGURE_FLAGS) |
---|
[095a5f0] | 60 | $(MAKE) -C debian/build-libpurple |
---|
[d20ea9f] | 61 | endif |
---|
[19a8088] | 62 | |
---|
[bc49ec2] | 63 | $(MAKE) -C doc |
---|
[0d8add8a] | 64 | $(MAKE) -C doc/user-guide |
---|
[bc49ec2] | 65 | |
---|
[095a5f0] | 66 | touch build-stamp |
---|
[46d4230] | 67 | |
---|
[095a5f0] | 68 | clean: |
---|
| 69 | dh_testdir |
---|
| 70 | dh_testroot |
---|
| 71 | rm -f build-stamp |
---|
[46d4230] | 72 | |
---|
[5b94e9e] | 73 | rm -rf build-arch-stamp debian/build-* debian/bitlbee-libpurple.prerm |
---|
[095a5f0] | 74 | $(MAKE) distclean |
---|
[46d4230] | 75 | |
---|
[095a5f0] | 76 | dh_clean |
---|
| 77 | |
---|
| 78 | install: build |
---|
| 79 | dh_testdir |
---|
| 80 | dh_testroot |
---|
[e9a3e8c] | 81 | dh_prep |
---|
[095a5f0] | 82 | dh_installdirs |
---|
| 83 | |
---|
[27b407f] | 84 | $(MAKE) -C debian/build-native install-bin DESTDIR=`pwd`/debian/bitlbee |
---|
| 85 | $(MAKE) -C debian/build-native install-etc install-doc DESTDIR=`pwd`/debian/bitlbee-common |
---|
[095a5f0] | 86 | $(MAKE) -C debian/build-native install-dev DESTDIR=`pwd`/debian/bitlbee-dev |
---|
[57da960] | 87 | $(MAKE) -C debian/build-native install-plugin-otr DESTDIR=`pwd`/debian/bitlbee-plugin-otr |
---|
| 88 | $(MAKE) -C debian/build-native install-plugin-skype DESTDIR=`pwd`/debian/skyped |
---|
| 89 | |
---|
[135271c] | 90 | ifeq ($(HAS_DH_SYSTEMD),1) |
---|
| 91 | $(MAKE) -C debian/build-native install-systemd DESTDIR=`pwd`/debian/bitlbee-common |
---|
| 92 | endif |
---|
| 93 | |
---|
[6c0fe9b] | 94 | ifneq ($(BITLBEE_SKYPE),0) |
---|
[57da960] | 95 | mkdir -p debian/bitlbee-plugin-skype/usr |
---|
| 96 | mv debian/skyped/usr/lib debian/bitlbee-plugin-skype/usr |
---|
[d20ea9f] | 97 | |
---|
[e46db53] | 98 | mkdir -p debian/skyped/usr/share/man/man1 |
---|
| 99 | mv debian/bitlbee-common/usr/share/man/man1/skyped* debian/skyped/usr/share/man/man1 |
---|
[6c0fe9b] | 100 | endif |
---|
[e46db53] | 101 | |
---|
[d20ea9f] | 102 | ifeq ($(BITLBEE_LIBPURPLE),1) |
---|
[27b407f] | 103 | $(MAKE) -C debian/build-libpurple install-bin DESTDIR=`pwd`/debian/bitlbee-libpurple |
---|
[5b94e9e] | 104 | ln -sf debian/bitlbee.prerm debian/bitlbee-libpurple.prerm |
---|
[d20ea9f] | 105 | endif |
---|
[095a5f0] | 106 | |
---|
[27b407f] | 107 | patch debian/bitlbee-common/etc/bitlbee/bitlbee.conf debian/patches/bitlbee.conf.diff |
---|
| 108 | chmod 640 debian/bitlbee-common/etc/bitlbee/bitlbee.conf |
---|
[095a5f0] | 109 | |
---|
| 110 | binary-common: |
---|
| 111 | dh_testdir |
---|
| 112 | dh_testroot |
---|
| 113 | |
---|
[4772500] | 114 | dh_installchangelogs doc/CHANGES |
---|
[095a5f0] | 115 | dh_installexamples |
---|
[560d0a0] | 116 | dh_installdocs #--link-doc=bitlbee-common |
---|
| 117 | # TODO: Restore --link-doc up here and remove the hack below once |
---|
| 118 | # Hardy and Lenny are deprecated. |
---|
[27b407f] | 119 | for p in bitlbee bitlbee-libpurple bitlbee-dev bitlbee-plugin-otr; do rm -r debian/$$p/usr/share/doc/$$p && ln -s bitlbee-common debian/$$p/usr/share/doc/$$p || true; done |
---|
[095a5f0] | 120 | dh_installdebconf |
---|
[135271c] | 121 | ifeq ($(HAS_DH_SYSTEMD),1) |
---|
[55bc71e] | 122 | dh_systemd_enable --no-enable bitlbee.socket |
---|
| 123 | dh_systemd_enable bitlbee.service |
---|
[5b94e9e] | 124 | dh_installinit --init-script=bitlbee |
---|
[135271c] | 125 | dh_systemd_start |
---|
| 126 | else |
---|
| 127 | dh_installinit --init-script=bitlbee |
---|
| 128 | endif |
---|
[095a5f0] | 129 | dh_installman |
---|
[6c2b430] | 130 | dh_lintian |
---|
[095a5f0] | 131 | dh_strip |
---|
| 132 | dh_link |
---|
| 133 | dh_compress |
---|
| 134 | dh_fixperms |
---|
| 135 | dh_installdeb |
---|
| 136 | dh_shlibdeps |
---|
[256164c] | 137 | dh_gencontrol |
---|
[095a5f0] | 138 | dh_md5sums |
---|
| 139 | dh_builddeb |
---|
[46d4230] | 140 | |
---|
[095a5f0] | 141 | binary-indep: build install |
---|
[763a3ab] | 142 | DH_OPTIONS=-i $(MAKE) -f debian/rules binary-common |
---|
[46d4230] | 143 | |
---|
[095a5f0] | 144 | binary-arch: build install |
---|
[763a3ab] | 145 | DH_OPTIONS=-a $(MAKE) -f debian/rules binary-common |
---|
[19a8088] | 146 | |
---|
[095a5f0] | 147 | binary-%: build install |
---|
[763a3ab] | 148 | DH_OPTIONS=-p$* $(MAKE) -f debian/rules binary-common |
---|
[19a8088] | 149 | |
---|
[095a5f0] | 150 | binary: binary-indep binary-arch |
---|
| 151 | .PHONY: build clean binary-indep binary-arch binary-common binary install |
---|