SpamAssassin: add packages
authorDaniel Golle <daniel@makrotopia.org>
Fri, 25 Dec 2020 22:07:23 +0000 (22:07 +0000)
committerDaniel Golle <dangowrt@users.noreply.github.com>
Sun, 3 Jan 2021 00:17:50 +0000 (00:17 +0000)
Add spamc and spamc-ssl SpamAssassin client packages.
Also package SpamAssassin Perl backend, but that still lacks many
features due to Perl packages missing in OpenWrt.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
lang/perl-mail-spamassassin/Makefile [new file with mode: 0644]

diff --git a/lang/perl-mail-spamassassin/Makefile b/lang/perl-mail-spamassassin/Makefile
new file mode 100644 (file)
index 0000000..979c65c
--- /dev/null
@@ -0,0 +1,101 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-mail-spamassassin
+PKG_RELEASE:=1
+PKG_VERSION:=3.4.4
+PKG_HASH:=8ea27a165b81e3ce8c84ae85c3ecba1f2edfa04ef4a86f07fe28ab612fc8ff60
+
+PKG_SOURCE_NAME:=Mail-SpamAssassin
+PKG_SOURCE_URL:=@APACHE/spamassassin/source
+PKG_SOURCE:=$(PKG_SOURCE_NAME)-$(PKG_VERSION).tar.gz
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_SOURCE_NAME)-$(PKG_VERSION)
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=LICENSE
+PKG_CPE_ID:=cpe:/a:apache:spamassassin
+
+PKG_BUILD_DEPENDS:=perl-dbi/host perl-html-parser/host perl-net-dns/host perl-netaddr-ip/host
+PKG_INSTALL:=1
+PKG_SOURCE_VERSION:=$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+CONFIGURE_PATH:=spamc
+
+define Package/spamassassin
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=SpamAssassin
+  URL:=https://spamassassin.apache.org/
+  DEPENDS:=+perl +perlbase-autoloader +perlbase-config +perlbase-data +perlbase-digest \
+           +perlbase-encode +perlbase-essential +perlbase-file +perlbase-getopt \
+           +perlbase-hash +perlbase-mime +perlbase-net +perlbase-socket \
+           +perl-dbi +perl-html-parser +perl-net-dns +perl-netaddr-ip
+  VARIANT:=ssl
+endef
+
+define Package/spamc/Default
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=SpamAssassin client binary
+  URL:=https://spamassassin.apache.org/
+  DEPENDS:=+zlib
+endef
+
+define Package/spamc
+  $(call Package/spamc/Default)
+  VARIANT:=nossl
+endef
+
+define Package/spamc-ssl
+  $(call Package/spamc/Default)
+  TITLE+= (with SSL)
+  DEPENDS+=+libopenssl
+  VARIANT:=ssl
+endef
+
+ifeq ($(BUILD_VARIANT),ssl)
+TARGET_CFLAGS += -DSPAMC_SSL
+CONFIGURE_ARGS += --enable-ssl
+endif
+
+define Package/spamassassin/conffiles
+/etc/mail/spamassassin
+endef
+
+define Build/Configure
+       $(call perlmod/Configure,,)
+       $(call Build/Configure/Default)
+       ( cd "$(PKG_BUILD_DIR)/$(CONFIGURE_PATH)" && ./version.h.pl --with-version=$(PKG_SOURCE_VERSION) )
+endef
+
+define Build/Compile
+       $(call perlmod/Compile,,)
+       $(call Build/Compile/Default,,,spamc)
+endef
+
+define Package/spamassassin/install
+       $(call perlmod/Install,$(1),Mail/SpamAssassin auto/Mail/SpamAssassin)
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sa-awl $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sa-learn $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sa-compile $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/spamassassin $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sa-update $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/spamd $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sa-check_spamd $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc/mail/spamassassin
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/mail/spamassassin/* $(1)/etc/mail/spamassassin
+endef
+
+define Package/spamc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/spamc $(1)/usr/bin
+endef
+
+Package/spamc-ssl/install = $(Package/spamc/install)
+
+$(eval $(call BuildPackage,spamassassin))
+$(eval $(call BuildPackage,spamc))
+$(eval $(call BuildPackage,spamc-ssl))