# Template file for 'sssd'
pkgname=sssd
version=2.8.2
revision=5
# upstream explicitly hardcodes to use glibc:
# https://github.com/SSSD/sssd/blob/2.8.2/src/util/nss_dl_load.c
archs="~*-musl"
build_style=gnu-configure
# configure checks sys.version[:3] for Python versioning, so 3.10 becomes 3.1;
# until this is fixed upstream, manually define am_cv_python_version to circumvent
configure_args="--without-selinux --without-semanage --without-oidc-child
 --disable-cifs-idmap-plugin --without-samba --with-os=fedora
 --with-test-dir=/dev/shm --with-python3-bindings --with-pid-path=/run
 --with-sudo-lib-path=/usr/lib/sssd am_cv_python_version=${py3_ver}"
hostmakedepends="libxslt pkg-config bind-utils docbook-xsl python3-setuptools"
makedepends="pam-devel popt-devel talloc-devel tdb-devel tevent-devel ldb-devel
 ding-libs-devel libldap-devel mit-krb5-devel c-ares-devel glib-devel
 libnfsidmap-devel p11-kit-devel jansson-devel python3-devel libcurl-devel
 libunistring-devel"
make_dirs="/var/lib/sss/db 0700 root root
 /var/lib/sss/secrets 0700 root root
 /var/lib/sss/pubconf/krb5.include.d 0700 root root
 /var/lib/sss/pipes/private 0700 root root
 /var/lib/sss/mc 0700 root root
 /var/lib/sss/keytabs 0700 root root
 /var/lib/sss/gpo_cache 0700 root root
 /var/lib/sss/deskprofile 0700 root root
 /etc/sssd/pki 0700 root root
 /etc/sssd/conf.d 0700 root root"
short_desc="System Security Services Daemon"
maintainer="Yuusha Spacewolf <xyuusha@paranoici.org>"
license="GPL-3.0-or-later"
homepage="https://sssd.io"
distfiles="https://github.com/SSSD/sssd/releases/download/${version}/${pkgname}-${version}.tar.gz"
checksum=ae16447d06bb725bfa9ccb47a9287135015f789ba7414f50cebcb62d52402fef
python_version=3
# These modules in /usr/lib/sssd are required by sssd-python3
shlib_provides="libsss_util.so libsss_crypt.so libsss_debug.so"
# * test_sysdb_sudo: Could not run test: 0 != 0x1 (test_sudo_convert_time);
# * test_inotify: [test_timeout] (0x0010): The test timed out!
# * dlopen-tests: Error opening sss.so: [...] conf_get_str: symbol not found
# * strtonum-tests: Tests:test_strtoint32_alphaonly_base_10:0: errno
#   unexpectedly set to 22
# * pam-srv-tests: https://github.com/SSSD/sssd/issues/5631
# * requires to manually 'make test_CA' (although it should be done by
#   default?).
make_check=no

export PYTHON_CONFIG="${XBPS_CROSS_BASE}/usr/bin/python3-config"

post_install() {
	rm -r ${DESTDIR}/etc/rc.d

	vsv sssd
}

sssd-devel_package() {
	short_desc+=" - development files"
	depends="${sourcepkg}>=${version}_${revision}"
	pkg_install() {
		vmove "usr/lib/*.so"
		vmove usr/lib/pkgconfig
		vmove usr/include
	}
}

sssd-python3_package() {
	depends="sssd"
	short_desc+=" - Python3 bindings"
	pkg_install() {
		vmove ${py3_sitelib}
	}
}
