Merge pull request #4632 from smutt/python-dpkt
[feed/packages.git] / mail / fdm / Makefile
1 #
2 # Copyright (C) 2007-2014 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=fdm
11 PKG_VERSION:=1.9
12 PKG_RELEASE:=2
13 PKG_LICENSE:=BSD-2-Clause
14
15 PKG_SOURCE:=$(PKG_VERSION).zip
16 PKG_SOURCE_URL:=https://github.com/nicm/fdm/archive
17 PKG_HASH:=ee08f9133657c8c959b738079c2e4f556cf5cca2daa8343feaf4f07698ad6086
18
19 PKG_INSTALL:=1
20
21 include $(INCLUDE_DIR)/package.mk
22
23 define Package/fdm
24 SECTION:=mail
25 CATEGORY:=Mail
26 TITLE:=fetch mail and deliver
27 URL:=http://fdm.sourceforge.net/
28 MAINTAINER:=Dmitry V. Zimin <pfzim@mail.ru>
29 MENU:=1
30 DEPENDS:=+tdb +zlib +libopenssl +FDM_WITH_PCRE:libpcre
31 USERID:=_fdm=99:_fdm=99
32 endef
33
34 define Package/fdm/description
35 fdm is a simple, lightweight replacement for mail fetch, filter
36 and delivery programs such as fetchmail and procmail. It can
37 fetch using POP3 or IMAP (with SSL) or from stdin, and deliver
38 to a pipe, file, maildir, mbox or SMTP server, based on $(if $(CONFIG_FDM_WITH_PCRE),PCRE,POSIX regexp)
39 endef
40
41 ifdef CONFIG_FDM_WITH_PCRE
42 EXTRA_CFLAGS := -DPCRE
43 EXTRA_LDFLAGS += -lpcre
44 endif
45
46 MAKE_FLAGS += \
47 PREFIX="/usr" \
48 $(if $(CONFIG_FDM_WITH_PCRE),PCRE=1)
49
50 define Build/Prepare
51 $(call Build/Prepare/Default)
52 $(CP) ./src/compat/* $(PKG_BUILD_DIR)/
53 endef
54
55 define Build/Configure
56 ( cd $(PKG_BUILD_DIR); ./autogen.sh )
57 $(call Build/Configure/Default)
58 endef
59
60 define Package/fdm/config
61 source "$(SOURCE)/Config.in"
62 endef
63
64 define Package/fdm/conffiles
65 /etc/fdm.conf
66 endef
67
68 define Package/fdm/install
69 $(INSTALL_DIR) $(1)/usr/bin
70 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
71 $(INSTALL_DIR) $(1)/etc
72 $(INSTALL_DATA) ./files/etc/* $(1)/etc/
73 $(INSTALL_DIR) $(1)/opt/fdm
74 chmod a+rwx $(1)/opt/fdm
75 endef
76
77 define Package/fdm/postinst
78 #!/bin/sh
79 if [ -z "$${IPKG_INSTROOT}" ]; then
80 echo "Creating cron job template for user _fdm..."
81 (crontab -l -u _fdm 2>/dev/null; echo "# */13 * * * * fdm -q fetch") | crontab -u _fdm -
82 echo "Please, edit file /etc/fdm.conf and enable cron job!"
83 fi
84 exit 0
85 endef
86
87 define Package/fdm/prerm
88 #!/bin/sh
89 if [ -z "$${IPKG_INSTROOT}" ]; then
90 echo "Don't forget disable cron job!"
91 echo "# crontab -r -u _fdm"
92 fi
93 exit 0
94 endef
95
96 $(eval $(call BuildPackage,fdm))