summaryrefslogtreecommitdiffstats
path: root/www/cocoon/Makefile
blob: f33a477e955793ae40cf9e12d708a1ac07489f9f (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
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
144
145
146
147
148
149
# New ports collection makefile for:	Cocoon
# Date created:		27 June 1999
# Whom:			Jun Kuriyama <kuriyama@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=	cocoon
PORTVERSION=	2.1.8
CATEGORIES=	www java
MASTER_SITES=	${MASTER_SITE_APACHE}
MASTER_SITE_SUBDIR=	${PORTNAME}
DISTNAME=	${PDISTNAME}-src

MAINTAINER=	jb.quenot@caraldi.com
COMMENT=	XML Web Development Framework

USE_RC_SUBR=		yes
USE_JAVA=		yes
JAVA_VERSION=		1.3+
USE_PYTHON=		1.6+
USE_REINPLACE=		YES
MAKE_ENV=		JAVA_HOME=${JAVA_HOME}
WRKSRC=			${WRKDIR}/${PDISTNAME}
APP_NAME?=		${PORTNAME}
APP_HOME?=		${PREFIX}/${APP_NAME}
LATEST_LINK=		${APP_NAME}
PLIST=			${WRKDIR}/pkg-plist
PKGMESSAGE=		${WRKDIR}/pkg-message
PDISTNAME=		${PORTNAME}-${PORTVERSION}
PKGINSTALL=		${WRKDIR}/pkg-install
PKGDEINSTALL=		${WRKDIR}/pkg-deinstall

COCOON_LIB=	${JAVASHAREDIR}/${APP_NAME}
PLIST_SUB+=	"COCOON_LIB=${COCOON_LIB}"

COPYDIRS=	*.txt tools/jetty tools/loader legal webapp

PORT?=		8888
PID_FILE?=	${APP_HOME}/${APP_NAME}.pid
RUNASUSER?=	www
RUNASUID?=	80
GROUP?=		www
GID?=		80
LOG_FILE?=	${APP_HOME}/${APP_NAME}.log

SUBSTITUTIONS=	\
	-e "s|%%APP_HOME%%|${APP_HOME}|g" \
	-e "s|%%APP_NAME%%|${APP_NAME}|g" \
	-e "s|%%RC_SUBR%%|${RC_SUBR}|g" \
	-e "s|%%PREFIX%%|${PREFIX}|g" \
	-e "s|%%PORT%%|${PORT}|g" \
	-e "s|%%COCOON_LIB%%|${COCOON_LIB}|g" \
	-e "s|%%JAVA_HOME%%|${JAVA_HOME}|g" \
	-e "s|%%JAVA%%|${JAVA}|g" \
	-e "s|%%PID_FILE%%|${PID_FILE}|g" \
	-e "s|%%RUNASUSER%%|${RUNASUSER}|g" \
	-e "s|%%RUNASUID%%|${RUNASUID}|g" \
	-e "s|%%GROUP%%|${GROUP}|g" \
	-e "s|%%GID%%|${GID}|g" \
	-e "s|%%LOG_FILE%%|${LOG_FILE}|g" \
	-e "s|%%PYTHON_CMD%%|${PYTHON_CMD}|g"

# Load options (before including bsd.port.pre.mk)
.include "${.CURDIR}/Makefile.options"

.include <bsd.port.pre.mk>

# Test for options
.include "${MASTERDIR}/Makefile.test-options"

.for BLOCK in ${BLOCKS}
BLOCKSEXP+=	-e 's/^include.block.${BLOCK}=.*$$/include.block.${BLOCK}=true/'
.endfor

post-configure:
	@${ECHO_MSG} "===> Configuring blocks: ${BLOCKS}"
	${SED} -e 's/.*include.block\(.*\)=.*$$/include.block\1=false/' < ${WRKSRC}/blocks.properties | \
	${SED} ${BLOCKSEXP} > ${WRKSRC}/local.blocks.properties
	${CP} ${WRKSRC}/build.properties ${WRKSRC}/local.build.properties
.if (! defined(WITH_DOCS))
	${REINPLACE_CMD} \
       	-e 's/^#\(exclude.webapp.documentation=\)/\1/' \
       	-e 's/^#\(exclude.webapp.javadocs=\)/\1/' \
       	-e 's/^#\(exclude.documentation=\)/\1/' \
       	-e 's/^#\(exclude.javadocs=\)/\1/' \
       	${WRKSRC}/local.build.properties
.endif
.if (! defined(WITH_SAMPLES))
	${REINPLACE_CMD} \
       	-e 's/^#\(exclude.webapp.samples=\)/\1/' \
       	-e 's/^#\(exclude.webapp.test-suite=\)/\1/' \
       	${WRKSRC}/local.build.properties
.endif
# Include Java source code into the binary jar files
.if (defined(WITH_SOURCES))
	${REINPLACE_CMD} \
       	-e 's/^#\(include.sources-in-jars=\)/\1/' \
       	${WRKSRC}/local.build.properties
.endif

pre-build:
	${CHMOD} a+rx ${WRKSRC}/build.sh

do-build:
	cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ./build.sh

post-build:
	${TEST} -h ${WRKSRC}/webapp || ${LN} -s ${WRKSRC}/build/webapp ${WRKSRC}/webapp

	@${ECHO_MSG} "===> Building packing list"
	@> ${PLIST}

	@cd ${WRKSRC} && ${FIND} -H ${COPYDIRS} -type f \
	| ${SED} -e "s|^|${APP_NAME}/|" >> ${PLIST}

	@cd ${WRKSRC} && ${FIND} -H -d ${COPYDIRS} -type d \
	| ${SED} -e "s|^|@dirrm ${APP_NAME}/|" >> ${PLIST}

	@${CAT} ${MASTERDIR}/pkg-plist >> ${PLIST}

	@${SED} ${SUBSTITUTIONS} ${FILESDIR}/pkg-install > ${PKGINSTALL}
	@${SED} ${SUBSTITUTIONS} ${FILESDIR}/pkg-deinstall > ${PKGDEINSTALL}

do-install:
	@${ECHO_MSG} "===> Installing ${COPYDIRS}"
	@${MKDIR} ${APP_HOME}
	@cd ${WRKSRC} && ${FIND} -H ${COPYDIRS} | ${CPIO} -pdmuL -R ${LIBOWN}:${LIBGRP} ${APP_HOME}

	@${ECHO_MSG} "===> Installing into ${PREFIX}/sbin"
	@${SED} ${SUBSTITUTIONS} ${WRKSRC}/cocoon.sh > ${WRKDIR}/${APP_NAME}.sh
	@${INSTALL_SCRIPT} ${WRKDIR}/${APP_NAME}.sh ${PREFIX}/sbin
	@${SED} ${SUBSTITUTIONS} ${FILESDIR}/${APP_NAME}ctl > ${WRKDIR}/${APP_NAME}ctl
	@${INSTALL_SCRIPT} ${WRKDIR}/${APP_NAME}ctl ${PREFIX}/sbin

	@${ECHO_MSG} "===> Installing ${PREFIX}/etc/rc.d/${APP_NAME}.sh"
	@${SED} ${SUBSTITUTIONS} ${FILESDIR}/${APP_NAME}.sh > ${WRKDIR}/${APP_NAME}.sh
	@${INSTALL_SCRIPT} ${WRKDIR}/${APP_NAME}.sh ${PREFIX}/etc/rc.d

post-install:
	@${SETENV} PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
	@${SED} ${SUBSTITUTIONS} ${MASTERDIR}/pkg-message > ${PKGMESSAGE}
	@${ECHO_CMD}
	@${ECHO_CMD} "********************************************************************************"
	@${FMT} -w80 ${PKGMESSAGE}
	@${ECHO_CMD} "********************************************************************************"
	@${ECHO_CMD}

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud