kumquat-buildroot/package/zabbix/zabbix.mk

134 lines
4.0 KiB
Makefile
Raw Normal View History

package/zabbix: new package Agent is always enabled. Even though a server without agent is a valid use case, the agent doesn't take much space compared to the server so making it optional is not worth it. Optional dependencies (openssl, libcurl, ...) are set globally, even though they are supposedly only used for the server. However, this is not so obvious from configure.ac so it's easy to accidentally miss one. Setting them globally doesn't hurt. The proxy, agent2 and webservice features are left disabled. agent2 requires go. zabbix also has support for sqlite3 as database backend, but only for the proxy, not for the server. Signed-off-by: Alexey Lukyanchuk <skif@skif-web.ru> [Arnout: - BR2_TOOLCHAIN_USES_GLIBC implies the other glibc options. - Fix wrapping in Config.in help text. - Add upstream URL. - Protect comments with "depends on" instead of "if". - Select postgresl/mysql instead of depends (and propagate dependencies). - Remove redundant condition around BR2_PACKAGE_ZABBIX_SERVER_COPY_DUMPS. - Select PHP extensions instead of depends. - Make optional dependencies automatic instead of Config.in. - Improve some of the help texts. - Bump to 5.4.9 and update hashes. - Add COPYING as license file. - Switch to actual upstream at zabbix.com. - Explicitly disable all unused features. - Disable zabbix user login with '*'. - Don't add user to zabbix group twice. - Do patch of zabbix_*.conf in post-patch hook and do it for all conf files in one shot. - Remove workarounds for pending patches (which were merged). - Put web ui in /var/www/zabbix and SQL files in /var/lib/zabbix. ] Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
2020-04-23 09:17:52 +02:00
################################################################################
#
# zabbix
#
################################################################################
ZABBIX_VERSION_MAJOR = 5.4
ZABBIX_VERSION = $(ZABBIX_VERSION_MAJOR).9
ZABBIX_SITE = https://cdn.zabbix.com/zabbix/sources/stable/$(ZABBIX_VERSION_MAJOR)
ZABBIX_LICENSE = GPL-2.0+
ZABBIX_LICENSE_FILES = README COPYING
ZABBIX_DEPENDENCIES = pcre
ZABBIX_CONF_OPTS = \
--with-libpcre=$(STAGING_DIR)/usr/bin/ \
--without-sqlite3 \
--enable-agent \
--disable-agent2 \
--disable-java \
--disable-proxy \
--disable-webservice
define ZABBIX_USERS
zabbix -1 zabbix -1 * /var/lib/zabbix - - zabbix user
endef
ZABBIX_SYSTEMD_UNITS += zabbix-agent.service
define ZABBIX_CHANGE_PIDFILE_LOCATION
$(SED) 's%\#\ PidFile=/tmp/zabbix\(.*\).pid%PidFile=/run/zabbix/zabbix\1.pid%g' $(@D)/conf/zabbix_*.conf
endef
ZABBIX_POST_PATCH_HOOKS += ZABBIX_CHANGE_PIDFILE_LOCATION
ifeq ($(BR2_PACKAGE_OPENIPMI),y)
ZABBIX_CONF_OPTS += --with-openipmi=$(STAGING_DIR)/usr
ZABBIX_DEPENDENCIES += openipmi
else
ZABBIX_CONF_OPTS += --without-openipmi
endif
ifeq ($(BR2_PACKAGE_LIBCURL),y)
ZABBIX_CONF_OPTS += --with-libcurl=$(STAGING_DIR)/usr/bin/curl-config
ZABBIX_DEPENDENCIES += libcurl
else
ZABBIX_CONF_OPTS += --without-libcurl
endif
ifeq ($(BR2_PACKAGE_LIBXML2),y)
ZABBIX_CONF_OPTS += --with-libxml2=$(STAGING_DIR)/usr/bin/xml2-config
ZABBIX_DEPENDENCIES += libxml2
else
ZABBIX_CONF_OPTS += --without-libxml2
endif
ifeq ($(BR2_PACKAGE_NETSNMP),y)
ZABBIX_CONF_OPTS += --with-net-snmp=$(STAGING_DIR)/usr/bin/net-snmp-config
ZABBIX_DEPENDENCIES += netsnmp
else
ZABBIX_CONF_OPTS += --without-net-snmp
endif
ifeq ($(BR2_PACKAGE_OPENLDAP),y)
ZABBIX_CONF_OPTS += --with-ldap=$(STAGING_DIR)/usr
ZABBIX_DEPENDENCIES += openldap
else
ZABBIX_CONF_OPTS += --without-ldap
endif
ifeq ($(BR2_PACKAGE_LIBSSH2),y)
ZABBIX_CONF_OPTS += --with-ssh2=$(STAGING_DIR)/usr
ZABBIX_DEPENDENCIES += libssh2
else
ZABBIX_CONF_OPTS += --without-ssh2
endif
# Only one of openssl or gnutls should be enabled
ifeq ($(BR2_PACKAGE_OPENSSL),y)
ZABBIX_CONF_OPTS += --with-openssl=$(STAGING_DIR)/usr --without-gnutls
ZABBIX_DEPENDENCIES += openssl
else ifeq ($(BR2_PACKAGE_GNUTLS),y)
ZABBIX_CONF_OPTS += --with-gnutls=$(STAGING_DIR)/usr --without-openssl
ZABBIX_DEPENDENCIES += gnutls
else
ZABBIX_CONF_OPTS += --without-gnutls --without-openssl
endif
ifeq ($(BR2_PACKAGE_ZABBIX_SERVER),y)
ZABBIX_DEPENDENCIES += libevent zlib
ZABBIX_CONF_OPTS += \
--enable-server \
--with-libevent=$(STAGING_DIR)/usr \
--with-libpthread=$(STAGING_DIR)/usr \
--with-zlib=$(STAGING_DIR)/usr
ZABBIX_SYSTEMD_UNITS += zabbix-server.service
ifeq ($(BR2_PACKAGE_ZABBIX_SERVER_COPY_FRONTEND),y)
define ZABBIX_SERVER_COPY_FRONTEND
mkdir -p $(TARGET_DIR)/var/www/zabbix/
cp -dpfr $(@D)/ui/* $(TARGET_DIR)/var/www/zabbix/
endef
ZABBIX_POST_INSTALL_TARGET_HOOKS += ZABBIX_SERVER_COPY_FRONTEND
endif
ifeq ($(BR2_PACKAGE_ZABBIX_SERVER_MYSQL),y)
ZABBIX_DEPENDENCIES += mysql
ZABBIX_CONF_OPTS += --with-mysql=$(STAGING_DIR)/usr/bin/mysql_config --without-postgresql
ZABBIX_DATABASE = mysql
else ifeq ($(BR2_PACKAGE_ZABBIX_SERVER_POSTGRESQL),y)
ZABBIX_DEPENDENCIES += postgresql
ZABBIX_CONF_OPTS += --with-postgresql=$(STAGING_DIR)/usr/bin/pg_config --without-mysql
ZABBIX_DATABASE = postgresql
endif
ifeq ($(BR2_PACKAGE_ZABBIX_SERVER_COPY_DUMPS),y)
define ZABBIX_SERVER_COPY_DUMPS
mkdir -p $(TARGET_DIR)/var/lib/zabbix/schema/
install -m 644 $(@D)/database/$(ZABBIX_DATABASE)/*.sql $(TARGET_DIR)/var/lib/zabbix/schema/
endef
ZABBIX_POST_INSTALL_TARGET_HOOKS += ZABBIX_SERVER_COPY_DUMPS
endif
endif # BR2_PACKAGE_ZABBIX_SERVER
define ZABBIX_INSTALL_INIT_SYSTEMD
$(foreach unit,$(ZABBIX_SYSTEMD_UNITS),\
$(INSTALL) -D -m 0644 $(ZABBIX_PKGDIR)/$(unit) $(TARGET_DIR)/usr/lib/systemd/system/$(unit) && \
mkdir -p $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants && \
ln -fs -r $(TARGET_DIR)/usr/lib/systemd/system/$(unit) $(TARGET_DIR)/etc/systemd/system/multi-user.target.wants/$(unit)
)
endef
$(eval $(autotools-package))