Tweak www/limesurvey version 1.91_1
[dports.git] / www / limesurvey / Makefile
1 # Created by: janos.mohacsi@bsd.hu
2 # $FreeBSD$
3
4 PORTNAME=       limesurvey
5 PORTVERSION=    1.91
6 PORTREVISION=   1
7 CATEGORIES=     www
8 MASTER_SITES=   SF/${PORTNAME}/1._LimeSurvey_stable/${PORTVERSION}+/
9 DISTNAME=       ${PORTNAME}${PORTVERSION:S^.^^}plus-build10232-20110608
10
11 MAINTAINER=     jmohacsi@bsd.hu
12 COMMENT=        PHP-based survey building and runing system
13
14 LICENSE=        GPLv2
15
16 USES=           cpe
17
18 # http://docs.limesurvey.org/Installation&structure=English+Instructions+for+LimeSurvey
19 OPTIONS_DEFINE=         PGSQL GD LDAP ZIP
20 OPTIONS_DEFAULT=        GD
21
22 PGSQL_DESC=             Use PostgreSQL (instead of MySQL)
23 GD_DESC=                Install PHP gd extension
24 LDAP_DESC=              Install PHP LDAP extension
25 ZIP_DESC=               Install PHP zip extension
26
27 .include <bsd.port.options.mk>
28
29 # http://docs.limesurvey.org/Installation&structure=English+Instructions+for+LimeSurvey#Make_sure_you_can_use_LimeSurvey_on_your_website
30 .if ${PORT_OPTIONS:MPGSQL}
31 USES+=          pgsql
32 USE_PHP=        pgsql
33 .else
34 # server is not necessary on this host.
35 #USE_MYSQL=     server
36 USE_MYSQL=      client
37 USE_PHP=        mysql
38 .endif
39 .if ${PORT_OPTIONS:MGD}
40 USE_PHP+=       gd
41 .endif
42 .if ${PORT_OPTIONS:MLDAP}
43 USE_PHP+=       ldap
44 .endif
45 .if ${PORT_OPTIONS:MZIP}
46 USE_PHP+=       zip
47 .endif
48 USE_PHP+=       ctype dom iconv json mbstring pcre \
49                 simplexml session xmlwriter
50 WANT_PHP_WEB=yes
51
52 WWWDOCROOT?=            www
53 PHPSURVEYORURL?=        ${PORTNAME}
54
55 WRKSRC=         ${WRKDIR}/${PORTNAME}
56 NO_BUILD=       yes
57 SUB_FILES=      pkg-message
58 SUB_LIST=       PHPSURVEYORURL="${PHPSURVEYORURL}" \
59                 PHPSURVEYORDIR="${PHPSURVEYORDIR}"
60
61 PHPSURVEYORDIR= ${WWWDOCROOT}/${PHPSURVEYORURL}
62
63 do-install:
64         ${MKDIR} "${STAGEDIR}${WWWDIR}"
65 .if ${PORT_OPTIONS:MPGSQL}
66         ${SED} -E \
67           -e 's/^(\$$databasetype[[:space:]]*=[[:space:]]*'"')mysql('"'.*)$$/\1postgres\2/'     \
68           -e 's/^(\$$databaseuser[[:space:]]*=[[:space:]]*'"')root('"'.*)$$/\1pgsql\2/' \
69           "${WRKSRC}"/config.php >"${WRKSRC}"/config.php-dist
70         ${RM} "${WRKSRC}"/config.php
71 .else
72         ${MV} "${WRKSRC}"/config.php "${WRKSRC}"/config.php-dist
73 .endif
74         @cd "${WRKSRC}" && ${COPYTREE_SHARE} . "${STAGEDIR}${WWWDIR}"
75         ${MKDIR} "${STAGEDIR}${WWWDIR}"/tmp
76         ${CHMOD} 755 "${STAGEDIR}${WWWDIR}"/tmp
77         ${CHMOD} 755 "${STAGEDIR}${WWWDIR}"/templates
78         ${CHMOD} 755 "${STAGEDIR}${WWWDIR}"/upload
79         ${CHMOD} -R go-w "${STAGEDIR}${WWWDIR}"/admin
80
81 post-install:
82         @${ECHO_CMD} "@group ${WWWGRP}" >> ${TMPPLIST}
83         @${FIND} -s -d ${STAGEDIR}${WWWDIR}/admin -type f -print | \
84                 ${SED} -e "s#${STAGEDIR}${PREFIX}/##g" >> ${TMPPLIST}
85         @${FIND} -s -d ${STAGEDIR}${WWWDIR}/admin -type d -print | \
86                 ${SED} -E -e "s#${STAGEDIR}${PREFIX}/#@dir #g" >> ${TMPPLIST}
87         @${ECHO_CMD} "@owner ${WWWOWN}" >> ${TMPPLIST}
88         @${FIND} -s -d ${STAGEDIR}${WWWDIR} ! -path "${STAGEDIR}${WWWDIR}/admin/*" -type f -print | \
89                 ${SED} -e "s#${STAGEDIR}${PREFIX}/##g" >> ${TMPPLIST}
90         @${FIND} -s -d ${STAGEDIR}${WWWDIR} -type d ! -path "${STAGEDIR}${WWWDIR}/admin*" -print | \
91                 ${SED} -E -e "s#${STAGEDIR}${PREFIX}/#@dir #g" >> ${TMPPLIST}
92         @${ECHO_CMD} "@owner" >> ${TMPPLIST}
93         @${ECHO_CMD} "@group" >> ${TMPPLIST}
94
95 .include <bsd.port.mk>