#
# Copyright (C) 2006-2011 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=igmpproxy
PKG_VERSION:=0.2.1
PKG_RELEASE:=7
PKG_LICENSE:=GPL-2.0-or-later

PKG_SOURCE_VERSION:=0.2.1
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/pali/igmpproxy/releases/download/${PKG_SOURCE_VERSION}/

PKG_HASH:=d351e623037390f575c1203d9cbb7ba33a8bdef85a3c5e1d2901c5a2a38449a1
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>

include $(INCLUDE_DIR)/package.mk

PKG_FIXUP:=autoreconf

define Package/igmpproxy
  SECTION:=net
  CATEGORY:=Network
  SUBMENU:=Routing and Redirection
  DEPENDS:=+USE_GLIBC:librt
  TITLE:=Multicast Routing Daemon
  URL:=http://sourceforge.net/projects/igmpproxy
  USERID:=igmpproxy:igmpproxy
  FATTRS:=/usr/sbin/igmpproxy::::cap_net_raw=ep
endef

define Package/igmpproxy/description
	IGMPproxy is a simple dynamic Multicast Routing Daemon
	which enables the ability for the router to learn multicast group membership information
	and forward multicast packets
endef

define Package/igmpproxy/conffiles
/etc/config/igmpproxy
endef

TARGET_CFLAGS += -Dlog=igmpproxy_log

define Package/igmpproxy/install
	$(INSTALL_DIR) $(1)/etc/config
	$(INSTALL_CONF_USR) ./files/igmpproxy.config $(1)/etc/config/igmpproxy
	$(INSTALL_DIR) $(1)/etc/init.d
	$(INSTALL_BIN) ./files/igmpproxy.init $(1)/etc/init.d/igmpproxy
	$(INSTALL_DIR) $(1)/usr/sbin
	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/igmpproxy $(1)/usr/sbin/
	$(INSTALL_DIR) $(1)/etc/uci-defaults/7.18
	$(INSTALL_DATA) ./files/igmpproxy.defaults $(1)/etc/uci-defaults/7.18/99_igmpproxy_add_index
	$(INSTALL_DIR) $(1)/etc/permtab.d
	$(INSTALL_DATA) ./files/igmpproxy.permtab $(1)/etc/permtab.d/igmpproxy
endef

$(eval $(call BuildPackage,igmpproxy))
