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
128
129
130
131
132
|
#!/usr/bin/make -f
# -*- makefile -*-
DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
LIBDIR = usr/lib/$(DEB_HOST_MULTIARCH)
LIBEXECDIR = $(LIBDIR)/schroot
ifneq ($(DEB_HOST_ARCH_OS),linux)
LVMSNAP_OPTIONS = -Dlvm-snapshot=OFF
BTRFSSNAP_OPTIONS = -Dbtrfs-snapshot=OFF
else
LVMSNAP_OPTIONS = -Dlvm-snapshot=ON
BTRFSSNAP_OPTIONS = -Dbtrfs-snapshot=ON
endif
CFLAGS = -Wall -g
ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
CFLAGS += -O0
else
CFLAGS += -O2
endif
DH_OPTIONS = --buildsystem=cmake --builddirectory=debian/build --parallel
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
MAKEFLAGS += -j$(NUMJOBS)
endif
DH_INSTALL_FILES = $(basename $(wildcard debian/*.install.in))
# Use debhelper's dh
%:
dh $@ $(DH_OPTIONS)
%.install: %.install.in
sed -e 's;@LIBDIR@;$(LIBDIR);g' -e 's;@LIBEXECDIR@;$(LIBEXECDIR);g' <$< >$@
override_dh_auto_configure: debian/build/CMakeCache.txt
debian/build/gtest/libgtest.a:
mkdir -p $(dir $@)
cd $(dir $@) ; \
CXX="g++ -std=c++11" cmake /usr/src/gtest ; \
$(MAKE) VERBOSE=1
debian/build/CMakeCache.txt: CMakeLists.txt debian/build/gtest/libgtest.a
mkdir -p $(dir $@)
cd $(dir $@) ; \
CXX="g++ -std=c++11" \
GTEST_ROOT="$(CURDIR)/debian/build/gtest" \
cmake -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_LOCALSTATEDIR=/var \
-DCMAKE_INSTALL_LIBEXECDIR=lib \
-DSCHROOT_LIBEXEC_DIR=/$(LIBDIR)/schroot \
-Ddebug=OFF -Ddchroot=ON -Ddchroot-dsa=ON \
-Dbash_completion_dir=/etc/bash_completion.d \
$(LVMSNAP_OPTIONS) $(BTRFSSNAP_OPTIONS) \
-DBTRFS_EXECUTABLE=/sbin/btrfs \
-DLVCREATE_EXECUTABLE=/sbin/lvcreate \
-DLVREMOVE_EXECUTABLE=/sbin/lvremove \
$(CURDIR)
dh_testdir
override_dh_auto_clean:
dh_auto_clean
rm -f $(DH_INSTALL_FILES)
rm -rf debian/build
rm -rf debian/install
override_dh_auto_build:
ifneq (,$(shell dh_listpackages -a 2>/dev/null))
$(MAKE) -C debian/build all VERBOSE=1
endif
ifneq (,$(shell dh_listpackages -i 2>/dev/null))
$(MAKE) -C debian/build doc VERBOSE=1
endif
override_dh_auto_test:
install-arch: build-arch $(DH_INSTALL_FILES)
dh $@ $(DH_OPTIONS)
# Setuid executables
chmod 4755 $(CURDIR)/debian/dchroot/usr/bin/dchroot
chmod 4755 $(CURDIR)/debian/dchroot-dsa/usr/bin/dchroot-dsa
chmod 4755 $(CURDIR)/debian/schroot/usr/bin/schroot
# Lintian overrides
mkdir -p $(CURDIR)/debian/dchroot/usr/share/lintian/overrides
cp $(CURDIR)/debian/dchroot.lintian-overrides $(CURDIR)/debian/dchroot/usr/share/lintian/overrides/dchroot
mkdir -p $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides
cp $(CURDIR)/debian/dchroot-dsa.lintian-overrides $(CURDIR)/debian/dchroot-dsa/usr/share/lintian/overrides/dchroot-dsa
mkdir -p $(CURDIR)/debian/schroot/usr/share/lintian/overrides
cp $(CURDIR)/debian/schroot.lintian-overrides $(CURDIR)/debian/schroot/usr/share/lintian/overrides/schroot
# Documentation symlinks
rm -rf $(CURDIR)/debian/dchroot/usr/share/doc/dchroot
ln -sf schroot $(CURDIR)/debian/dchroot/usr/share/doc/dchroot
rm -rf $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa
ln -sf schroot $(CURDIR)/debian/dchroot-dsa/usr/share/doc/dchroot-dsa
# Requires fakeroot, so tests need running here.
$(MAKE) -C debian/build test ARGS=-V
install-indep: build-indep $(DH_INSTALL_FILES)
dh $@ $(DH_OPTIONS)
# Remove cruft
find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.map' -print0 | xargs -0 rm -f
find $(CURDIR)/debian/libsbuild-doc/usr/share/doc/libsbuild-doc -name '*.md5' -print0 | xargs -0 rm -f
install: build $(DH_INSTALL_FILES)
dh $@ $(DH_OPTIONS)
override_dh_auto_install:
ifneq (,$(shell dh_listpackages -a 2>/dev/null))
$(MAKE) -C debian/build install DESTDIR=$(CURDIR)/debian/install PO4A=
endif
ifneq (,$(shell dh_listpackages -i 2>/dev/null))
$(MAKE) -C debian/build/po install DESTDIR=$(CURDIR)/debian/install PO4A=
endif
override_dh_installchangelogs:
dh_installchangelogs ChangeLog
override_dh_installinit:
dh_installinit --no-start --update-rcd-params='defaults'
override_dh_strip:
dh_strip --dbg-package=libsbuild-1.7.1-dbg
.PHONY: override_dh_auto_configure override_dh_auto_clean override_dh_auto_build override_dh_auto_test override_dh_auto_install override_dh_installchangelogs override_dh_installinit override_dh_strip install-arch install-indep
|