summaryrefslogtreecommitdiff
path: root/zfsutils/debian/rules
blob: d11e29469ea22bba47a1f70116b6c12e822a3b32 (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
118
119
120
121
122
123
124
125
126
127
#!/usr/bin/make -f

export DH_VERBOSE = 1

# libdiskmgt needs libzfs for data structures and dlopen()
# zpool is linked to libdiskmgt.
# zfsutils seems to be the only consumer of libdiskmgt
# (other is fdisk), so we build libdiskmgt here.
libs_headers := \
	libzfs_core \
	libzfs \
	libdiskmgt \
	libzpool

libs := \
	$(libs_headers)

cmd := \
	zpool \
	ztest \
	zinject \
	zdb \
	zfs

unpack: unpack-stamp
unpack-stamp:
	dh_testdir
	dh_illumos_gate --build \
		$(cmd:%=usr/src/cmd/%) \
		$(libs:%=usr/src/lib/%) \
		usr/src/common/zfs/\* \
		usr/src/lib/fm/topo/libtopo/common/libtopo.h \
		usr/src/lib/libshare/common/libshare.h \
		usr/src/uts/common/sys/fs/zfs.h \
		usr/src/uts/common/sys/fm/fs/zfs.h \
		usr/src/uts/common/Makefile.files \
		usr/src/uts/common/fs/zfs \
		usr/src/lib/libadm/common/rdwr_vtoc.c \
		usr/src/lib/libadm/common/fulldevnm.c \
		usr/src/common/list/list.c
	# Buggy and unused:
	echo > usr/src/Makefile.msg.targ
	touch $@

patch: patch-stamp
patch-stamp: unpack-stamp
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt push -a || test $$? = 2
	touch $@

unpatch:
	dh_testdir
	[ ! -f debian/patches/series ] || QUILT_PATCHES=debian/patches quilt pop -a -f || test $$? = 2
	rm -f patch-stamp

dirs-stamp: unpack-stamp
	. usr/env.sh; mkdir -p \
		debian/tmp/usr/include \
		debian/tmp/usr/include/fm \
		debian/tmp/usr/include/sys \
		debian/tmp/usr/include/sys/fm \
		debian/tmp/usr/include/sys/fm/fs \
		debian/tmp/usr/include/sys/fs \
		debian/tmp$$DEB_LIBDIR_32 \
		debian/tmp$$DEB_LIBDIR_64 \
		debian/tmp$$DEB_USRLIBDIR_32 \
		debian/tmp$$DEB_USRLIBDIR_64 \
		debian/tmp/usr/bin \
		debian/tmp/usr/sbin
	touch $@

mapfiles-stamp: patch-stamp
	dh_illumos_make usr/src/common/mapfiles
	touch $@

headers-stamp: patch-stamp dirs-stamp
	dh_illumos_make $(libs_headers:%=usr/src/lib/%) -t install_h
	cp usr/src/uts/common/sys/fs/zfs.h debian/tmp/usr/include/sys/fs/
	# Only macros:
	cp usr/src/uts/common/sys/fm/fs/zfs.h \
		debian/tmp/usr/include/sys/fm/fs
	# Only error codes:
	cp usr/src/lib/libshare/common/libshare.h debian/tmp/usr/include/
	# For dlopen(), fuck!
	cp usr/src/lib/fm/topo/libtopo/common/libtopo.h \
		debian/tmp/usr/include/fm/
	touch $@

cmd-stamp: lib-stamp dirs-stamp mapfiles-stamp headers-stamp patch-stamp
	dh_illumos_make --native $(cmd:%=usr/src/cmd/%)
	touch $@

lib-stamp: dirs-stamp mapfiles-stamp headers-stamp patch-stamp
	dh_illumos_make $(libs:%=usr/src/lib/%)
	touch $@

install build build-arch build-indep: build-stamp
build-stamp: lib-stamp cmd-stamp
	touch $@

binary binary-arch binary-indep: binary-stamp
binary-stamp: build-stamp
	dh_testdir
	dh_testroot
	dh_installdirs
	dh_install
	dh_installman
	dh_installdocs
	dh_installexamples
	dh_installchangelogs
	dh_link
	dh_compress
	dh_fixperms
	dh_makeshlibs -- -c4
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb
	touch $@

clean: unpatch
	dh_testdir
	dh_testroot
	dh_clean
	rm -rf usr