summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: a50301593661cdad19442885516c18a9306dbd5f (plain)
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/usr/bin/make -f

ifeq ($(filter noudeb,$(DEB_BUILD_PROFILES)),)
BUILD_UDEB := 1
endif

D   := $(CURDIR)/debian/kmod
DK  := $(CURDIR)/debian/libkmod2
DD  := $(CURDIR)/debian/libkmod-dev
DU  := $(CURDIR)/debian/kmod-udeb
DKU := $(CURDIR)/debian/libkmod2-udeb

CONFFLAGS = \
  --sysconfdir=/etc \
  --libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
  --with-module-directory=/lib/modules \
  --with-rootlibdir=/usr/lib/$(DEB_HOST_MULTIARCH)
CONFFLAGS_deb  = $(CONFFLAGS) \
  $(shell DEB_BUILD_MAINT_OPTIONS="hardening=+bindnow" \
    dpkg-buildflags --export=configure || true) \
  --enable-gtk-doc \
  --with-openssl \
  --with-xz \
  --with-zstd \
  --disable-test-modules \
  --enable-debug
CONFFLAGS_udeb = $(CONFFLAGS) \
  $(subst -O2,-Os -fomit-frame-pointer,$(shell DEB_BUILD_MAINT_OPTIONS="hardening=-all" \
    dpkg-buildflags --export=configure || true)) \
  --with-xz

##############################################################################
include /usr/share/dpkg/architecture.mk

ifdef BUILD_UDEB
  BUILD_UDEB_TARGET := build-udeb/.stamp-build
else
  NO_PACKAGE := --no-package=kmod-udeb --no-package=libkmod2-udeb
endif

##############################################################################
%:
	dh $@ $(NO_PACKAGE)

override_dh_clean:
	rm -rf build-*deb
	dh_clean $$(find m4/ build-aux/ libkmod/ -type l)

libkmod/docs/gtk-doc.make:
	gtkdocize --docdir libkmod/docs

override_dh_autoreconf: libkmod/docs/gtk-doc.make
	dh_autoreconf

build-deb/config.status: configure
	dh_auto_configure --builddir=build-deb -- $(CONFFLAGS_deb)

build-udeb/config.status: configure
	dh_auto_configure --builddir=build-udeb -- $(CONFFLAGS_udeb)

override_dh_auto_configure:

build-deb/.stamp-build: build-deb/config.status
	dh_auto_build --builddir=build-deb
	touch $@

build-udeb/.stamp-build: build-udeb/config.status
	dh_auto_build --builddir=build-udeb
	touch $@

override_dh_auto_build: build-deb/.stamp-build $(BUILD_UDEB_TARGET)

override_dh_auto_test:
ifeq ($(DEB_HOST_ARCH_BITS)$(filter i386,$(DEB_HOST_ARCH_CPU)),32)
	@echo "The test suite has been disabled on non-i386 32 bit architectures."
else
	dh_auto_test --builddir=build-deb
endif

override_dh_auto_install:
	dh_auto_install --builddir=build-deb --destdir=$D
ifdef BUILD_UDEB
	cd build-udeb && $(MAKE) DESTDIR=$(DU) install-binPROGRAMS
endif

override_dh_install:
	rm $D/usr/lib/*/*.la
	dh_movefiles --sourcedir=debian/kmod
	cp debian/extra/aliases.conf $D/usr/lib/modprobe.d/
	install --mode=755 debian/kmod.initramfs-hook \
		$D/usr/share/initramfs-tools/hooks/kmod
	find $D/usr -type d -empty -delete
ifdef BUILD_UDEB
	rm $(DU)/usr/lib/*/*.la $(DU)/usr/lib/*/*.so
	mv $(DU)/usr/lib/*/libkmod.so.* $(DKU)/usr/lib/
	egrep -i '^[a-z]' debian/extra/aliases.conf > $(DU)/etc/modprobe.d/aliases.conf
	find $D/usr -type d -empty -delete
endif

override_dh_installdocs:
	dh_installdocs -pkmod -plibkmod-dev --link-doc=libkmod2
	dh_installdocs -pkmod --link-doc=libkmod2 README.md TODO
	dh_installdocs -plibkmod2
	cp libkmod/README $(DD)/usr/share/doc/libkmod2/README.libkmod

override_dh_installchangelogs:
	dh_installchangelogs NEWS

override_dh_installinit:
	dh_installinit --no-start

override_dh_makeshlibs:
	dh_makeshlibs -V'libkmod2 (>= $(shell perl debian/highest_symbol_version debian/libkmod2.symbols))' -- -c4

override_dh_shlibdeps:
	dh_shlibdeps -- --warnings=7