--- /dev/null
+#
+# Copyright (C) 2006 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id$
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=imapfilter
+PKG_VERSION:=1.2.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://imapfilter.hellug.gr/source/
+PKG_MD5SUM:=4c1f28dffbb727a4769948f10baccd79
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/imapfilter
+ SECTION:=net
+ CATEGORY:=Network
+ DEPENDS:=+liblua +libopenssl
+ TITLE:=IMAP server based email filtering
+ URL:=http://imapfilter.hellug.gr/
+endef
+
+define Build/Configure
+ (cd $(PKG_BUILD_DIR); \
+ ./configure \
+ -d /usr \
+ );
+endef
+
+define Build/Compile
+ $(MAKE) -C $(PKG_BUILD_DIR) \
+ $(TARGET_CONFIGURE_OPTS) \
+ INCDIRS="-I$(STAGING_DIR)/usr/include -I$(STAGING_DIR)/include" \
+ LIBDIRS="-L$(STAGING_DIR)/usr/lib -L$(STAGING_DIR)/lib" \
+ MYCFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define Package/imapfilter/conffiles
+/etc/imapfilter/config.lua
+endef
+
+define Package/imapfilter/install
+ $(INSTALL_DIR) $(1)/usr/bin
+ $(INSTALL_BIN) $(PKG_BUILD_DIR)/imapfilter $(1)/usr/bin/
+ $(INSTALL_DIR) $(1)/etc/imapfilter
+ $(INSTALL_CONF) $(PKG_BUILD_DIR)/sample.config.lua $(1)/etc/imapfilter/config.lua
+ $(INSTALL_DIR) $(1)/usr/share/imapfilter
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/interface.lua $(1)/usr/share/imapfilter/
+ $(INSTALL_DATA) $(PKG_BUILD_DIR)/auxiliary.lua $(1)/usr/share/imapfilter/
+endef
+
+$(eval $(call BuildPackage,imapfilter))
--- /dev/null
+--- imapfilter-1.2.2/pathnames.h 2006-08-01 14:11:20.000000000 +0200
++++ imapfilter-1.2.2/pathnames.h 2006-09-07 23:58:12.000000000 +0200
+@@ -3,7 +3,7 @@
+
+
+ /* Program's home directory. */
+-#define PATHNAME_HOME ".imapfilter"
++#define PATHNAME_HOME "/etc/imapfilter"
+
+ /* Program's configuration file. */
+ #define PATHNAME_CONFIG PATHNAME_HOME "/config.lua"
+@@ -18,7 +18,7 @@
+ #define PATHNAME_CERTS PATHNAME_HOME "/certificates"
+
+ /* Debug temporary file template. */
+-#define PATHNAME_DEBUG PATHNAME_HOME "/debug.XXXXXX"
++#define PATHNAME_DEBUG "/tmp/imapfilterdebug.XXXXXX"
+
+
+ #endif /* PATHNAMES_H */
+--- imapfilter-1.2.2/imapfilter.c 2006-09-08 00:02:11.000000000 +0200
++++ imapfilter-1.2.2/imapfilter.c 2006-09-08 00:02:32.000000000 +0200
+@@ -50,7 +50,7 @@
+ opts.config = NULL;
+ opts.oneline = NULL;
+
+- env.home = getenv("HOME");
++ env.home = "";
+ env.pathmax = -1;
+
+ while ((c = getopt(argc, argv, "Vc:de:il:v?")) != -1) {