aboutsummaryrefslogtreecommitdiffstats
path: root/www/openacs/Makefile
blob: ad768e7851d5fdf5be3e56651da9473bf6cbc78e (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
# New ports collection makefile for:    openACS
# Date created:         July 2005
# Whom:                 Aldert Nooitgedagt <aldert@nooitgedagt.net>
#
# $FreeBSD$
#

PORTNAME?=  openacs
PORTVERSION?=   5.1.5
PORTREVISION?=  2
CATEGORIES= www
MASTER_SITES?=  http://openacs.org/projects/openacs/download/download/

MAINTAINER?=    aldert@nooitgedagt.net
COMMENT?=   A modular web application platform for high traffic communities

OPENACS_USER?=  service0
OPENACS_GROUP=  web
PG_USER=    pgsql

DATADIR=    ${PREFIX}/share/${OPENACS_USER}
EXAMPLESDIR=    ${PREFIX}/share/examples/${OPENACS_USER}
OPENACSBASE=    ${PREFIX}/share
VIRTUALBASE=    /var/lib
AOLSERVERBASE=  ${LOCALBASE}/aolserver
DTSERVICEBASE=  /var/service
RCCONF=     /etc/rc.conf

IP_ADDRESS= 0.0.0.0

USE_RC_SUBR=    YES
PKGINSTALL= ${WRKDIR}/pkg-install
PKGMESSAGE= ${WRKDIR}/pkg-message
PKGDEINSTALL=   ${WRKDIR}/pkg-deinstall
.if defined(WITH_POSTCONFIG)
POSTCONFIG= true
PKGNAMESUFFIX=  -withconfig
.endif

.if defined(WITH_DT)
DT=     true
RUN_DEPENDS+=   ${LOCALBASE}/bin/supervise:${PORTSDIR}/sysutils/daemontools
.endif

SUB_FILES=  pkg-install pkg-message pkg-deinstall post-config
SUB_LIST+=  RCCONF=${RCCONF} POSTCONFIG=${POSTCONFIG} \
        OPENACSBASE=${OPENACSBASE} OPENACS_GROUP=${OPENACS_GROUP} \
        OPENACS_USER=${OPENACS_USER} DB=${DB} PGDATA=${PGDATA} \
        PG_USER=${PG_USER} PGBASE=${PGBASE} \
        DTSERVICEBASE=${DTSERVICEBASE} DT=${DT} \
        AOLSERVERBASE=${AOLSERVERBASE} VIRTUALBASE=${VIRTUALBASE}

RUN_DEPENDS+=   ${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash \
        ${LOCALBASE}/lib/libtcl84.so.1:${PORTSDIR}/lang/tcl84-thread \
        ${LOCALBASE}/lib/libreadline.so:${PORTSDIR}/devel/readline \

.if defined(WITH_ORACLE)
BROKEN=     "Oracle not supported yet"
DB=     ORA
.else
DB=     PG
PGBASE=     ${LOCALBASE}
PGDATA=     ${LOCALBASE}/pgsql/data
RUN_DEPENDS+=   ${LOCALBASE}/lib/libpq.so:${PORTSDIR}/databases/postgresql74-server \
        ${LOCALBASE}/aolserver/bin/nsd:${PORTSDIR}/www/aolserver-openacs-pg
.endif

RUN_DEPENDS+=   ${LOCALBASE}/lib/tdom0.8.0/libtdom0.8.0.so:${PORTSDIR}/www/tdom \
        ${LOCALBASE}/tclwebtest-1.0/tclwebtest:${PORTSDIR}/www/tclwebtest

USE_LINUX=  YES

NO_BUILD=   YES

REINPLACE_ARGS= -i "" -e

PLIST_FILES=    ${EXAMPLESDIR:S,^${PREFIX}/,,}/svscan.sh \
        ${EXAMPLESDIR:S,^${PREFIX}/,,}/restart-aolserver \
        ${EXAMPLESDIR:S,^${PREFIX}/,,}/svgroup \
        ${EXAMPLESDIR:S,^${PREFIX}/,,}/nsd-postgres \
        ${EXAMPLESDIR:S,^${PREFIX}/,,}/nsd-oracle \
        ${EXAMPLESDIR:S,^${PREFIX}/,,}/post-config.sh

pre-install:
    @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL

do-install:
    @${MKDIR} ${EXAMPLESDIR}
    @${MKDIR} ${OPENACSBASE}
    @${MKDIR} ${VIRTUALBASE}

    @${ECHO_CMD} "Installing files"
    @${CP} -R ${WRKSRC} ${OPENACSBASE}/${OPENACS_USER}

    @${TEST} -e ${VIRTUALBASE}/aolserver || ${LN} -s ${OPENACSBASE} ${VIRTUALBASE}/aolserver
    @${TEST} -L ${VIRTUALBASE}/aolserver || ${ECHO_MSG} "${VIRTUALBASE}/aolserver is no symbolic link"

    @${INSTALL_SCRIPT} ${OPENACSBASE}/${OPENACS_USER}/packages/acs-core-docs/www/files/nsd-postgres.txt ${EXAMPLESDIR}/nsd-postgres
    @${INSTALL_SCRIPT} ${OPENACSBASE}/${OPENACS_USER}/packages/acs-core-docs/www/files/nsd-oracle.txt ${EXAMPLESDIR}/nsd-oracle
    @${INSTALL_SCRIPT} ${OPENACSBASE}/${OPENACS_USER}/packages/acs-core-docs/www/files/restart-aolserver.txt ${EXAMPLESDIR}/restart-aolserver
    @${INSTALL_SCRIPT} ${FILESDIR}/svscan.sh ${EXAMPLESDIR}/svscan.sh
    @${INSTALL_SCRIPT} ${OPENACSBASE}/${OPENACS_USER}/packages/acs-core-docs/www/files/svgroup.txt ${EXAMPLESDIR}/svgroup
    @${INSTALL_SCRIPT} ${WRKDIR}/post-config ${EXAMPLESDIR}/post-config.sh

post-install:
    @${REINPLACE_CMD} "\
        s|/usr/local/aolserver|${AOLSERVERBASE}|g; \
        s|/bin/bash|/bin/sh|g; \
        " ${EXAMPLESDIR}/nsd-postgres ${EXAMPLESDIR}/nsd-oracle
    @${REINPLACE_CMD} "\
        s|service0|${OPENACS_USER}|g; \
        s|\[ns_info address\]|${IP_ADDRESS}|g; \
        s|/var/lib/aolserver|${OPENACSBASE}|g; \
        s|/usr/local/aolserver|${AOLSERVERBASE}|g; \
        " ${OPENACSBASE}/${OPENACS_USER}/etc/config.tcl
    @${REINPLACE_CMD} "\
        s|service0|${OPENACS_USER}|g; \
        s|/usr/local/aolserver/bin|${EXAMPLESDIR}|g; \
        " ${OPENACSBASE}/${OPENACS_USER}/etc/daemontools/run

    @${ECHO_CMD} "@unexec rm -f ${DATADIR}/log/${OPENACS_USER}* 2>&1 > /dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rm -f ${DATADIR}/log/error.log* 2>&1 > /dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rm -Rf ${DATADIR}/apm-workspace 2>&1 > /dev/null || true" >> ${TMPPLIST}
    @${ECHO_CMD} "@unexec rm -Rf ${DATADIR}/etc/daemontools/supervise 2>&1 > /dev/null || true" >> ${TMPPLIST}
    @${FIND} -s ${WRKSRC} -not -type d \
        | ${SED} -ne 's,^${WRKSRC},${DATADIR:S,^${PREFIX}/,,},p' >> ${TMPPLIST}
    @${FIND} -s -d ${WRKSRC} -type d \
        | ${SED} -ne 's,^${WRKSRC},@dirrm ${DATADIR:S,^${PREFIX}/,,},p' >> ${TMPPLIST}
    @${ECHO_CMD} "@dirrm ${EXAMPLESDIR:S,^${PREFIX}/,,}" >> ${TMPPLIST}

    @if [ ${DT} ] ; then \
        ${MKDIR} ${DTSERVICEBASE} ; \
        ${TEST} -L ${DTSERVICEBASE}/${OPENACS_USER} || ${LN} -s ${OPENACSBASE}/${OPENACS_USER}/etc/daemontools ${DTSERVICEBASE}/${OPENACS_USER} ; \
        ${ECHO_CMD} "@cd ${DTSERVICEBASE}" >> ${TMPPLIST} ; \
        ${ECHO_CMD} "${OPENACS_USER}" >> ${TMPPLIST} ; \
        ${ECHO_CMD} "@unexec rmdir ${DTSERVICEBASE} 2>&1 > /dev/null || true" >> ${TMPPLIST} ; \
    fi

    @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
    @${CAT} ${PKGMESSAGE}

.include <bsd.port.mk>