#!/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