add dovecot (closes: #1353)
[openwrt/svn-archive/archive.git] / net / dovecot / Makefile
1 #
2 # Copyright (C) 2006,2007 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=dovecot
12 PKG_VERSION:=1.0.beta8
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=http://www.dovecot.org/releases/
17 PKG_MD5SUM:=6a87718a86ee1ae2334c75843dd9a7df
18 PKG_CAT:=zcat
19
20 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
21 PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
22
23 include $(INCLUDE_DIR)/package.mk
24
25 define Package/dovecot
26 SECTION:=net
27 CATEGORY:=Network
28 DEPENDS:=+libopenssl
29 TITLE:=An IMAP and POP3 daemon
30 DESCRIPTION:=\
31 Dovecot is a program which provides POP3 and IMAP services.
32 URL:=http://www.dovecot.org/
33 endef
34
35 define Build/Configure
36 (cd $(PKG_BUILD_DIR); rm -rf config.{cache,status}; \
37 autoconf \
38 );
39 $(call Build/Configure/Default, \
40 --without-gssapi \
41 --with-moduledir=/usr/lib/dovecot/modules \
42 , \
43 ignore_signed_size=1 \
44 )
45 endef
46
47 define Build/Compile
48 $(MAKE) -C $(PKG_BUILD_DIR) \
49 DESTDIR="$(PKG_INSTALL_DIR)" \
50 all install
51 endef
52
53 define Package/dovecot/install
54 $(INSTALL_DIR) $(1)/etc/init.d
55 $(INSTALL_BIN) ./files/dovecot.init $(1)/etc/init.d/dovecot
56 $(INSTALL_DIR) $(1)/etc/dovecot
57 $(INSTALL_DATA) ./files/dovecot.conf $(1)/etc/dovecot.conf
58 $(INSTALL_DIR) $(1)/usr/lib/dovecot
59 $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot/* $(1)/usr/lib/dovecot/
60 $(INSTALL_DIR) $(1)/usr/sbin
61 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
62 find $(1)/usr/lib/dovecot/modules/ \
63 -name "*.a" -o -name "*.la" | xargs rm
64 endef
65
66 define Package/dovecot/conffiles
67 /etc/dovecot.conf
68 endef
69
70 define Package/dovecot/postinst
71 #!/bin/sh
72
73 id=59
74 name=dovecot
75 home=/var/run/dovecot
76 shell=/bin/false
77
78 # do not change below
79 # check if we are on real system
80 if [ -z "$${IPKG_INSTROOT}" ]; then
81 # create copies of passwd and group, if we use squashfs
82 rootfs=`mount |awk '/root/ { print $$5 }'`
83 if [ "$$rootfs" = "squashfs" ]; then
84 if [ -h /etc/group ]; then
85 rm /etc/group
86 cp -p /rom/etc/group /etc/group
87 fi
88 if [ -h /etc/passwd ]; then
89 rm /etc/passwd
90 cp -p /rom/etc/passwd /etc/passwd
91 fi
92 fi
93 fi
94
95 echo ""
96 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
97 echo "adding group $$name to /etc/group"
98 echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
99 fi
100 if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
101 echo "adding user $$name to /etc/passwd"
102 echo "$${name}:x:$${id}:$${id}:$${name}:$${home}:$${shell}" >> $${IPKG_INSTROOT}/etc/passwd
103 fi
104 endef
105
106
107 $(eval $(call BuildPackage,dovecot))
108
109 $(eval $(call RequireCommand,autoconf, \
110 $(PKG_NAME) requires GNU autoconf. \
111 ))