1################################################################################
2#
3# leafnode2
4#
5################################################################################
6
7LEAFNODE2_VERSION = ce7d3b13fb285c9fb7bffc382ea10fd41e12582d
8LEAFNODE2_SITE = $(call gitlab,leafnode-2,leafnode-2,$(LEAFNODE2_VERSION))
9LEAFNODE2_LICENSE = LGPL-2.1
10LEAFNODE2_LICENSE_FILES = COPYING COPYING.LGPL
11LEAFNODE2_DEPENDENCIES = host-pcre pcre
12LEAFNODE2_AUTORECONF = YES
13
14LEAFNODE2_CONF_ENV = \
15	PCRECONFIG="$(STAGING_DIR)/usr/bin/pcre-config"
16
17ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
18LEAFNODE2_DEPENDENCIES += libxcrypt
19endif
20
21# --enable-runas-user use 'news' as default but the configure stop
22# if news doesn't exist on the build host.
23# Use 'root' while cross-compiling
24LEAFNODE2_CONF_OPTS = \
25	--sysconfdir=/etc/leafnode2 \
26	--enable-spooldir=/var/spool/news \
27	--enable-runas-user=root
28
29# Leafnode2 needs the host version of b_sortnl during
30# compilation. Instead of creating a separate host package and
31# installing b_sortnl to $(HOST_DIR) this binary is compiled
32# on-the-fly, host-pcre is needed for this
33define LEAFNODE2_BUILD_SORTNL_TOOL
34	cd $(@D); \
35	$(HOSTCC) $(HOST_CFLAGS) -o b_sortnl_host \
36		arc4random.c mergesort.c b_sortnl.c critmem_malloc.c \
37		critmem_realloc.c -DHAVE_CONFIG_H -I$(HOST_DIR)/include \
38		-L $(HOST_DIR)/lib -Wl,-rpath,$(HOST_DIR)/lib -lpcre
39endef
40
41LEAFNODE2_PRE_BUILD_HOOKS += LEAFNODE2_BUILD_SORTNL_TOOL
42
43define LEAFNODE2_USERS
44	news -1 news -1 * - - - Leafnode2 daemon
45endef
46
47$(eval $(autotools-package))
48