source: debian/rules @ 537d9b9

Last change on this file since 537d9b9 was 135271c, checked in by dequis <dx@…>, at 2016-06-12T08:34:56Z

debian: install systemd units and use dh_systemd

I'm using the debhelper version (9.20131227) to avoid depending on
dh_systemd for debian wheezy and ubuntu precise. If it's older than
that, it's probably a distro without dh_systemd.

  • Property mode set to 100755
File size: 4.3 KB
Line 
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# 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.
13BITLBEE_LIBPURPLE ?= 1
14BITLBEE_OTR ?= plugin
15BITLBEE_SKYPE ?= 0
16BITLBEE_CONFIGURE_FLAGS ?=
17DEBUG ?= 0
18
19ifndef BITLBEE_VERSION
20# Want to use the full package version number instead of just the release.
21BITLBEE_CONFIGURE_VERSION ?= BITLBEE_VERSION="$(shell dpkg-parsechangelog | awk '/^Version:/ {print $$2}')"
22endif
23
24ifneq ($(BITLBEE_LIBPURPLE),1)
25DH_OPTIONS += -Nbitlbee-libpurple
26endif
27
28ifneq ($(BITLBEE_OTR),plugin)
29DH_OPTIONS += -Nbitlbee-plugin-otr
30endif
31
32ifneq ($(BITLBEE_SKYPE),plugin)
33DH_OPTIONS += -Nbitlbee-plugin-skype -Nskyped
34endif
35
36CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
37CFLAGS:=$(shell dpkg-buildflags --get CFLAGS)
38LDFLAGS:=$(shell dpkg-buildflags --get LDFLAGS)
39
40CONFIGURE_OVERRIDES:=CPPFLAGS="$(CPPFLAGS)" CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"
41
42HAS_DH_SYSTEMD:=$(shell dpkg-query -W -f='$${Status}' dh-systemd 2>/dev/null | grep -c "ok installed")
43
44build: build-stamp
45build-stamp:
46        dh_testdir
47
48        mkdir -p debian/build-native
49        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)
50        $(MAKE) -C debian/build-native
51
52ifeq ($(BITLBEE_LIBPURPLE),1)
53        mkdir -p debian/build-libpurple
54        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)
55        $(MAKE) -C debian/build-libpurple
56endif
57
58        $(MAKE) -C doc
59        $(MAKE) -C doc/user-guide
60
61        touch build-stamp
62
63clean:
64        dh_testdir
65        dh_testroot
66        rm -f build-stamp
67
68        rm -rf build-arch-stamp debian/build-* debian/bitlbee-libpurple.prerm
69        $(MAKE) distclean
70
71        dh_clean
72
73install: build
74        dh_testdir
75        dh_testroot
76        dh_prep
77        dh_installdirs
78
79        $(MAKE) -C debian/build-native install-bin DESTDIR=`pwd`/debian/bitlbee
80        $(MAKE) -C debian/build-native install-etc install-doc DESTDIR=`pwd`/debian/bitlbee-common
81        $(MAKE) -C debian/build-native install-dev DESTDIR=`pwd`/debian/bitlbee-dev
82        $(MAKE) -C debian/build-native install-plugin-otr DESTDIR=`pwd`/debian/bitlbee-plugin-otr
83        $(MAKE) -C debian/build-native install-plugin-skype DESTDIR=`pwd`/debian/skyped
84
85ifeq ($(HAS_DH_SYSTEMD),1)
86        $(MAKE) -C debian/build-native install-systemd DESTDIR=`pwd`/debian/bitlbee-common
87endif
88
89ifneq ($(BITLBEE_SKYPE),0)
90        mkdir -p debian/bitlbee-plugin-skype/usr
91        mv debian/skyped/usr/lib debian/bitlbee-plugin-skype/usr
92
93        mkdir -p debian/skyped/usr/share/man/man1
94        mv debian/bitlbee-common/usr/share/man/man1/skyped* debian/skyped/usr/share/man/man1
95endif
96
97ifeq ($(BITLBEE_LIBPURPLE),1)
98        $(MAKE) -C debian/build-libpurple install-bin DESTDIR=`pwd`/debian/bitlbee-libpurple
99        ln -sf debian/bitlbee.prerm debian/bitlbee-libpurple.prerm
100endif
101
102        patch debian/bitlbee-common/etc/bitlbee/bitlbee.conf debian/patches/bitlbee.conf.diff
103        chmod 640 debian/bitlbee-common/etc/bitlbee/bitlbee.conf
104
105binary-common:
106        dh_testdir
107        dh_testroot
108
109        dh_installchangelogs doc/CHANGES
110        dh_installexamples
111        dh_installdocs #--link-doc=bitlbee-common
112        # TODO: Restore --link-doc up here and remove the hack below once
113        # Hardy and Lenny are deprecated.
114        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
115        dh_installdebconf
116ifeq ($(HAS_DH_SYSTEMD),1)
117        dh_systemd_enable
118        dh_installinit --init-script=bitlbee
119        dh_systemd_start
120else
121        dh_installinit --init-script=bitlbee
122endif
123        dh_installman
124        dh_lintian
125        dh_strip
126        dh_link
127        dh_compress
128        dh_fixperms
129        dh_installdeb
130        dh_shlibdeps
131        dh_gencontrol
132        dh_md5sums
133        dh_builddeb
134
135binary-indep: build install
136        DH_OPTIONS=-i $(MAKE) -f debian/rules binary-common
137
138binary-arch: build install
139        DH_OPTIONS=-a $(MAKE) -f debian/rules binary-common
140
141binary-%: build install
142        DH_OPTIONS=-p$* $(MAKE) -f debian/rules binary-common
143
144binary: binary-indep binary-arch
145.PHONY: build clean binary-indep binary-arch binary-common binary install
Note: See TracBrowser for help on using the repository browser.