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