#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# Debian debhelper package build rules for libwebsockets

# Aim for the top, adapt if anything should break on the buildds.
DEB_BUILD_MAINT_OPTIONS=	hardening=+all future=+lfs
export DEB_BUILD_MAINT_OPTIONS

# TODO: remove -Wno-error=format-truncation and -Wno-error=format-overflow on
# next upstream release
DEB_CFLAGS_MAINT_APPEND=	-fno-strict-aliasing -Wno-error=format-truncation -Wno-error=format-overflow
export DEB_CFLAGS_MAINT_APPEND

arch?=		$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_LIBRARY_ARCHITECTURE=${arch} \
	    -DLIB_SUFFIX=/${arch} -DLWS_WITHOUT_DAEMONIZE=OFF \
	    -DLWS_WITH_LIBEV=ON -DLWS_WITH_LIBUV=ON \
	    -DLWS_UNIX_SOCK=ON -DLWS_IPV6=ON \
	    -DLWS_WITH_ZLIB=ON -DLWS_WITH_EXTERNAL_POLL=ON \
	    -DLWS_WITHOUT_EXTENSIONS=OFF

override_dh_install-arch:
	$(RM) $(CURDIR)/debian/tmp/usr/lib/${arch}/pkgconfig/libwebsockets_static.pc
	dh_install -a

.PHONY: override_dh_auto_configure override_dh_install-arch
