summaryrefslogtreecommitdiff
path: root/mail/exim/Makefile
blob: 6bf03fdb0eb69b389663dea3fdf3f0e8f583c5d8 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# $NetBSD: Makefile,v 1.195 2022/11/23 16:20:33 adam Exp $

DISTNAME=	exim-4.96
PKGREVISION=	2
CATEGORIES=	mail net
MASTER_SITES=	https://ftp.exim.org/pub/exim/exim4/
MASTER_SITES+=	https://ftp.exim.org/pub/exim/exim4/fixes/
MASTER_SITES+=	ftp://ftp.exim.org/pub/exim/exim4/
MASTER_SITES+=	ftp://ftp.exim.org/pub/exim/exim4/fixes/
EXTRACT_SUFX=	.tar.xz

MAINTAINER=	abs@NetBSD.org
HOMEPAGE=	https://www.exim.org/
COMMENT=	The Exim mail transfer agent, a replacement for sendmail
LICENSE=	gnu-gpl-v2

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

USE_TOOLS+=	perl:run
USE_LANGUAGES=	c99

BUILD_DEFS+=	VARBASE

MAKE_ENV+=	SSLBASE=${SSLBASE:Q}
MAKE_ENV+=	INST_CHOWN=${CHOWN:Q}
MAKE_FLAGS+=	FULLECHO=''
MAKE_JOBS_SAFE=	no

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

BUILD_DEFS+=	EXIM_DB EXIM_MAX_INCLUDE_SIZE

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

PKG_GROUPS_VARS+=	EXIM_GROUP
PKG_USERS_VARS+=	EXIM_USER

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

FILES_SUBST+=		EXIM_GROUP=${EXIM_GROUP}
FILES_SUBST+=		EXIM_USER=${EXIM_USER}

PKG_SYSCONFSUBDIR=	exim
EXAMPLESDIR=		${PREFIX}/share/examples/exim
CONF_FILES=		${EXAMPLESDIR}/aliases ${PKG_SYSCONFDIR}/aliases
CONF_FILES+=		${EXAMPLESDIR}/configure ${PKG_SYSCONFDIR}/configure
MESSAGE_SUBST+=		EXAMPLESDIR="${EXAMPLESDIR}"
PLIST_SUBST+=		DISTNAME=${DISTNAME}

RCD_SCRIPTS=		exim

OWN_DIRS_PERMS=		${VARBASE}/log/exim ${EXIM_USER} ${EXIM_GROUP} 0750
OWN_DIRS_PERMS+=	${VARBASE}/spool/exim ${EXIM_USER} ${EXIM_GROUP} 0750
SPECIAL_PERMS+=		sbin/${PKGSRC_EXIM_VERSION} ${SETUID_ROOT_PERMS}

# pay attention to CPPFLAGS as well
CFLAGS+=		${CPPFLAGS}

PKGSRC_EXIM_VERSION=	${DISTNAME}-1
SUBST_CLASSES+=		exim
SUBST_STAGE.exim=	pre-configure
SUBST_MESSAGE.exim=	Faking exim version information in exim_install
SUBST_FILES.exim=	scripts/exim_install
SUBST_VARS.exim=	PKGSRC_EXIM_VERSION

SUBST_CLASSES+=		cflags
SUBST_STAGE.cflags=	pre-configure
SUBST_MESSAGE.cflags=	Fixing hard-coded CFLAGS
SUBST_FILES.cflags=	OS/Makefile-*
SUBST_SED.cflags=	-e '/^CFLAGS=/d'
SUBST_SED.cflags+=	-e 's/-D_XOPEN_SOURCE /-D_XOPEN_SOURCE=600 /'
SUBST_SED.cflags+=	-e 's/-D_XOPEN_SOURCE_EXTENDED=1 //'

INSTALL_ARG=		INSTALL_ARG=-no_chown
INSTALL_ENV+=		${INSTALL_ARG:Q}

.include "options.mk"

post-extract:
	mv ${WRKSRC}/OS/unsupported/*-* ${WRKSRC}/OS/
	mkdir ${WRKSRC}/Local
	cp ${WRKSRC}/src/EDITME ${WRKSRC}/Local/Makefile.pkgsrc
	cp ${WRKSRC}/exim_monitor/EDITME ${WRKSRC}/Local/eximon.conf.pkgsrc

pre-configure:
	sed	-e 's:@PREFIX@:${PREFIX}:' \
		-e 's:@PKG_SYSCONFDIR@:${PKG_SYSCONFDIR}:' \
		-e 's:@EXIM_USER@:${EXIM_USER}:' \
		-e 's:@EXIM_GROUP@:${EXIM_GROUP}:' \
		-e 's:@EXIM_USE_DB_CONFIG@:${EXIM_USE_DB_CONFIG}:' \
		-e 's:@EXIM_DBMLIB@:${EXIM_DBMLIB}:' \
		-e 's:@EXIM_INCLUDE@:${EXIM_INCLUDE}:' \
		-e 's:@LOOKUP_LIBS@:${LOOKUP_LIBS}:' \
		-e 's:@CHOWN@:${CHOWN}:' \
		-e 's:@CHGRP@:${CHGRP}:' \
		-e 's:@CHMOD@:${CHMOD}:' \
		-e 's:@MV@:${MV}:' \
		-e 's:@RM@:${RM}:' \
		-e 's:@TOUCH@:${TOUCH}:' \
		-e 's:@PERL5@:${PERL5}:' \
		-e 's:@VARBASE@:${VARBASE}:' \
	    < ${WRKSRC}/Local/Makefile.pkgsrc \
	    > ${WRKSRC}/Local/Makefile
.for opt in ${LOCAL_MAKEFILE_OPTIONS}
	${ECHO} ${opt} >> ${WRKSRC}/Local/Makefile
.endfor
.if !empty(EXIM_MAX_INCLUDE_SIZE)
	${ECHO} MAX_INCLUDE_SIZE=${EXIM_MAX_INCLUDE_SIZE} >> ${WRKSRC}/Local/Makefile
.endif
	sed	-e 's:@PREFIX@:${PREFIX}:' \
		-e 's:@PKG_SYSCONFDIR@:${PKG_SYSCONFDIR}:' \
	    < ${WRKSRC}/Local/eximon.conf.pkgsrc \
	    > ${WRKSRC}/Local/eximon.conf

post-build:
	sed -e 's:@PREFIX@:${PREFIX}:' \
	    ${FILESDIR}/mailer.conf.exim \
	    > ${WRKDIR}/mailer.conf

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

post-install:
	${INSTALL_DATA} ${WRKDIR}/mailer.conf ${DESTDIR}${EXAMPLESDIR}
	${INSTALL_DATA} ${WRKSRC}/doc/exim.8 \
		${DESTDIR}${PREFIX}/${PKGMANDIR}/man8/exim.8
	${INSTALL_DATA} ${WRKSRC}/doc/spec.txt \
		${DESTDIR}${PREFIX}/share/doc/exim

.include "../../converters/libiconv/buildlink3.mk"
.include "../../devel/pcre2/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"