#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

CONFIG_EXTRA = \
    -DCMAKE_INSTALL_LIBDIR=lib

# Disable lldb on arches where they're not available (yet),
# remember to update debian/control when changing these.
ARCH_LLDB := amd64 arm64 armel armhf i386 ppc64el s390x

CONFIG_EXTRA += $(if $(filter $(DEB_HOST_ARCH),$(ARCH_LLDB)),,-DENABLE_LLDB=0)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIG_EXTRA)

override_dh_install:
	dh_install
ifneq (,$(filter $(DEB_HOST_ARCH),$(ARCH_LLDB)))
	dh_install -pcodelite-plugins usr/bin/codelite-lldb usr/lib/codelite
	dh_install -pcodelite-plugins usr/lib/codelite/LLDBDebugger.so
endif
# Remove the .py extension from a script with language-extension
	mv debian/codelite/usr/bin/codelite_open_helper.py debian/codelite/usr/bin/codelite_open_helper

override_dh_makeshlibs:

override_dh_shlibdeps:
	dh_shlibdeps -Lcodelite
