Files
packages/mail/sendmail/Makefile
Aleksey Vasilenko d84ce3454a sendmail: fix build on hosts with Berkley DB installed
Buildbot caught an error:
  "Berkeley DB file locking needs flock() for version 5.x (and greater?)"

It is caused by leakage of host-installed Berkley DB into the build.
Since libmilter is not using the DB and because of convoluted build
process of sendmail, we do the workaround  - define a macro which
prevents the error without affecting libmilter binary.

Also change source URL from FTP to HTTPS.

Signed-off-by: Aleksey Vasilenko <aleksey.vasilenko@gmail.com>
2025-09-24 01:11:42 -03:00

130 lines
4.6 KiB
Makefile

#
# Copyright (C) 2017 Val Kulkov <val.kulkov@gmail.com>
#
# This is free software, licensed under the GNU General Public License v3.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=sendmail
PKG_VERSION:=8.18.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME).$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://ftp.sendmail.org
PKG_HASH:=cbf1f309c38e4806f7cf3ead24260f17d1fe8fb63256d13edb3cdd1a098f0770
PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
PKG_LICENSE:=Sendmail
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:sendmail:sendmail
PKG_INSTALL:=1
PKG_BUILD_DEPENDS:=openssl
include $(INCLUDE_DIR)/package.mk
TARGET_OS:=OpenWrt
SITECONFIG:=site.$(TARGET_OS).m4
#
# Uncomment the following sections that are currently commented out
# to enable building and packaging Sendmail executables and default
# configuration files into the "sendmail" package.
#
# Note that in this edition of the "sendmail" package:
# 1. No init script is provided to start the Sendmail daemon.
# 2. The initial configuration files in /etc/mail are likely inadequate
# for running the Sendmail daemon on your LEDE/OpenWrt device.
# 3. You may have to "opkg install m4" to build Sendmail configuration files
# from customized mc files on your LEDE/OpenWrt device using m4, or
# alternatively you may use a Linux computer to build configuration
# files from customized mc files.
# 4. Compiling and building the "sendmail" package will likely fail at
# the packaging stage if you have already selected and built the "ssmtp"
# package. "ssmtp" installs /usr/sbin/sendmail in the form of a symlink
# to /usr/sbin/ssmtp. Where /usr/sbin/sendmail is already present,
# copying the sendmail executable into /usr/sbin/sendmail results in
# an error:
# cp: not writing through dangling symlink
# ...
# lede/source/include/toplevel.mk:206: recipe for target 'package/feeds/packages/libmilter/compile' failed
#
#define Package/sendmail
# SECTION:=mail
# CATEGORY:=Mail
# DEPENDS:=+libopenssl
# TITLE:=A general purpose internetwork mail routing facility
# URL:=http://sendmail.org/
#endef
#
#define Package/sendmail/description
# Sendmail is a general purpose internetwork email routing facility that
# supports many kinds of mail-transfer and delivery methods, including
# the Simple Mail Transfer Protocol (SMTP) used for email transport over
# the Internet.
#endef
#
#define Package/sendmail/conffiles
#/etc/mail/helpfile
#/etc/mail/sendmail.cf
#/etc/mail/submit.cf
#/etc/mail/statistics
#endef
define Package/libmilter-sendmail
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpthread
TITLE:=The sendmail Mail Filter API (Milter) library
URL:=http://sendmail.org/
endef
define Package/libmilter-sendmail/description
The sendmail Mail Filter API (Milter) is designed to allow third-party
programs access to mail messages as they are being processed in order to
filter meta-information and content.
endef
TARGET_CFLAGS += $(FPIC)
define Build/Prepare
$(Build/Prepare/Default)
$(CP) files/lm_getver.c $(PKG_BUILD_DIR)/libmilter/
$(CP) files/$(SITECONFIG) $(PKG_BUILD_DIR)/devtools/Site/
$(CP) files/$(TARGET_OS) $(PKG_BUILD_DIR)/devtools/OS/
$(CP) files/sharedlibrary.m4 $(PKG_BUILD_DIR)/devtools/M4/UNIX/
$(CP) $(PKG_BUILD_DIR)/cf/cf/generic-linux.mc $(PKG_BUILD_DIR)/cf/cf/sendmail.mc
$(SED) 's@TARGET_CC@$(TARGET_CC)@g' $(PKG_BUILD_DIR)/devtools/Site/$(SITECONFIG)
$(SED) 's@TARGET_CFLAGS@$(TARGET_CFLAGS)@g' $(PKG_BUILD_DIR)/devtools/Site/$(SITECONFIG)
$(SED) 's@STAGING_DIR@$(STAGING_DIR)@g' $(PKG_BUILD_DIR)/devtools/OS/$(TARGET_OS)
endef
define Build/Compile
$(call Build/Compile/Default,)
$(MAKE_VARS) $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/libmilter $(MAKE_FLAGS) all
$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/libmilter $(MAKE_FLAGS) DESTDIR="$(PKG_INSTALL_DIR)" install
$(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR)/cf/cf $(MAKE_FLAGS) DESTDIR="$(PKG_INSTALL_DIR)" install-cf
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/libmilter $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/include/libmilter/* $(1)/usr/include/libmilter/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmilter.so* $(1)/usr/lib/
endef
define Package/libmilter-sendmail/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libmilter.so* $(1)/usr/lib/
endef
#define Package/sendmail/install
# $(INSTALL_DIR) $(1)/etc/mail $(1)/usr/bin $(1)/usr/sbin
# $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/mail/* $(1)/etc/mail/
# $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
# $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
#endef
$(eval $(call BuildPackage,libmilter-sendmail))
#$(eval $(call BuildPackage,sendmail))