File: rules

package info (click to toggle)
ycmd 0%2B20201028%2Bgit1d415c5%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,836 kB
  • sloc: python: 39,750; cpp: 5,991; java: 275; sh: 255; cs: 194; javascript: 150; ansic: 82; makefile: 47; xml: 18; objc: 10
file content (65 lines) | stat: -rwxr-xr-x 2,755 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
#!/usr/bin/make -f
# -*- makefile -*-

export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed
export DEB_BUILD_MAINT_OPTIONS := hardening=+all

include /usr/share/dpkg/pkg-info.mk
BUILD_DIR            = $(CURDIR)/ycm_build
DEB_INSTALL_DIR      = $(CURDIR)/debian/$(DEB_SOURCE)

ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	export YCM_TESTRUN=1
endif

# Skip CsCompleter (OmniSharp), javascript (tern), go and rust tests.
# This package doesn't support them out-of-the-box yet.
EXCLUDE_TEST_PARAMS  = --exclude='^cs$$' --exclude='javascript' --exclude='rust' --exclude='go'

CHOSEN_LLVM_ROOT = $(shell find /usr/lib -maxdepth 1 -type d -name 'llvm-*' | while read LLVM; do test ! -e "$${LLVM}/include/clang-c/Index.h" || echo "$$LLVM"; done | sort -V | tail -n 1 )
YCMD_CLANG_VER = $(shell echo "$(CHOSEN_LLVM_ROOT)" | sed -n -e 's|.*-\([0-9.]\+\)|\1|p' )
YCMD_CORE_VER = $(shell cat "$(CURDIR)/CORE_VERSION" )

%:
	dh $@ --with python3 --sourcedirectory=$(CURDIR)/cpp --builddirectory=$(BUILD_DIR)

override_dh_auto_configure:
	dh_auto_configure -- -DUSE_SYSTEM_LIBCLANG=ON -DPATH_TO_LLVM_ROOT="$(CHOSEN_LLVM_ROOT)" \
		-DUSE_SYSTEM_BOOST=ON -DUSE_SYSTEM_GMOCK=ON
	./update_unicode.py

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	cd "$(BUILD_DIR)/ycm/tests" && HOME="$(CURDIR)" LC_ALL=C.UTF-8 ./ycm_core_tests
endif

override_dh_auto_clean:
	dh_auto_clean
	$(RM) -fv cpp/ycm/UnicodeTable.inc cpp/ycm/tests/GraphemeBreakCases.inc cpp/ycm/tests/NormalizationCases.inc
	$(RM) -rfv .noseids .cache
	$(RM) -rfv *.so*
	$(RM) -rfv $(BUILD_DIR)
	$(RM) -rfv Microsoft   # typescript tests generating a Microsoft directory
	find -name '*.pyc' -exec $(RM) -v {} \;  # remove all cached python files

override_dh_install:
	dh_install
	# Remove dot from .ycm_extra_conf.py
	mv $(DEB_INSTALL_DIR)/usr/lib/ycmd/.ycm_extra_conf.py \
	   $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycm_extra_conf.py
	# Remove tests
	$(RM) -rv $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/completers/all/tests \
	          $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/completers/completer_utils_test.py \
	          $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/completers/cpp/tests \
	          $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/completers/general/tests \
	          $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/completers/go/tests \
	          $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/tests \
	          $(DEB_INSTALL_DIR)/usr/include \
	          $(DEB_INSTALL_DIR)/usr/lib/*.a
	# Fix permissions
	chmod 755 $(DEB_INSTALL_DIR)/usr/lib/ycmd/ycmd/__main__.py

override_dh_link:
	echo "misc:Clang-Ver=$(YCMD_CLANG_VER)" >> debian/ycmd.substvars
	echo "misc:Core-Ver=$(YCMD_CORE_VER)" >> debian/ycmd.substvars
	dh_link -pycmd usr/lib/clang/$(YCMD_CLANG_VER)/include usr/lib/ycmd/clang_includes/include