#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

#System types:
#CONFIG_OPT += --target=TARGET
#CONFIG_OPT += --host=TARGET

#Installation directories:
CONFIG_OPT += --prefix=/usr
#CONFIG_OPT += --exec-prefix=\$${prefix}

#Fine tuning of the installation directories:
CONFIG_OPT += --dynlibdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
CONFIG_OPT += --bindir=\$${prefix}/bin
CONFIG_OPT += --libexecdir=\$${prefix}/libexec
CONFIG_OPT += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
CONFIG_OPT += --includedir=\$${prefix}/include/$(DEB_HOST_MULTIARCH)
#CONFIG_OPT += --sysconfdir=SYSDIR
#CONFIG_OPT += --datarootdir=\$${prefix}/share
#CONFIG_OPT += --mandir=DIR

CONFIG_OPT += --shebangdir=\$${prefix}/lib/execline/bin
CONFIG_OPT += --livedir=/run/66
CONFIG_OPT += --max-service=1000
CONFIG_OPT += --max-path-size=1024
CONFIG_OPT += --max-service-size=256
CONFIG_OPT += --max-tree-name-size=256
CONFIG_OPT += --with-default-tree-name=global
CONFIG_OPT += --with-skeleton=/etc/66
CONFIG_OPT += --with-system-log=/var/log/66
CONFIG_OPT += --with-s6-log-user=root
CONFIG_OPT += --with-s6-log-timestamp=iso
CONFIG_OPT += --disable-s6-log-notification=enabled

CONFIG_OPT += --with-system-dir=/var/lib/66
CONFIG_OPT += --with-system-service=/usr/share/66/service
CONFIG_OPT += --with-system-script=/usr/share/66/script
CONFIG_OPT += --with-system-seed=/usr/share/66/seed

CONFIG_OPT += --with-sysadmin-service=/etc/66/service
CONFIG_OPT += --with-sysadmin-service-conf=/etc/66/conf
CONFIG_OPT += --with-sysadmin-seed=/etc/66/seed
CONFIG_OPT += --with-sysadmin-environment=/etc/66/environment

CONFIG_OPT += --with-user-dir=.66
CONFIG_OPT += --with-user-log=.66/log
CONFIG_OPT += --with-user-service=.66/service
CONFIG_OPT += --with-user-service-conf=.66/conf
CONFIG_OPT += --with-user-script=.66/script
CONFIG_OPT += --with-user-seed=.66/seed
CONFIG_OPT += --with-user-environment=.66/environment

#Dependencies:
CONFIG_OPT += --with-sysdeps=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/skalibs/sysdeps
CONFIG_OPT += --with-lib=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)/skalibs
CONFIG_OPT += --with-lib=\$${prefix}/lib/execline
#CONFIG_OPT += --with-dynlib=\$${prefix}/lib/$(DEB_HOST_MULTIARCH)
#CONFIG_OPT += --with-dynlib=\$${prefix}/lib

#Optional features:
#CONFIG_OPT += --enable-shared=enabled
#CONFIG_OPT += --disable-static=enabled
#CONFIG_OPT += --disable-allstatic=enabled
#CONFIG_OPT += --enable-static-libc=disabled
#CONFIG_OPT += --disable-all-pic=enabled

%:
	dh $@

override_dh_clean:
	if test -e README.md; then rm README.md; fi;
	if test -e config.mak; then rm config.mak; fi;
	dh_clean

override_dh_auto_configure:
	./configure -- $(CONFIG_OPT)

