aboutsummaryrefslogtreecommitdiffstats
path: root/www/openacs/Makefile
blob: 8027021f0e16016278000fcc856485b5577a388f (plain) (blame)
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
135
136
137
138
139
140
141
142
143
# Created by: Aldert Nooitgedagt <aldert@nooitgedagt.net>
# $FreeBSD$

PORTNAME?=  openacs
DISTVERSION?=   5.7.0
CATEGORIES= www
MASTER_SITES?=  http://openacs.org/projects/openacs/download/download/
EXTRACT_SUFX=   .tgz?revision_id=${DIST_REV_ID}

MAINTAINER?=    ports@FreeBSD.org
COMMENT?=   A modular web application platform for communities

LICENSE=    GPLv2

DIST_REV_ID?=   3646409

AOLSERVERBASE?= ${LOCALBASE}/aolserver
RUN_DEPENDS+=   ${AOLSERVERBASE}/bin/nsopenssl.so:${PORTSDIR}/security/aolserver-nsopenssl \
        ${AOLSERVERBASE}/bin/nssha1.so:${PORTSDIR}/security/aolserver-nssha1 \
        ${AOLSERVERBASE}/bin/nspostgres.so:${PORTSDIR}/databases/aolserver-nspostgres \
        ${AOLSERVERBASE}/modules/tcl/xotcl.tcl:${PORTSDIR}/www/aolserver-xotcl \
        dtplite:${PORTSDIR}/devel/tcllib \
        ${LOCALBASE}/lib/tdomConfig.sh:${PORTSDIR}/www/tdom

USE_RC_SUBR?=   ${PORTNAME}
NO_BUILD=   yes

OPENACS_USER?=  ${PORTNAME}
OPENACS_GROUP?= ${PORTNAME}
PGUSER?=    pgsql
OPENACS_DB?=    ${PORTNAME}
OPENACSBASE?=   ${PREFIX}/openacs
OPENACSNAME?=   OpenACS
SU?=        /usr/bin/su
PGREP?=     /usr/bin/pgrep
PW?=        /usr/sbin/pw

BASE_INSTALL?=  bin content-repository-content-files log packages tcl www
PLIST=      ${WRKDIR}/plist.tmp

SUB_FILES+= pkg-install pkg-deinstall pkg-message ${PORTNAME} \
        create_sampledb.sh adjust_pgsql_conf.sh
PKGINSTALL= ${WRKDIR}/pkg-install
PKGMESSAGE= ${WRKDIR}/pkg-message
PKGDEINSTALL=   ${WRKDIR}/pkg-deinstall

PORTDOCS=   *

OPTIONS_DEFINE= DOCS TCLTHREAD TCLWEBTEST
OPTIONS_DEFAULT=TCLTHREAD TCLWEBTEST
TCLTHREAD_DESC= Depend on tclthread
TCLWEBTEST_DESC=Depend on tclwebtest

NO_STAGE=   yes
.include <bsd.port.options.mk>

# Parse ${PORTSDIR}/UIDs and GIDs for the defaults
USER!=  ${GREP} -E '^${OPENACS_USER}:' ${PORTSDIR}/UIDs | \
        ${SED} -Ee 's/^([^:]*):([^:]*):([^:]*):([^:]*)::0:0:([^:]*):([^:]*):([^:]*)$$/USER="\1" UID="\3" GECOS="\5" HOME="\6" SHELL="\7"/'
GROUP!= ${GREP} -E '^${OPENACS_GROUP}:' ${PORTSDIR}/GIDs | \
        ${SED} -Ee 's/^([^:]*):([^:]*):([^:]*):$$/GROUP="\1" GID="\3"/'

# Apply the defaults where necessary
OPENACS_USER?=  ${USER:MUSER*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_UID?=   ${USER:MUID*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_GECOS?= ${USER:MGECOS*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_HOME?=  ${USER:MHOME*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_SHELL?= ${USER:MSHELL*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_GROUP?= ${GROUP:MGROUP*:C/^[^=]*=\"([^\"]*)\"$/\1/}
OPENACS_GID?=   ${GROUP:MGID*:C/^[^=]*=\"([^\"]*)\"$/\1/}

SUB_LIST+=  OPENACS_USER=${OPENACS_USER} OPENACS_UID=${OPENACS_UID} \
        OPENACS_GECOS="${OPENACS_GECOS}" \
        OPENACS_HOME="${OPENACS_HOME}" \
        OPENACS_SHELL="${OPENACS_SHELL}" \
        OPENACS_GROUP=${OPENACS_GROUP} \
        OPENACS_GID=${OPENACS_GID} \
        OPENACSBASE=${OPENACSBASE} OPENACS_DB=${OPENACS_DB} \
        PGUSER=${PGUSER} AOLSERVERBASE=${AOLSERVERBASE} \
        PORTNAME=${PORTNAME} OPENACSNAME=${OPENACSNAME} \
        SU=${SU} PGREP=${PGREP} AWK=${AWK} CP=${CP} GREP=${GREP} \
        PW=${PW} CHOWN=${CHOWN} CHMOD=${CHMOD}

.if ${PORT_OPTIONS:MTCLTHREAD}
TCLTHREAD_VER?= 2.7.0
RUN_DEPENDS+=   ${LOCALBASE}/lib/thread${TCLTHREAD_VER}/libthread.so.1:${PORTSDIR}/devel/tclthread
.endif

.if ${PORT_OPTIONS:MTCLWEBTEST}
RUN_DEPENDS+=   ${LOCALBASE}/bin/tclwebtest:${PORTSDIR}/www/tclwebtest
.endif

post-patch:
    @${SED} -e 's|service0|${OPENACS_USER}|' \
        -e 's|/var/www/$${server}|${OPENACSBASE}|' \
        -e 's|/usr/lib/aolserver4|${AOLSERVERBASE}|' \
        -e 's|127.0.0.1|0.0.0.0|' \
        ${WRKSRC}/etc/config.tcl > ${WRKDIR}/${PORTNAME}-config.tcl
pre-install:
    @ ${ECHO} "Generating plist"
    @ ${FIND} ${WRKSRC} ! -type d ! -path '${WRKSRC}/etc*' \
        ! -path '${WRKSRC}/readme.txt' ! -path '${WRKSRC}/license.txt' \
        ! -path '${WRKSRC}/ChangeLog' | \
        ${SED} 's|${WRKSRC}|${OPENACSBASE:S/${PREFIX}\///}|' > ${PLIST}
    @ ${ECHO} @unexec if cmp -hsz %D/%%EXAMPLESDIR%%/config.tcl %D/${OPENACSBASE:S/${PREFIX}\///}/etc/${PORTNAME}-config.tcl \; then ${RM} %D/${OPENACSBASE:S/${PREFIX}\///}/etc/${PORTNAME}-config.tcl \; fi >> ${PLIST}
    @ ${FIND} ${WRKSRC}/etc ! -type d | \
        ${SED} 's|${WRKSRC}/etc|%%EXAMPLESDIR%%|' >> ${PLIST}
    @ ${ECHO} @exec if ! [ -f ${OPENACSBASE:S/%D\///}/etc/${PORTNAME}-config.tcl ] \; then ${MKDIR} %D/${OPENACSBASE:S/${PREFIX}\///}/etc \; ${CP} %D/%%EXAMPLESDIR%%/config.tcl %D/${OPENACSBASE:S/${PREFIX}\///}/etc/${PORTNAME}-config.tcl \; fi >> ${PLIST}
    @ ${ECHO} @dirrmtry ${OPENACSBASE:S/${PREFIX}\///}/etc >> ${PLIST}
    @ ${FIND} ${WRKSRC} -type d ! -path '${WRKSRC}/etc*' | \
        ${SORT} -r | \
        ${SED} 's|${WRKSRC}|@dirrmtry ${OPENACSBASE:S/${PREFIX}\///}|' >> ${PLIST}
    @ ${FIND} ${WRKSRC}/etc -type d | \
        ${SED} 's|${WRKSRC}/etc|@dirrm %%EXAMPLESDIR%%|' | \
        ${SORT} -r >> ${PLIST}

do-install:
    @ ${ECHO} "Installing base files"
    @ ${MKDIR} ${OPENACSBASE}/etc
    @ ${TAR} -c -C ${WRKSRC} -f - ${BASE_INSTALL} | \
        ${TAR} -x -C ${OPENACSBASE} -f -
    @ ${ECHO} "Installing examples"
    @ ${MKDIR} ${EXAMPLESDIR}
    @ ${TAR} -c -C ${WRKSRC}/etc -f - . | ${TAR} -x -C ${EXAMPLESDIR} -f -
    @ ${ECHO} "Installing sample configuration file"
    @ ${INSTALL_DATA} ${WRKDIR}/${PORTNAME}-config.tcl ${EXAMPLESDIR}/config.tcl
    @ if ! [ -f ${OPENACSBASE}/etc/${PORTNAME}-config.tcl ]; then \
        ${INSTALL_DATA} ${WRKDIR}/${PORTNAME}-config.tcl ${OPENACSBASE}/etc/${PORTNAME}-config.tcl ; \
      fi
.if ${PORT_OPTIONS:MDOCS}
    @ ${ECHO} "Installing docs"
    @ ${MKDIR} ${DOCSDIR}
.for FILE in ChangeLog readme.txt license.txt
    @ ${INSTALL_DATA} ${WRKSRC}/${FILE} ${DOCSDIR}
.endfor
.for FILE in create_sampledb.sh adjust_pgsql_conf.sh
    @ ${INSTALL_SCRIPT} ${WRKDIR}/${FILE} ${DOCSDIR}
.endfor
.endif
    @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>