#
# Copyright (C) 2007-2014 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:=nail
PKG_VERSION:=
PKG_RELEASE:=1
PKG_LICENSE:=BSD-2-Clause

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=:pserver:anonymous@nail.cvs.sourceforge.net:/cvsroot/nail
PKG_SOURCE_SUBDIR:=$(PKG_NAME)
PKG_SOURCE_VERSION:=-D"2014-11-24 00:00"
PKG_SOURCE_PROTO:=cvs

PKG_INSTALL:=0

include $(INCLUDE_DIR)/package.mk

define Package/nail
  SECTION:=mail
  CATEGORY:=Mail
  TITLE:=Heirloom mailx (nail)
  URL:=http://heirloom.sourceforge.net/mailx.html
  MAINTAINER:=Dmitry V. Zimin <pfzim@mail.ru>
  DEPENDS:=+libopenssl
endef

define Package/nail/description
  Heirloom mailx (formerly known as "nail") is intended provide
  the functionality of the POSIX mailx command with additional
  support for MIME messages, IMAP (including caching), POP3,
  SMTP, S/MIME, message threading/sorting, scoring, and filtering
endef

define Package/nail/conffiles
/etc/nail.rc
endef

define Build/Install
	$(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/bin
	$(CP) $(PKG_BUILD_DIR)/mailx $(PKG_INSTALL_DIR)/usr/bin/
	$(INSTALL_DIR) $(PKG_INSTALL_DIR)/etc
	$(CP) $(PKG_BUILD_DIR)/nail.rc $(PKG_INSTALL_DIR)/etc/
endef

define Package/nail/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
	$(INSTALL_DIR) $(1)/etc
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/* $(1)/etc/
endef

$(eval $(call BuildPackage,nail))