summaryrefslogtreecommitdiffstats
path: root/devel/antlr/Makefile
blob: 723a7f8767a66bfd3e5c665c0ffdfc2705d60510 (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
# Created by: Geoffrey Mainland <mainland@apeiron.net>
# $FreeBSD$

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

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

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

CONFLICTS=	pccts-[0-9]*

USE_GMAKE=	yes
USE_JAVA=	yes
JAVA_VERSION=	1.6+

OPTIONS_DEFINE=	PYTHON DOCS

HAS_CONFIGURE=	yes
CONFIGURE_ENV=	JAVAC="${JAVAC}" JAR="${JAR}" JAVA="${JAVA}" CLASSPATH="${PORT_CLASSPATH}"
CONFIGURE_ARGS=	--disable-csharp --prefix=${PREFIX}

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

EXAMPLES=	cpp java

NO_STAGE=	yes
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MDOCS}
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

.if ${PORT_OPTIONS:MPYTHON}
USE_PYTHON=	2.2+
PORTDOCS+=	python-runtime.html
ANTLR_PYTHON=	${WRKSRC}/lib/python
PLIST_SUB+=	WITH_PYTHON=""
.else
PLIST_SUB+=	WITH_PYTHON="@comment "
.endif

post-extract:
	(cd ${WRKSRC} && ${CP} antlr.jar antlrall.jar)

post-configure:
	${SED} -e 's|%%JAVAJARDIR%%|${JAVAJARDIR}|' \
	-e 's|%%LOCALBASE%%|${LOCALBASE}|' \
	-e 's|%%JAVA_VERSION%%|${JAVA_VERSION}|' ${FILESDIR}/antlr.sh > ${WRKDIR}/antlr.sh
.if ${PORT_OPTIONS:MPYTHON}
	(cd ${ANTLR_PYTHON} && ${PYTHON_CMD} setup.py config)
.endif

.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

.if ${PORT_OPTIONS:MPYTHON}
post-build:
	(cd ${ANTLR_PYTHON} && ${PYTHON_CMD} setup.py build && \
	${PYTHON_CMD} ${PYTHON_LIBDIR}/compileall.py ${ANTLR_PYTHON})
.endif

do-install:
	@${ECHO_MSG} -n ">> Installing JAR as ${JAVAJARDIR}/${PORTNAME}.jar..."
	@${MKDIR} ${JAVAJARDIR}
	@${INSTALL_DATA} ${WRKSRC}/antlr.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 ${PORT_OPTIONS:MPYTHON}
	@${ECHO_MSG} -n ">> Installing Python runtime files..."
	@(cd ${ANTLR_PYTHON} && ${PYTHON_CMD} setup.py install)
	@${ECHO_MSG} "   [ DONE ]"
.endif
.if ${PORT_OPTIONS:MDOCS}
	@${ECHO_MSG} -n ">> Installing documentation in ${DOCSDIR}..."
	@${MKDIR} ${DOCSDIR}
	@cd ${WRKSRC}/doc && ${INSTALL_DATA} ${PORTDOCS} ${DOCSDIR}/
	@${ECHO_MSG} " [ DONE ]"
.endif

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