1################################################################################
2#
3# squid
4#
5################################################################################
6
7SQUID_VERSION = 6.9
8SQUID_SOURCE = squid-$(SQUID_VERSION).tar.xz
9SQUID_SITE = http://www.squid-cache.org/Versions/v6
10SQUID_LICENSE = GPL-2.0+
11SQUID_LICENSE_FILES = COPYING
12SQUID_CPE_ID_VENDOR = squid-cache
13SQUID_SELINUX_MODULES = apache squid
14SQUID_DEPENDENCIES = libcap host-libcap libtool libxml2 host-pkgconf \
15	$(if $(BR2_PACKAGE_LIBNETFILTER_CONNTRACK),libnetfilter_conntrack)
16SQUID_CONF_ENV = \
17	ac_cv_epoll_works=yes \
18	ac_cv_func_setresuid=yes \
19	ac_cv_func_va_copy=yes \
20	ac_cv_func___va_copy=yes \
21	ac_cv_func_strnstr=no \
22	ac_cv_have_squid=yes \
23	BUILDCXX="$(HOSTCXX)" \
24	BUILDCXXFLAGS="$(HOST_CXXFLAGS) -std=c++17"
25SQUID_CONF_OPTS = \
26	--enable-async-io=8 \
27	--enable-linux-netfilter \
28	--enable-removal-policies="lru,heap" \
29	--with-filedescriptors=1024 \
30	--disable-ident-lookups \
31	--enable-auth-basic="fake getpwnam" \
32	--enable-auth-digest="file" \
33	--enable-auth-negotiate="wrapper" \
34	--enable-auth-ntlm="fake" \
35	--disable-strict-error-checking \
36	--enable-external-acl-helpers="file_userip" \
37	--disable-ltdl-install \
38	--without-included-ltdl \
39	--with-logdir=/var/log/squid/ \
40	--with-pidfile=/var/run/squid.pid \
41	--with-swapdir=/var/cache/squid/ \
42	--with-default-user=squid
43
44ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
45SQUID_CONF_ENV += LIBS=-latomic
46endif
47
48ifeq ($(BR2_PACKAGE_LIBKRB5),y)
49SQUID_CONF_OPTS += --with-mit-krb5
50SQUID_DEPENDENCIES += libkrb5
51else
52SQUID_CONF_OPTS += --without-mit-krb5
53endif
54
55ifeq ($(BR2_PACKAGE_LIBXCRYPT),y)
56SQUID_DEPENDENCIES += libxcrypt
57endif
58
59ifeq ($(BR2_PACKAGE_OPENSSL),y)
60SQUID_CONF_OPTS += --with-openssl
61SQUID_DEPENDENCIES += openssl
62else
63SQUID_CONF_OPTS += --without-openssl
64endif
65
66ifeq ($(BR2_PACKAGE_GNUTLS),y)
67SQUID_CONF_OPTS += --with-gnutls
68SQUID_DEPENDENCIES += gnutls
69else
70SQUID_CONF_OPTS += --without-gnutls
71endif
72
73ifeq ($(BR2_PACKAGE_SYSTEMD),y)
74SQUID_CONF_OPTS += --with-systemd
75SQUID_DEPENDENCIES += systemd
76else
77SQUID_CONF_OPTS += --without-systemd
78endif
79
80define SQUID_CLEANUP_TARGET
81	rm -f $(addprefix $(TARGET_DIR)/usr/bin/, \
82		RunCache RunAccel)
83	rm -f $(addprefix $(TARGET_DIR)/etc/, \
84		cachemgr.conf mime.conf.default squid.conf.default)
85endef
86
87SQUID_POST_INSTALL_TARGET_HOOKS += SQUID_CLEANUP_TARGET
88
89define SQUID_USERS
90	squid -1 squid -1 * - - - Squid proxy cache
91endef
92
93define SQUID_INSTALL_INIT_SYSV
94	$(INSTALL) -m 755 -D package/squid/S97squid \
95		$(TARGET_DIR)/etc/init.d/S97squid
96endef
97
98define SQUID_INSTALL_INIT_SYSTEMD
99	$(INSTALL) -D -m 0644 $(@D)/tools/systemd/squid.service \
100		$(TARGET_DIR)/usr/lib/systemd/system/squid.service
101endef
102
103$(eval $(autotools-package))
104