summaryrefslogtreecommitdiff
path: root/www/z-push/Makefile
blob: f08d60cce4b92dd00e588a779d590440f211a1df (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
# $NetBSD: Makefile,v 1.7 2020/01/26 17:32:26 rillig Exp $
#

DISTNAME=	z-push-${ZPUSH_VERSION}
ZPUSH_VERSION=	2.2.10
PKGREVISION=	1
CATEGORIES=	www
MASTER_SITES=	http://download.z-push.org/final/2.2/

MAINTAINER=	jym@NetBSD.org
HOMEPAGE=	https://z-push.org/
COMMENT=	Open-source ActiveSync server

LICENSE=	gnu-agpl-v3

NO_BUILD=	yes

ZPUSHDIR=	${PREFIX}/share/z-push
EGDIR=		${PREFIX}/share/examples/z-push
DOCDIR=		${PREFIX}/share/doc/z-push
ZPUSHSTATEDIR=	${VARBASE}/z-push
ZPUSHLOGDIR=	${VARBASE}/log/z-push

BUILD_DEFS=	APACHE_USER APACHE_GROUP VARBASE
USE_TOOLS=	pax

INSTALLATION_DIRS=	${DOCDIR} ${EGDIR} bin ${ZPUSHDIR}

.include "../../lang/php/phpversion.mk"

DEPENDS+=	${PHP_PKG_PREFIX}-soap>=${PHP_BASE_VERS}:../../net/php-soap
DEPENDS+=	${PHP_PKG_PREFIX}-pcntl>=${PHP_BASE_VERS}:../../devel/php-pcntl
DEPENDS+=	${PHP_PKG_PREFIX}-posix>=${PHP_BASE_VERS}:../../devel/php-posix
DEPENDS+=	${PHP_PKG_PREFIX}-sysvshm>=${PHP_BASE_VERS}:../../devel/php-sysvshm
DEPENDS+=	${PHP_PKG_PREFIX}-sysvsem>=${PHP_BASE_VERS}:../../devel/php-sysvsem

PKG_SYSCONFSUBDIR=	z-push

MESSAGE_SUBST+=		ZPUSHDIR=${ZPUSHDIR:Q}
MESSAGE_SUBST+=		ZPUSHSTATEDIR=${ZPUSHSTATEDIR:Q}
MESSAGE_SUBST+=		ZPUSHLOGDIR=${ZPUSHLOGDIR:Q}
MESSAGE_SUBST+=		PKG_SYSCONFDIR=${PKG_SYSCONFDIR:Q}
MESSAGE_SUBST+=		HOMEPAGE=${HOMEPAGE:Q}
MESSAGE_SUBST+=		DOCDIR=${DOCDIR:Q}

OWN_DIRS_PERMS+=	${ZPUSHSTATEDIR}	\
			${APACHE_USER} ${APACHE_GROUP} 0750
OWN_DIRS_PERMS+=	${ZPUSHLOGDIR} \
			${APACHE_USER} ${APACHE_GROUP} 0750

CONF_FILES_PERMS+=	${EGDIR}/config.php ${PKG_SYSCONFDIR}/config.php \
			${REAL_ROOT_USER} ${APACHE_GROUP} 0640
CONF_FILES_PERMS+=	${EGDIR}/z-push.conf ${PKG_SYSCONFDIR}/z-push.conf \
			${REAL_ROOT_USER} ${APACHE_GROUP} 0640

REPLACE_INTERPRETER+=	php
REPLACE.php.old=	.*php
REPLACE.php.new=	${PREFIX}/bin/php
REPLACE_FILES.php=	z-push-admin.php
REPLACE_FILES.php+=	z-push-top.php
REPLACE_FILES.php+=	backend/zarafa/listfolders.php
REPLACE_FILES.php+=	tools/migrate-2.0.x-2.1.0.php

SUBST_CLASSES+=		conf
SUBST_STAGE.conf=	pre-configure
SUBST_FILES.conf=	${WRKDIR}/z-push.conf
SUBST_VARS.conf=	ZPUSHDIR
SUBST_MESSAGE.conf=	Fixing Z-push directory path for apache configuration.

SUBST_CLASSES+=			state-dir
SUBST_STAGE.state-dir=		pre-configure
SUBST_FILES.state-dir=		config.php
SUBST_VARS.state-dir=		ZPUSHSTATEDIR
SUBST_MESSAGE.state-dir=	Fixing Z-push state directory path.

post-extract:
	${CP} ${FILESDIR}/z-push.conf ${WRKDIR}/z-push.conf

pre-configure:
	${FIND} ${WRKSRC} -name "*.orig" -print | ${XARGS} ${RM} -f
	${CHMOD} -x ${WRKSRC}/lib/syncobjects/syncresolverecipient.php

do-install:
	${INSTALL_DATA} ${WRKSRC}/config.php	\
		${DESTDIR}${EGDIR}/config.php
	${INSTALL_DATA} ${WRKDIR}/z-push.conf	\
		${DESTDIR}${EGDIR}/z-push.conf

	cd ${WRKSRC} && pax -rwpam . ${DESTDIR}${ZPUSHDIR}

.for f in INSTALL LICENSE
	${MV} ${DESTDIR}${ZPUSHDIR}/${f} ${DESTDIR}${DOCDIR}
.endfor

	${LN} -sf ${ZPUSHDIR}/z-push-top.php	\
		${DESTDIR}${PREFIX}/bin/z-push-top
	${LN} -sf ${ZPUSHDIR}/z-push-admin.php	\
		${DESTDIR}${PREFIX}/bin/z-push-admin
	${LN} -sf ${PKG_SYSCONFDIR}/config.php	\
		${DESTDIR}${ZPUSHDIR}/config.php

.include "../../lang/php/phpversion.mk"
.include "../../mk/bsd.pkg.mk"