b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2006-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:=emailrelay |
| 11 | PKG_VERSION:=2.1 |
| 12 | PKG_RELEASE:=1 |
| 13 | |
| 14 | PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-src.tar.gz |
| 15 | PKG_SOURCE_URL:=@SF/emailrelay/$(PKG_VERSION) |
| 16 | PKG_HASH:=dcb1fc0cbb3d5407554685616e7ef691f30f733b4484979be0794c9d5f563762 |
| 17 | |
| 18 | PKG_MAINTAINER:=Federico Di Marco <fededim@gmail.com> |
| 19 | PKG_LICENSE:=GPL-3.0-or-later |
| 20 | PKG_LICENSE_FILES:=COPYING |
| 21 | |
| 22 | PKG_CONFIG_DEPENDS:=CONFIG_EMAILRELAY_SUPPORT_VERBOSE_DBG CONFIG_EMAILRELAY_SSL |
| 23 | |
| 24 | include $(INCLUDE_DIR)/package.mk |
| 25 | |
| 26 | define Package/emailrelay |
| 27 | SECTION:=mail |
| 28 | CATEGORY:=Mail |
| 29 | DEPENDS:=+EMAILRELAY_SSL:libopenssl +libstdcpp |
| 30 | TITLE:=A simple SMTP proxy and MTA |
| 31 | URL:=http://emailrelay.sourceforge.net/ |
| 32 | MENU:=1 |
| 33 | endef |
| 34 | |
| 35 | |
| 36 | define Package/emailrelay/config |
| 37 | config EMAILRELAY_SUPPORT_VERBOSE_DBG |
| 38 | bool "Enable support for extended logging" |
| 39 | depends on PACKAGE_emailrelay |
| 40 | default n |
| 41 | help |
| 42 | Enables support for extended logging (must also be explicitely enabled by using command line switch --debug when starting emailrelay) |
| 43 | |
| 44 | config EMAILRELAY_SSL |
| 45 | bool "Enable support for OpenSSL" |
| 46 | depends on PACKAGE_emailrelay |
| 47 | default y |
| 48 | select PACKAGE_libopenssl |
| 49 | help |
| 50 | Builds the package with OpenSSL support (SSMTP is supported). |
| 51 | endef |
| 52 | |
| 53 | |
| 54 | |
| 55 | define Package/emailrelay/description |
| 56 | Emailrelay is a simple SMTP proxy and store-and-forward message transfer agent (MTA). |
| 57 | |
| 58 | When running as a proxy all e-mail messages can be passed through |
| 59 | a user-defined program, such as a spam filter, which can drop, |
| 60 | re-address or edit messages as they pass through. When running |
| 61 | as a store-and-forward MTA incoming messages are stored in a |
| 62 | local spool directory, and then forwarded to the next SMTP |
| 63 | server on request. |
| 64 | endef |
| 65 | |
| 66 | |
| 67 | define Package/emailrelay/conffiles |
| 68 | /etc/config/emailrelay |
| 69 | /etc/emailrelay.auth |
| 70 | endef |
| 71 | |
| 72 | |
| 73 | CONFIGURE_ARGS += \ |
| 74 | --without-doxygen \ |
| 75 | --without-man2html \ |
| 76 | --without-mbedtls \ |
| 77 | --without-pam \ |
| 78 | --disable-bsd \ |
| 79 | --disable-gui \ |
| 80 | --disable-mac \ |
| 81 | --disable-testing \ |
| 82 | --disable-windows |
| 83 | |
| 84 | ifeq ($(CONFIG_EMAILRELAY_SSL),y) |
| 85 | CONFIGURE_ARGS += \ |
| 86 | --with-openssl |
| 87 | else |
| 88 | CONFIGURE_ARGS += \ |
| 89 | --without-openssl |
| 90 | endif |
| 91 | |
| 92 | ifeq ($(CONFIG_EMAILRELAY_SUPPORT_VERBOSE_DBG),y) |
| 93 | CONFIGURE_ARGS += \ |
| 94 | --enable-debug=yes |
| 95 | endif |
| 96 | |
| 97 | TARGET_CXXFLAGS += -ffunction-sections -fdata-sections -flto |
| 98 | TARGET_CXXFLAGS += -Wl,--gc-sections,--as-needed |
| 99 | |
| 100 | define Package/emailrelay/install |
| 101 | $(INSTALL_DIR) $(1)/usr/bin |
| 102 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/main/emailrelay $(1)/usr/bin/ |
| 103 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/main/emailrelay-filter-copy $(1)/usr/bin/ |
| 104 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/main/emailrelay-passwd $(1)/usr/bin/ |
| 105 | $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/main/emailrelay-submit $(1)/usr/bin/ |
| 106 | $(INSTALL_DIR) $(1)/etc |
| 107 | $(INSTALL_DATA) files/$(PKG_NAME).auth $(1)/etc/ |
| 108 | $(INSTALL_DIR) $(1)/etc/config |
| 109 | $(INSTALL_CONF) files/$(PKG_NAME).config $(1)/etc/config/$(PKG_NAME) |
| 110 | $(INSTALL_DIR) $(1)/etc/init.d |
| 111 | $(INSTALL_BIN) files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) |
| 112 | endef |
| 113 | |
| 114 | |
| 115 | $(eval $(call BuildPackage,emailrelay)) |