File: rules

package info (click to toggle)
dewalls 1.0.0+ds1-7
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 700 kB
  • sloc: cpp: 6,459; makefile: 52
file content (70 lines) | stat: -rwxr-xr-x 2,707 bytes parent folder | download
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
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#DH_VERBOSE = 1

LOGLEVEL = info
ifeq ($(DH_VERBOSE),1)
  LOGLEVEL = debug
endif
ifneq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
  LOGLEVEL = warning
endif

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
include /usr/share/dpkg/architecture.mk

%:
	dh $@

# Note that the dpkg-buildflags settings are currently static. We await a
# mechanism to convert them dynamically into Qbs-speak

override_dh_auto_configure:
	qbs-setup-toolchains --settings-dir /tmp --detect
	QT_SELECT=5 qbs-setup-qt --settings-dir /tmp /usr/bin/qmake deb
	# choose gcc as if clang is installed too you have to pick one
	qbs config --settings-dir /tmp profiles.deb.baseProfile gcc
	qbs config --settings-dir /tmp profiles.deb.qbs.installPrefix 'usr/'
	qbs config --settings-dir /tmp profiles.deb.cpp.debugInformation true
ifneq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
	qbs config --settings-dir /tmp profiles.deb.cpp.optimization none
else
	qbs config --settings-dir /tmp profiles.deb.cpp.optimization fast
endif
	qbs config --settings-dir /tmp profiles.deb.cpp.commonCompilerFlags -Wdate-time
	qbs config --settings-dir /tmp profiles.deb.cpp.defines '"FORTIFY_SOURCE=2"'
	qbs config --settings-dir /tmp profiles.deb.cpp.cFlags '[ "-fdebug-prefix-map=$(CURDIR)=.", "-fstack-protector-strong", "-Wformat", "-Werror=format-security" ]'
	qbs config --settings-dir /tmp profiles.deb.cpp.cxxFlags '[ "-fdebug-prefix-map=$(CURDIR)=.", "-fstack-protector-strong", "-Wformat", "-Werror=format-security" ]'
	qbs config --settings-dir /tmp profiles.deb.cpp.linkerFlags "-z,relro"

override_dh_auto_build:
	qbs build --settings-dir /tmp --log-level $(LOGLEVEL) --command-echo-mode command-line --no-install \
	   profile:deb \
	   modules.qbs.installRoot:$(CURDIR)/debian/tmp \
	   project.libDir:lib/$(DEB_HOST_MULTIARCH) \
	   config:qbs-build
	# Generate pkgconfig file
	sed -e "s/@DEB_HOST_MULTIARCH@/${DEB_HOST_MULTIARCH}/" < debian/libdewalls.pc.in > debian/libdewalls.pc
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# run tests
	qbs run --settings-dir /tmp --no-build  --log-level $(LOGLEVEL) -p dewalls-test \
	   --install-root $(CURDIR)/qbs-build/install-root \
	   project.libDir:lib/$(DEB_HOST_MULTIARCH) \
	   profile:deb config:qbs-build
endif

override_dh_auto_install:
	qbs install --settings-dir /tmp --no-build --log-level $(LOGLEVEL) \
	   --install-root $(CURDIR)/debian/tmp \
	   profile:deb \
	   project.libDir:lib/$(DEB_HOST_MULTIARCH) \
	   config:qbs-build
	dh_install

override_dh_clean:
	# tidy up qbs profile builddirs
	- rm -r qbs-build
	- rm debian/libdewalls.pc
	dh_clean