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

# Large File Support
LFS_CFLAGS:=	$(shell getconf LFS_CFLAGS 2>/dev/null || echo "-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")
LFS_LDFLAGS:=	$(shell getconf LFS_LDFLAGS 2>/dev/null || true)

# TODO: remove -Wno-error=format-truncation and -Wno-error=format-overflow on
# next upstream release
DEB_CFLAGS_MAINT_APPEND=	$(LFS_CFLAGS) -fno-strict-aliasing -Wno-error=format-truncation -Wno-error=format-overflow
DEB_LDFLAGS_MAINT_APPEND=	$(LFS_LDFLAGS)
export DEB_CFLAGS_MAINT_APPEND DEB_LDFLAGS_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

.PHONY: override_dh_auto_configure
