ports/53673: new port: mail/esmtp

Tim Hemel tim at timit.nl
Tue Jun 24 11:10:14 UTC 2003


>Number:         53673
>Category:       ports
>Synopsis:       new port: mail/esmtp
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 24 04:10:11 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Tim Hemel
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
no organization
>Environment:
System: FreeBSD kronkel.opimus.nl 4.8-STABLE FreeBSD 4.8-STABLE #1: Mon May 26 16:26:29 GMT 2003 root at kronkel.opimus.nl:/usr/obj/usr/src/sys/KRONKEL i386


>Description:
	User configurable relay-only MTA with sendmail-compatible syntax
>How-To-Repeat:

>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	esmtp
#	esmtp/Makefile
#	esmtp/pkg-plist
#	esmtp/distinfo
#	esmtp/files
#	esmtp/files/patch-aa
#	esmtp/files/patch-ab
#	esmtp/pkg-descr
#
echo c - esmtp
mkdir -p esmtp > /dev/null 2>&1
echo x - esmtp/Makefile
sed 's/^X//' >esmtp/Makefile << 'END-of-esmtp/Makefile'
X# New ports collection makefile for:    esmtp
X# Date created:         Jun 24 2003
X# Whom:                 tim at n2it.net
X#
X# $FreeBSD$
X
XPORTNAME=	esmtp
XPORTVERSION=	0.3
XCATEGORIES=	mail
XMASTER_SITES=	${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR=	${PORTNAME}
X
XMAINTAINER=	tim at n2it.net
XCOMMENT= User configurable relay-only MTA with sendmail-compatible syntax
X
XLIB_DEPENDS= esmtp.6:${PORTSDIR}/mail/libesmtp \
X			gnugetopt.1:${PORTSDIR}/devel/libgnugetopt
X
XUSE_BZIP2=	yes
XUSE_GMAKE=	yes
XGNU_CONFIGURE=yes
XUSE_AUTOCONF_VER=253
X
XLDFLAGS += -L${LOCALBASE}/lib
XCPPFLAGS += -I${LOCALBASE}/include
XCONFIGURE_ENV += CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
X
XMAN1= esmtp.1
X
Xpre-configure:
X	${TOUCH} ${WRKSRC}/config.sub
X	${TOUCH} ${WRKSRC}/config.guess
X
Xpost-install:
X	mkdir -p ${PREFIX}/share/doc/esmtp
X	${INSTALL_DATA} ${WRKSRC}/sample.esmtprc ${PREFIX}/share/doc/esmtp
X	${INSTALL_DATA} ${WRKSRC}/README.mutt ${PREFIX}/share/doc/esmtp
X
X.include <bsd.port.mk>
END-of-esmtp/Makefile
echo x - esmtp/pkg-plist
sed 's/^X//' >esmtp/pkg-plist << 'END-of-esmtp/pkg-plist'
Xbin/esmtp
Xshare/doc/esmtp/sample.esmtprc
Xshare/doc/esmtp/README.mutt
X at dirrm share/doc/esmtp
END-of-esmtp/pkg-plist
echo x - esmtp/distinfo
sed 's/^X//' >esmtp/distinfo << 'END-of-esmtp/distinfo'
XMD5 (esmtp-0.3.tar.bz2) = 7b18dd14b8a9104b556478466a7f46f3
END-of-esmtp/distinfo
echo c - esmtp/files
mkdir -p esmtp/files > /dev/null 2>&1
echo x - esmtp/files/patch-aa
sed 's/^X//' >esmtp/files/patch-aa << 'END-of-esmtp/files/patch-aa'
X--- configure.ac.orig	Tue Nov  5 12:19:57 2002
X+++ configure.ac	Tue Jun 24 11:39:26 2003
X@@ -21,11 +21,15 @@
X 
X YFLAGS=-d
X 
X+ACX_PTHREAD(LIBS="$LIBS $PTHREAD_LIBS $PTHREAD_CFLAGS",
X+   AC_MSG_ERROR([*** No pthreads on this system]))
X+
X dnl Check for libESMTP
X AC_CHECK_LIB(esmtp, smtp_start_session, 
X-    LIBS="$LIBS -lesmtp -lpthread",
X-    AC_MSG_ERROR([*** libESMTP library not found.]),
X-    -lpthread)
X+    LIBS="$LIBS -lesmtp",
X+    AC_MSG_ERROR([*** libESMTP library not found.]))
X+
X+adl_FUNC_GETOPT_LONG
X 
X AC_CONFIG_FILES([Makefile])
X AC_OUTPUT
END-of-esmtp/files/patch-aa
echo x - esmtp/files/patch-ab
sed 's/^X//' >esmtp/files/patch-ab << 'END-of-esmtp/files/patch-ab'
X--- aclocal.m4.orig	Mon Feb 24 01:08:04 2003
X+++ aclocal.m4	Tue Jun 24 11:36:48 2003
X@@ -826,3 +826,213 @@
X   LEX=${am_missing_run}flex
X fi])
X 
X+
X+dnl Available from the GNU Autoconf Macro Archive at:
X+dnl http://www.gnu.org/software/ac-archive/htmldoc/acx_pthread.html
X+dnl
X+AC_DEFUN([ACX_PTHREAD], [
X+AC_REQUIRE([AC_CANONICAL_HOST])
X+AC_LANG_SAVE
X+AC_LANG_C
X+acx_pthread_ok=no
X+
X+# We used to check for pthread.h first, but this fails if pthread.h
X+# requires special compiler flags (e.g. on True64 or Sequent).
X+# It gets checked for in the link test anyway.
X+
X+# First of all, check if the user has set any of the PTHREAD_LIBS,
X+# etcetera environment variables, and if threads linking works using
X+# them:
X+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
X+        save_CFLAGS="$CFLAGS"
X+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
X+        save_LIBS="$LIBS"
X+        LIBS="$PTHREAD_LIBS $LIBS"
X+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
X+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
X+        AC_MSG_RESULT($acx_pthread_ok)
X+        if test x"$acx_pthread_ok" = xno; then
X+                PTHREAD_LIBS=""
X+                PTHREAD_CFLAGS=""
X+        fi
X+        LIBS="$save_LIBS"
X+        CFLAGS="$save_CFLAGS"
X+fi
X+
X+# We must check for the threads library under a number of different
X+# names; the ordering is very important because some systems
X+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
X+# libraries is broken (non-POSIX).
X+
X+# Create a list of thread flags to try.  Items starting with a "-" are
X+# C compiler flags, and other items are library names, except for "none"
X+# which indicates that we try without any flags at all.
X+
X+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
X+
X+# The ordering *is* (sometimes) important.  Some notes on the
X+# individual items follow:
X+
X+# pthreads: AIX (must check this before -lpthread)
X+# none: in case threads are in libc; should be tried before -Kthread and
X+#       other compiler flags to prevent continual compiler warnings
X+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
X+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
X+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
X+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
X+# -pthreads: Solaris/gcc
X+# -mthreads: Mingw32/gcc, Lynx/gcc
X+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
X+#      doesn't hurt to check since this sometimes defines pthreads too;
X+#      also defines -D_REENTRANT)
X+# pthread: Linux, etcetera
X+# --thread-safe: KAI C++
X+
X+case "${host_cpu}-${host_os}" in
X+        *solaris*)
X+
X+        # On Solaris (at least, for some versions), libc contains stubbed
X+        # (non-functional) versions of the pthreads routines, so link-based
X+        # tests will erroneously succeed.  (We need to link with -pthread or
X+        # -lpthread.)  (The stubs are missing pthread_cleanup_push, or rather
X+        # a function called by this macro, so we could check for that, but
X+        # who knows whether they'll stub that too in a future libc.)  So,
X+        # we'll just look for -pthreads and -lpthread first:
X+
X+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
X+        ;;
X+esac
X+
X+if test x"$acx_pthread_ok" = xno; then
X+for flag in $acx_pthread_flags; do
X+
X+        case $flag in
X+                none)
X+                AC_MSG_CHECKING([whether pthreads work without any flags])
X+                ;;
X+
X+                -*)
X+                AC_MSG_CHECKING([whether pthreads work with $flag])
X+                PTHREAD_CFLAGS="$flag"
X+                ;;
X+
X+                *)
X+                AC_MSG_CHECKING([for the pthreads library -l$flag])
X+                PTHREAD_LIBS="-l$flag"
X+                ;;
X+        esac
X+
X+        save_LIBS="$LIBS"
X+        save_CFLAGS="$CFLAGS"
X+        LIBS="$PTHREAD_LIBS $LIBS"
X+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
X+
X+        # Check for various functions.  We must include pthread.h,
X+        # since some functions may be macros.  (On the Sequent, we
X+        # need a special flag -Kthread to make this header compile.)
X+        # We check for pthread_join because it is in -lpthread on IRIX
X+        # while pthread_create is in libc.  We check for pthread_attr_init
X+        # due to DEC craziness with -lpthreads.  We check for
X+        # pthread_cleanup_push because it is one of the few pthread
X+        # functions on Solaris that doesn't have a non-functional libc stub.
X+        # We try pthread_create on general principles.
X+        AC_TRY_LINK([#include <pthread.h>],
X+                    [pthread_t th; pthread_join(th, 0);
X+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
X+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
X+                    [acx_pthread_ok=yes])
X+
X+        LIBS="$save_LIBS"
X+        CFLAGS="$save_CFLAGS"
X+
X+        AC_MSG_RESULT($acx_pthread_ok)
X+        if test "x$acx_pthread_ok" = xyes; then
X+                break;
X+        fi
X+
X+        PTHREAD_LIBS=""
X+        PTHREAD_CFLAGS=""
X+done
X+fi
X+
X+# Various other checks:
X+if test "x$acx_pthread_ok" = xyes; then
X+        save_LIBS="$LIBS"
X+        LIBS="$PTHREAD_LIBS $LIBS"
X+        save_CFLAGS="$CFLAGS"
X+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
X+
X+        # Detect AIX lossage: threads are created detached by default
X+        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
X+        AC_MSG_CHECKING([for joinable pthread attribute])
X+        AC_TRY_LINK([#include <pthread.h>],
X+                    [int attr=PTHREAD_CREATE_JOINABLE;],
X+                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
X+        if test x"$ok" = xunknown; then
X+                AC_TRY_LINK([#include <pthread.h>],
X+                            [int attr=PTHREAD_CREATE_UNDETACHED;],
X+                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
X+        fi
X+        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
X+                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
X+                          [Define to the necessary symbol if this constant
X+                           uses a non-standard name on your system.])
X+        fi
X+        AC_MSG_RESULT(${ok})
X+        if test x"$ok" = xunknown; then
X+                AC_MSG_WARN([we do not know how to create joinable pthreads])
X+        fi
X+
X+        AC_MSG_CHECKING([if more special flags are required for pthreads])
X+        flag=no
X+        case "${host_cpu}-${host_os}" in
X+                *-aix* | *-freebsd*)     flag="-D_THREAD_SAFE";;
X+                *solaris* | *-osf* | *-hpux*) flag="-D_REENTRANT";;
X+        esac
X+        AC_MSG_RESULT(${flag})
X+        if test "x$flag" != xno; then
X+                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
X+        fi
X+
X+        LIBS="$save_LIBS"
X+        CFLAGS="$save_CFLAGS"
X+
X+        # More AIX lossage: must compile with cc_r
X+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
X+else
X+        PTHREAD_CC="$CC"
X+fi
X+
X+AC_SUBST(PTHREAD_LIBS)
X+AC_SUBST(PTHREAD_CFLAGS)
X+AC_SUBST(PTHREAD_CC)
X+
X+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
X+if test x"$acx_pthread_ok" = xyes; then
X+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
X+        :
X+else
X+        acx_pthread_ok=no
X+        $2
X+fi
X+AC_LANG_RESTORE
X+])dnl ACX_PTHREAD
X+
X+
X+dnl Available from the GNU Autoconf Macro Archive at:
X+dnl http://www.gnu.org/software/ac-archive/htmldoc/adl_func_getopt_long.html
X+dnl
X+AC_PREREQ(2.49)
X+
X+AC_DEFUN([adl_FUNC_GETOPT_LONG],
X+ [# clean out junk possibly left behind by a previous configuration
X+  rm -f lib/getopt.h
X+  # Check for getopt_long support
X+  AC_CHECK_HEADERS([getopt.h])
X+  AC_CHECK_FUNCS([getopt_long],,
X+   [# FreeBSD has a gnugetopt library for this
X+    AC_CHECK_LIB([gnugetopt],[getopt_long],[AC_DEFINE([HAVE_GETOPT_LONG])],
X+     [# use the GNU replacement
X+      AC_LIBOBJ(getopt)
X+      AC_LIBOBJ(getopt1)
X+      AC_CONFIG_LINKS([lib/getopt.h:lib/gnugetopt.h])])])])
END-of-esmtp/files/patch-ab
echo x - esmtp/pkg-descr
sed 's/^X//' >esmtp/pkg-descr << 'END-of-esmtp/pkg-descr'
XESMTP is a user configurable relay-only Mail Transfer Agent (MTA) with a
Xsendmail-compatible syntax. It's based on libESMTP supporting the AUTH
X(including the CRAM-MD5 and NTLM SASL mechanisms) and the StartTLS SMTP
Xextensions.
X
XWWW: http://esmtp.sourceforge.net/
END-of-esmtp/pkg-descr
exit


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list