abinfo "Declare /usr/bin/python3 as default Python interpreter ..."
export PYTHON="/usr/bin/python3"

abinfo "Add /usr/bin/vendor_perl to PATH for perl-parse-yapp ..."
export PATH="$PATH:/usr/bin/vendor_perl"

abinfo "Declaring a list modules to be built ..."
if ab_match_archgroup retro ; then
    _samba4_idmap_modules=idmap_rid,idmap_hash,idmap_tdb2
    _samba4_pdb_modules=pdb_smbpasswd,pdb_samba4
    _samba4_auth_modules=auth_unix,auth_script,auth_samba4
else
    _samba4_idmap_modules=idmap_ad,idmap_rid,idmap_adex,idmap_hash,idmap_tdb2
    _samba4_pdb_modules=pdb_tdbsam,pdb_ldap,pdb_ads,pdb_smbpasswd,pdb_wbc_sam,pdb_samba4
    _samba4_auth_modules=auth_unix,auth_wbc,auth_server,auth_netlogond,auth_script,auth_samba4
fi

WAF_AFTER=(
    "--enable-fhs"
    "--sysconfdir=/etc"
    "--with-configdir=/etc/samba"
    "--with-piddir=/run"
    "--with-sockets-dir=/run/samba"
    "--prefix=/usr"
    "--libdir=/usr/lib"
    "--sbindir=/usr/bin"
    "--libexecdir=/usr/lib/samba"
    "--with-pammodulesdir=/usr/lib/security"
    "--localstatedir=/var"
    "--with-lockdir=/var/cache/samba"
    "--with-ads"
    "--with-acl-support"
    "--with-cluster-support"
    "--with-ldap"
    "--with-systemd"
    "--with-pam"
    "--with-profiling-data"
    "--with-winbind"
    "--systemd-install-services"
    "--private-libraries='!ldb'"
    "--bundled-libraries='!tdb,!talloc,!pytalloc-util,!tevent,!popt,!ldb,!pyldb-util'"
    "--with-shared-modules=${_samba4_idmap_modules},${_samba4_pdb_modules},${_samba4_auth_modules},vfs_io_uring"
    "--disable-rpath-install"
)

if ab_match_archgroup retro; then
    WAF_AFTER=(
        "${WAF_AFTER[@]}"
        "--disable-python"
	"--without-lttng"
	"--without-ldap"
	"--without-ads"
	"--without-ad-dc"
	"--disable-cups"
	"--without-quotas"
	"--without-json"
	"--without-utmp"
	"--disable-avahi"
        "--without-ldb-lmdb"
    )
fi

if (( "$ABSTAGE2" )) ; then	
    WAF_AFTER=(
	"--enable-fhs"
	"--sysconfdir=/etc"
	"--with-configdir=/etc/samba"
	"--with-piddir=/run"
	"--with-sockets-dir=/run/samba"
	"--prefix=/usr"
	"--libdir=/usr/lib"
	"--sbindir=/usr/bin"
	"--libexecdir=/usr/lib/samba"
	"--with-pammodulesdir=/usr/lib/security"
	"--localstatedir=/var"
	"--with-lockdir=/var/cache/samba"
	"--disable-python"
	"--without-ads"
	"--disable-cups"
	"--without-quotas"
	"--without-utmp"
        "--without-ldb-lmdb"
	"--disable-avahi"
	"--without-lttng"
	"--without-json"
	"--without-ad-dc"
	"--without-ldap"
    )
fi
