File: rules

package info (click to toggle)
clazy 1.14-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 5,188 kB
  • sloc: cpp: 24,845; python: 1,387; sh: 236; xml: 136; makefile: 46
file content (71 lines) | stat: -rwxr-xr-x 3,095 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
71
#!/usr/bin/make -f

EMPTY :=
SPACE := $(EMPTY) $(EMPTY)
COMMA := ,

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

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# LLVM 6.0 headers produce lots of class-memaccess warnings
export DEB_CXXFLAGS_MAINT_APPEND = -Wno-class-memaccess

archs_that_need_atomic = armel
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), $(archs_that_need_atomic)))
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--no-as-needed -latomic -Wl,--as-needed
TESTS_EXTRA_LIBS += -latomic
endif

# on armel & armhf there are OpenGL ES headers
ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH), armel armhf))
TESTS_EXCLUDED += qt6-header-fixes
endif

# keep the "++" at the end, to make sure the tool used is the C++ frontend
CLANGPP=$(shell realpath $$(env PATH=$$(echo "$$PATH" | sed -r -e 's|/usr/lib/ccache/?:||') which clang++))++
CLANG_APPLY_REPLACEMENTS=$(shell realpath $$(which clang-apply-replacements))

DPKG_ARCHITECTURE = $(shell dpkg --print-architecture)

%:
	dh $@

execute_after_dh_auto_clean:
	# cleanup the artifacts of the tests
	find tests/ \( -name '*.o' -o -name '*.out' -o -name '*.result' -o -name '*.gch' \) -delete

override_dh_auto_configure:
	dh_auto_configure -- -DCLANGPP_EXECUTABLE="$(CLANGPP)" -DREADLINK_CMD:FILEPATH=/bin/readlink

override_dh_auto_install:
	dh_auto_install --destdir=debian/clazy
	# drop RPATH pointing to the private libdir of LLVM libraries,
	# i.e. /usr/lib/llvm-$VERSION/lib
	chrpath -d $(CURDIR)/debian/clazy/usr/bin/clazy-standalone $(CURDIR)/debian/clazy/usr/lib/*/*.so
	# drop extra license file
	rm $(CURDIR)/debian/clazy/usr/share/doc/clazy/LGPL-2.0-or-later.txt
	# create a local shell environment file with the various paths & configurations
	:> $(CURDIR)/debian/debian.sh
	echo 'export CLANG="$(CLANGPP)"' >> $(CURDIR)/debian/debian.sh
	echo 'export CLANG_APPLY_REPLACEMENTS="$(CLANG_APPLY_REPLACEMENTS)"' >> $(CURDIR)/debian/debian.sh
	echo 'export TESTS_EXCLUDED="$(TESTS_EXCLUDED)"' >> $(CURDIR)/debian/debian.sh
	echo 'export TESTS_EXTRA_LIBS="$(TESTS_EXTRA_LIBS)"' >> $(CURDIR)/debian/debian.sh
	mkdir -p $(CURDIR)/debian/clazy-tests/usr/share/clazy
	mv $(CURDIR)/debian/debian.sh $(CURDIR)/debian/clazy-tests/usr/share/clazy/debian-$(DPKG_ARCHITECTURE).sh

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	chmod +x $(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/clazy
	cd tests && env PATH=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE):$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/bin:$(PATH) LD_LIBRARY_PATH=$(CURDIR)/obj-$(DEB_HOST_GNU_TYPE)/lib DEBIAN_EXTRA_LIBS="$(TESTS_EXTRA_LIBS)" CCACHE_DISABLE=1 ./run_tests.py --verbose --jobs $(or $(DEB_BUILD_OPTION_PARALLEL),$(DEB_BUILD_OPTION_PARALLEL),1) $(and $(TESTS_EXCLUDED),--exclude $(subst $(SPACE),$(COMMA),$(TESTS_EXCLUDED)))
endif

override_dh_compress:
	# do not compress documentation markdown & JSON files
	dh_compress -X.md -X.json

override_dh_gencontrol:
	dh_gencontrol -- \
	  -V'clazy:clang=$(shell dpkg -S "$(CLANGPP)" | cut -d: -f1)' \
	  -V'clazy:clang-tools=$(shell dpkg -S "$(CLANG_APPLY_REPLACEMENTS)" | cut -d: -f1)'