#!/usr/bin/make -f
# This rules file is for older Debian distributions such as Ubuntu 18.04 Bionic.

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# HACK(strager): Work around an internal compiler error in GCC 8.3:
#
# > lto1: internal compiler error: in add_symbol_to_partition_1,
# > at lto/lto-partition.c:155
export DEB_LDFLAGS_MAINT_APPEND = -flto-partition=none

%:
	dh $@ --parallel

override_dh_auto_configure:
	# quick-lint-js does not build with GCC 7. Request GCC 8 by default.
	CC="$${CC-gcc-8}" CXX="$${CXX-g++-8}" dh_auto_configure -- \
		-DQUICK_LINT_JS_INSTALL_EMACS_DIR=share/emacs/site-lisp/quick-lint-js \
		-DQUICK_LINT_JS_INSTALL_VIM_DIR=share/vim/addons \
		-DQUICK_LINT_JS_INSTALL_VIM_NEOVIM_TAGS=ON \
		-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=YES

override_dh_auto_install:
	dh_auto_install
	install -m644 -D \
		plugin/vim/quick-lint-js.yaml \
		debian/tmp/usr/share/vim/registry/quick-lint-js.yaml
