aboutsummaryrefslogtreecommitdiffstats
path: root/devel/antlr/Makefile
blob: 55145f58604ade488236ffcb0c9eb2a1860647c1 (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
# New ports collection makefile for:    antlr
# Date created:     5 July 2002
# Whom:         Geoffrey Mainland <mainland@apeiron.net>
#
# $FreeBSD$
#

PORTNAME=   antlr
PORTVERSION=    2.7.5
CATEGORIES= devel java
MASTER_SITES=   http://www.antlr.org/download/

MAINTAINER= ports@FreeBSD.org
COMMENT=    ANother Tool for Language Recognition

RUN_DEPENDS=    java:${PORTSDIR}/java/javavmwrapper

CONFLICTS=  pccts*

USE_GMAKE=  yes
USE_JAVA=   yes
JAVA_VERSION=   1.4+

HAS_CONFIGURE=  yes
CONFIGURE_ENV=  JAVAC="${JAVAC}" JAR="${JAR}" JAVA="${JAVA}" CLASSPATH="${PORT_CLASSPATH}"

PORT_CLASSPATH= ${WRKSRC}/antlrall.jar:.

EXAMPLES=   cpp java
.if !defined(NOPORTDOCS)
PORTDOCS=   ANTLRException.gif closure.gif cpp-runtime.html \
        csharp-runtime.html err.html glossary.html hidden.stream.gif \
        index.html inheritance.html j-guru-blue.jpg jguru-logo.gif \
        lexer.html lexer.to.parser.tokens.gif logo.gif metalang.html \
        optional.gif options.html posclosure.gif runtime.html sor.html \
        stream.perspectives.gif stream.selector.gif \
        stream.splitter.gif streams.html subrule.gif trees.html \
        vocab.html
.endif
PLIST_FILES=    bin/antlr %%JAVAJARDIR%%/antlr.jar

.include <bsd.port.pre.mk>

post-extract:
    (cd ${WRKSRC} && ${CP} antlr-${PORTVERSION}.jar antlrall.jar)
    ${CHMOD} -R +w ${WRKSRC}

post-configure:
    @${SED} "s|%%JAVAJARDIR%%|${JAVAJARDIR}| ; s|%%LOCALBASE%%|${LOCALBASE}| ; s|%%JAVA_VERSION%%|${JAVA_VERSION}|" ${FILESDIR}/antlr.sh >${WRKDIR}/antlr.sh

.if defined(WITH_BUILT_JAVA_LIB)
pre-build:
    (cd ${WRKSRC} && ${JAVA} -classpath "${PORT_CLASSPATH}" antlr.build.Tool build)
    (cd ${WRKSRC} && ${JAVA} -classpath "${PORT_CLASSPATH}" antlr.build.Tool jar)
.endif

do-install:
    @${ECHO_MSG} -n ">> Installing JAR as ${JAVAJARDIR}/${PORTNAME}.jar..."
    @${MKDIR} ${JAVAJARDIR}
    @${INSTALL_DATA} ${WRKSRC}/antlr-${PORTVERSION}.jar ${JAVAJARDIR}/${PORTNAME}.jar
    @${ECHO_MSG} " [ DONE ]"
    @${ECHO_MSG} -n ">> Installing antlr script as ${PREFIX}/bin/${PORTNAME}..."
    @${INSTALL_SCRIPT} ${WRKDIR}/antlr.sh ${PREFIX}/bin/antlr
    @${ECHO_MSG} " [ DONE ]"
    @${ECHO_MSG} ">> Installing native files..."
    @(cd ${WRKSRC}/lib/cpp && ${GMAKE} install)
    @${ECHO_MSG} "   [ DONE ]"
.if !defined(NOPORTDOCS)
    @${ECHO_MSG} -n ">> Installing documentation in ${DOCSDIR}..."
    @${MKDIR} ${DOCSDIR}
    @cd ${WRKSRC}/doc && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}/
    @${ECHO_MSG} " [ DONE ]"
.endif
    @${ECHO_MSG} -n ">> Installing examples in ${EXAMPLESDIR}..."
    @${MKDIR} ${EXAMPLESDIR}
    @cd ${WRKSRC}/examples && ${FIND} ${EXAMPLES} \
      | ${CPIO} -pdmu -R ${SHAREOWN}:${SHAREGRP} ${EXAMPLESDIR} > /dev/null 2>&1
    @${ECHO_MSG} " [ DONE ]"

post-install:
    @${FIND} -s ${EXAMPLES:S,^,${WRKSRC}/examples/,} -not -type d | \
        ${SED} -ne 's,^${WRKSRC}/examples,${EXAMPLESDIR:S,${PREFIX}/,,},p' >> ${TMPPLIST}
    @${FIND} -s -d ${EXAMPLES:S,^,${WRKSRC}/examples/,} -type d | \
        ${SED} -ne 's,^${WRKSRC}/examples,@dirrm ${EXAMPLESDIR:S,${PREFIX}/,,},p' >> ${TMPPLIST}
    @${ECHO} "@dirrm ${EXAMPLESDIR:S,${PREFIX}/,,}" >> ${TMPPLIST}

.include <bsd.port.post.mk>