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