1################################################################################
2#
3# libtalloc
4#
5################################################################################
6
7LIBTALLOC_VERSION = 2.4.2
8LIBTALLOC_SOURCE = talloc-$(LIBTALLOC_VERSION).tar.gz
9LIBTALLOC_SITE = https://www.samba.org/ftp/talloc
10LIBTALLOC_LICENSE = LGPL-3.0+
11LIBTALLOC_LICENSE_FILES = talloc.h
12LIBTALLOC_INSTALL_STAGING = YES
13
14# libtalloc is extracted from the samba source tree, and that has a workaround
15# that requires PYTHONHASHSEED to be set, and to be set to 1.
16# See https://gitlab.com/samba-team/samba/-/commit/420bbb1d92fd2a28725b53f425ba3d214831b660
17LIBTALLOC_CONF_ENV = PYTHONHASHSEED=1
18LIBTALLOC_MAKE_ENV = PYTHONHASHSEED=1
19
20# --with-libiconv= is unconditionally passed, even if libiconv is not
21# present. Indeed, waf will search for libiconv by default in
22# /usr/local. Because of a bug in some waf python script, /usr/local
23# is then used in many subsequent and unrelated checks, which
24# ultimately causes a failure when BR2_COMPILER_PARANOID_UNSAFE_PATH
25# is set.  However no need to set libiconv as a dependency of
26# libtalloc since it's optional.
27LIBTALLOC_CONF_OPTS += --cross-compile \
28		--cross-answers=$(@D)/cache.txt \
29		--disable-stack-protector \
30		--hostcc=gcc \
31		--with-libiconv=$(STAGING_DIR)/usr
32
33ifeq ($(BR2_PACKAGE_LIBTIRPC),y)
34LIBTALLOC_DEPENDENCIES += libtirpc host-pkgconf
35endif
36
37ifeq ($(BR2_PACKAGE_PYTHON3),y)
38LIBTALLOC_DEPENDENCIES += host-python3 python3
39LIBTALLOC_CONF_ENV += \
40	PYTHON="$(HOST_DIR)/bin/python3" \
41	PYTHON_CONFIG="$(STAGING_DIR)/usr/bin/python3-config"
42# There isn't any --enable-python configuration option
43else
44LIBTALLOC_CONF_OPTS += --disable-python
45endif
46
47LIBTALLOC_WAF = ./buildtools/bin/waf
48
49# like samba4, libtalloc uses the waf build system which requires a
50# proper answers file to configure package before build
51define LIBTALLOC_POPULATE_WAF_CACHE
52	$(INSTALL) -m 0644 package/libtalloc/libtalloc-cache.txt $(@D)/cache.txt
53	echo 'Checking uname machine type: $(BR2_ARCH)' >> $(@D)/cache.txt
54endef
55
56LIBTALLOC_PRE_CONFIGURE_HOOKS += LIBTALLOC_POPULATE_WAF_CACHE
57
58$(eval $(waf-package))
59