File: rules

package info (click to toggle)
ycmd 0%2B20161219%2Bgit486b809-2.1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,476 kB
  • ctags: 2,589
  • sloc: python: 15,522; cpp: 4,004; sh: 195; cs: 171; makefile: 64; ansic: 36; objc: 10
file content (93 lines) | stat: -rwxr-xr-x 4,192 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/usr/bin/make -f
# -*- makefile -*-

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

BUILD_DIR            = $(CURDIR)/ycm_build
GIT_URL              = https://github.com/Valloric/ycmd.git
DEB_SOURCE           = $(shell dpkg-parsechangelog | grep Source: | sed -e 's/Source: //')
DEB_VERSION          = $(shell dpkg-parsechangelog | grep Version: | sed -e 's/Version: //')
DEB_UPSTREAM_COMMIT  = $(shell echo $(DEB_VERSION) | sed -rn 's/.*git([^-]*).*/\1/p')
DEB_UPSTREAM_VERSION = $(shell echo $(DEB_VERSION) | sed -e 's/-[^-]*$$//')
DEB_INSTALL_DIR      = $(CURDIR)/debian/$(DEB_SOURCE)


# 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'


# AddNearestThirdPartyFoldersToSysPath tests are using third_party/python-future
# directory to test. This directory is removed from ycmd
# package and ycmd is using python-future package. This tests are failing
# because of this reason and needs to be exluded from Debian package.
EXCLUDE_TEST_PARAMS += --exclude='AddNearestThirdPartyFoldersToSysPath_'


EXCLUDE_TEST_PARAMS += --exclude='GetCompletions_UnicodeInLineFilter_test'  # TODO: Need to investigate
EXCLUDE_TEST_PARAMS += --exclude='FromHandlerWithSubservers_test'           # Requires OmniSharp
EXCLUDE_TEST_PARAMS += --exclude='FromWatchdogWithSubservers_test'          # Requires OmniSharp


%:
	dh $@ --with python2 --sourcedirectory=$(CURDIR)/cpp --builddirectory=$(BUILD_DIR) --parallel
      
override_dh_auto_configure:
	dh_auto_configure -- -DUSE_SYSTEM_LIBCLANG=ON -DUSE_SYSTEM_BOOST=ON -DUSE_SYSTEM_GMOCK=ON

override_dh_auto_test:
ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS)))
	cd $(BUILD_DIR)/ycm/tests && ./ycm_core_tests
	# Test JediHTTP
	HOME=$(CURDIR) nosetests -w third_party/JediHTTP -v --with-id -d --no-byte-compile --exclude=test_good_gotoassignment_follow_imports
	HOME=$(CURDIR) nosetests3 -w third_party/JediHTTP -v --with-id -d --no-byte-compile --exclude=test_good_gotoassignment_follow_imports
ifeq (,$(filter $(DEB_HOST_ARCH), mipsel mips64el))
	# Some tests requires UTF-8 compatible locale
	HOME=$(CURDIR) LC_ALL=C.UTF-8 ./run_tests.py --skip-build --no-byte-compile $(EXCLUDE_TEST_PARAMS)
endif
endif

override_dh_auto_clean:
	dh_auto_clean
	$(RM) -rfv .noseids third_party/JediHTTP/.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/lib/ycmd/third_party/JediHTTP/jedihttp/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:
	$(eval YCMD_CLANG_VER=$(shell objdump -x ycm_core.so | grep -oP 'NEED.*libclang-\K(\d+\.\d+)'))
	echo "misc:Clang-Ver=$(YCMD_CLANG_VER)" >> debian/ycmd.substvars
	dh_link -pycmd usr/lib/clang/$(YCMD_CLANG_VER)/include usr/lib/ycmd/clang_includes/include

get-orig-source:
	TMPDIR=`mktemp -d -t`; \
	git clone $(GIT_URL) $$TMPDIR; \
	cd $$TMPDIR; \
	git checkout $(DEB_UPSTREAM_COMMIT); \
	git submodule update --init third_party/JediHTTP; \
	tar -czvf $(CURDIR)/ycmd.orig.tar.gz .; \
	cd $(CURDIR); \
	dpt repack.sh --upstream-version $(DEB_UPSTREAM_VERSION) ycmd.orig.tar.gz ; \
	$(RM) ycmd.orig.tar.gz ; \
	$(RM) -r $$TMPDIR