aboutsummaryrefslogtreecommitdiffstats
path: root/www/geronimo/Makefile
blob: 75585ec1f1e66636a073565a894bde0007c9f42d (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
# New ports collection makefile for:    geronimo
# Date created:     26 Apr 2007
# Whom:         Nemo Liu <nemoliu@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=   geronimo
PORTVERSION=    2.1.4
CATEGORIES= www devel java
MASTER_SITES=   ${MASTER_SITE_APACHE}
MASTER_SITE_SUBDIR= geronimo/${PORTVERSION}
DISTNAME=   ${PORTNAME}-${WEBSERVER}-javaee5-${PORTVERSION}-bin

MAINTAINER= jonc@chen.org.nz
COMMENT=    Open-source Java EE 5 application server

USE_JAVA=   yes
JAVA_VERSION=   1.5+
NO_BUILD=   YES

USE_RC_SUBR=    geronimo2.sh
SUB_FILES=  pkg-install pkg-deinstall

OPTIONS=    TOMCAT6 "Use Tomcat instead of default Jetty" off

.include <bsd.port.pre.mk>

.if defined(WITH_TOMCAT6)
WEBSERVER=  tomcat6
.else
WEBSERVER=  jetty6
.endif

MAJOR_VER=  ${PORTVERSION:C/\..*//}
APP_HOME?=  ${PREFIX}/${PKGBASE}${MAJOR_VER}
LOG_DIR=    ${APP_HOME}/var/log
APP_TITLE=  Geronimo
APP_SHORTNAME=  geronimo${MAJOR_VER}
GERONIMO_USER?= www
GERONIMO_GROUP?=www
GERONIMO_OUT=   ${LOG_DIR}/geronimo.out
PID_FILE=   /var/run/${APP_SHORTNAME}.pid
WRKDIR?=    ${WRKDIRPREFIX}${.CURDIR}/work
WRKSRC=     ${WRKDIR}/${DISTNAME:S/-bin//}
JAR_FILE=   bin/server.jar
LATEST_LINK=    ${APP_SHORTNAME}
PLIST_FILES=    ${GERONIMO_OUT:S,^${PREFIX}/,,}

SUB_LIST=   GERONIMO_HOME=${APP_HOME} \
        APP_SHORTNAME=${APP_SHORTNAME} \
        APP_TITLE="${APP_TITLE}" \
        GROUP=${GERONIMO_GROUP} \
        HTTP_PORT=${HTTP_PORT} \
        JAR_FILE=${JAR_FILE} \
        PID_FILE=${PID_FILE} \
        GERONIMO_OUT=${GERONIMO_OUT} \
        USER=${GERONIMO_USER} \
        GERONIMO_VERSION=${MAJOR_VER} \
        GERONIMO_OUT=${GERONIMO_OUT} \
        JAVA_HOME=${JAVA_HOME}

pre-patch:
    @${ECHO_MSG} "Installation settings:"
    @${ECHO_MSG} "   Destination directory:    ${APP_HOME}"
    @${ECHO_MSG} "   Location of JDK:          ${JAVA_HOME}"
    @${ECHO_MSG} "   Location of Java port:    ${JAVA_PORT}"
    @${ECHO_MSG} "   Running as (user/group):  ${GERONIMO_USER}/${GERONIMO_GROUP}"
    @${ECHO_MSG} "   Logfile:          ${GERONIMO_OUT}"

post-patch:
    @${ECHO_MSG} -n ">> Removing unneeded files..."
    @${RM} -f `${FIND} ${WRKSRC} -name '*.bat'` `${FIND} ${WRKSRC} -name '*.orig'` `${FIND} ${WRKSRC} -name '*.exe'`
    @${ECHO_MSG} " [ DONE ]"

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

do-install:
    ${MKDIR} ${APP_HOME} && ${CHOWN} ${GERONIMO_USER}:${GERONIMO_GROUP} ${APP_HOME}
    @(cd ${WRKSRC} && ${FIND} . |\
         ${CPIO} -pdmu -R ${GERONIMO_USER}:${GERONIMO_GROUP} ${APP_HOME})
    ${INSTALL} -o ${GERONIMO_USER} -g ${GERONIMO_GROUP} -m 0644 /dev/null ${GERONIMO_OUT}
post-install:
    @${ECHO_MSG} "${APP_TITLE} ${PORTVERSION} has been installed in ${APP_HOME}."
    @${FIND} -s ${WRKSRC} -not -type d | \
         ${SED} -ne 's,^${WRKSRC},${APP_HOME:S,${PREFIX}/,,},p' >> ${TMPPLIST}
    @${FIND} -s -d ${WRKSRC} -type d | \
         ${SED} -ne 's,^${WRKSRC},@dirrm ${APP_HOME:S,${PREFIX}/,,},p' >> ${TMPPLIST}

.include <bsd.port.post.mk>