summaryrefslogtreecommitdiff
path: root/mail/exim3/Makefile
blob: 27c8039271cbc97b9057237ac8f3865e7b107c1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# $NetBSD: Makefile,v 1.45 2013/07/12 10:44:56 jperkin Exp $

DISTNAME=	exim-3.36
PKGREVISION=	13
CATEGORIES=	mail net
MASTER_SITES=	ftp://ftp.csx.cam.ac.uk/pub/software/email/exim/exim3/ \
		http://public.planetmirror.com.au/pub/exim/exim3/
EXTRACT_SUFX=	.tar.bz2

MAINTAINER=	pkgsrc-users@NetBSD.org
HOMEPAGE=	http://www.exim.org/
COMMENT=	The Exim mail transfer agent, a replacement for sendmail

MAKE_JOBS_SAFE=		no

CONFLICTS+=	exim-exiscan-[0-9]*

BUILD_DEFS+=		EXIM_DB.mysql EXIM_DB.pgsql

PKG_SYSCONFSUBDIR?=	exim
EGDIR=			${PREFIX}/share/examples/exim
CONF_FILES=		${EGDIR}/configure ${PKG_SYSCONFDIR}/configure
MESSAGE_SUBST+=		EGDIR="${EGDIR}"

RCD_SCRIPTS=		exim

OWN_DIRS_PERMS=		/var/log/exim ${EXIM_USER} ${EXIM_GROUP} 0750
OWN_DIRS_PERMS+=	/var/spool/exim ${EXIM_USER} ${EXIM_GROUP} 0750

PKG_GROUPS=		${EXIM_GROUP}
PKG_USERS=		${EXIM_USER}:${EXIM_GROUP}

PKG_GROUPS_VARS+=	EXIM_GROUP
PKG_USERS_VARS+=	EXIM_USER

PKG_UID.${EXIM_USER}?=	8
PKG_GECOS.${EXIM_USER}=	Exim mail server user
PKG_HOME.${EXIM_USER}=	${VARBASE}/mail
PKG_SHELL.${EXIM_USER}=	${NOLOGIN}

.include "../../mk/bsd.prefs.mk"

USE_TOOLS+=		gzip gzcat perl:run
FILES_SUBST+=		GZIP_CMD="${GZIP_CMD:C/^/_asdf_/1:M_asdf_*:S/^_asdf_//}"
FILES_SUBST+=		GZCAT=${GZCAT:Q}

_LOOKUP_LIBS+=		${LDFLAGS}

.if defined(EXIM_DB.mysql) && ${EXIM_DB.mysql} == "YES"
LOOKUP_INCLUDE+=	-I${BUILDLINK_PREFIX.mysql-client}/include/mysql
LOOKUP_LIBS+=		-L${BUILDLINK_PREFIX.mysql-client}/lib/mysql
LOOKUP_LIBS+=		${COMPILER_RPATH_FLAG}${BUILDLINK_PREFIX.mysql-client}/lib/mysql
LOOKUP_LIBS+=		-lmysqlclient
MAKE_ENV+=		LOOKUP_MYSQL=YES
.  include "../../mk/mysql.buildlink3.mk"
.endif
.if defined(EXIM_DB.pgsql) && ${EXIM_DB.pgsql} == "YES"
LOOKUP_INCLUDE+=	-I${PGSQL_PREFIX}/include/postgresql
LOOKUP_LIBS+=		-L${PGSQL_PREFIX}/lib
LOOKUP_LIBS+=		${COMPILER_RPATH_FLAG}${PGSQL_PREFIX}/lib -lpq
MAKE_ENV+=		LOOKUP_PGSQL=YES
.  include "../../mk/pgsql.buildlink3.mk"
.endif

BDB_ACCEPTED=	db1 db3 db2	# does not compile with db4
.include "../../mk/bdb.buildlink3.mk"
DBMLIB+=		${LDFLAGS} ${BDB_LIBS}

MAKE_ENV+=		DBMLIB=${DBMLIB:Q}
MAKE_ENV+=		LOOKUP_INCLUDE=${LOOKUP_INCLUDE:Q}
MAKE_ENV+=		LOOKUP_LIBS=${LOOKUP_LIBS:Q}

SUBST_CLASSES+=		paths
SUBST_FILES.paths=	Local/Makefile.pkgsrc ${WRKDIR}/mailer.conf
SUBST_FILES.paths+=	${WRKDIR}/exim_newaliases
SUBST_SED.paths+=	-e 's,@PREFIX@,${PREFIX},g'
SUBST_SED.paths+=	-e 's,@PKG_SYSCONFDIR@,${PKG_SYSCONFDIR},g'
SUBST_SED.paths+=	-e 's,@GZIP_CMD@,${GZIP_CMD},g'
SUBST_SED.paths+=	-e 's,@GZCAT@,${GZCAT},g'
SUBST_SED.paths+=	-e 's,@PERL5@,${PERL5},g'
SUBST_SED.paths+=	-e 's,@SH@,${SH},g'
SUBST_STAGE.paths=	post-patch

INSTALLATION_DIRS=	${PKGMANDIR}/man8 sbin share/examples/exim

INSTALL_ENV+=	INST_BIN_DIRECTORY=${DESTDIR}${PREFIX}/sbin \
	INST_CONFIGURE_FILE=${DESTDIR}${EGDIR}/configure \
	INST_UID=${ROOT_USER}

post-extract:
	${CP} ${FILESDIR}/Makefile-DragonFly ${FILESDIR}/os.h-DragonFly \
		${WRKSRC}/OS/
	${CP} ${FILESDIR}/mailer.conf.exim ${WRKDIR}/mailer.conf
	${CP} ${FILESDIR}/exim_newaliases ${WRKDIR}/exim_newaliases

pre-patch:
	${MKDIR} ${WRKSRC}/Local
	${CP} ${WRKSRC}/src/EDITME ${WRKSRC}/Local/Makefile.pkgsrc

pre-configure:
	${CP} ${WRKSRC}/Local/Makefile.pkgsrc ${WRKSRC}/Local/Makefile
	@for f in ${WRKSRC}/OS/Makefile-*; do \
		${SED} -e 's/^CFLAGS.*/& $$(CPPFLAGS)/' \
		-e '/^DBMLIB/d' $$f > $$f.subst; \
		${MV} -f $$f.subst $$f; \
	done

post-install:
	${INSTALL_SCRIPT} ${WRKDIR}/exim_newaliases ${DESTDIR}${PREFIX}/sbin/exim_newaliases
	${INSTALL_DATA} ${WRKDIR}/mailer.conf ${DESTDIR}${EGDIR}
	${CP} ${FILESDIR}/exim.8 ${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/exim.8

.include "../../devel/pcre/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"