File: rules

package info (click to toggle)
ycmd 0%2B20240823%2Bgit8b61f19%2Bds-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,696 kB
  • sloc: python: 43,932; cpp: 6,134; java: 486; sh: 378; cs: 207; javascript: 150; ansic: 82; makefile: 45; xml: 18; objc: 10
file content (61 lines) | stat: -rwxr-xr-x 2,538 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- makefile -*-

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

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_GMOCK=ON -DUSE_SYSTEM_ABSEIL=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

execute_after_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

execute_after_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 "ycmd:Clang-Ver=$(YCMD_CLANG_VER)" >> debian/ycmd.substvars
	echo "ycmd:Core-Ver=$(YCMD_CORE_VER)" >> debian/ycmd.substvars
	dh_link -pycmd usr/lib/clang/$(YCMD_CLANG_VER)/include usr/lib/ycmd/clang_includes/include

override_dh_makeshlibs:
	echo 'Disabled as built library is not public'