include $(TOPDIR)/rules.mk

PKG_NAME:=logrotate
PKG_VERSION:=3.15.0

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz

PKG_BUILD_PARALLEL:=1
PKG_INSTALL:=1
#PKG_LICENSE:=GPL-3.0+

include $(INCLUDE_DIR)/package.mk

define Package/logrotate
  TITLE:=LOG ROTATOR
  SECTION:=utils
  CATEGORY:=Development
  DEPENDS:=+libpopt +libacl
  MENU:=1
endef

define Package/logrotate/description
logrotate is designed to ease administration of systems that generate large numbers of log files.
It allows automatic rotation, compression, removal, and mailing of log files. Each log file may
be handled daily, weekly, monthly, or when it grows too large.
endef

# XXX: add --disable-werror to prevent build failure with arm
CONFIGURE_ARGS+= \
	--disable-werror

define Build/Compile
	+$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		CPPFLAGS="$(TARGET_CPPFLAGS)" \
		all
endef

define Build/Install
	$(MAKE) -C $(PKG_BUILD_DIR) \
		DESTDIR="$(PKG_INSTALL_DIR)" \
		CPPFLAGS="$(TARGET_CPPFLAGS)" \
		install
endef

define Package/logrotate/install
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/logrotate $(1)/usr/sbin/
endef

$(eval $(call BuildPackage,logrotate))
