summaryrefslogtreecommitdiff
path: root/lang/dragonegg46-33/Makefile
blob: 75c6aedf38dcd9d1ece91f1ced4c5f7a10310558 (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
# $FreeBSD$

PORTNAME=	dragonegg
PORTVERSION=	3.3
PORTREVISION=	4
CATEGORIES=	lang devel
MASTER_SITES=	http://llvm.org/releases/${PORTVERSION}/
PKGNAMESUFFIX=	${USE_GCC:S/.//g}-${LLVM_SUFFIX}
DISTNAME=	dragonegg-${PORTVERSION}.src

MAINTAINER=	brooks@FreeBSD.org
COMMENT=	GCC plugin to use the LLVM backend

CONFLICTS=	dragonegg46-devel-3.3*

BUILD_DEPENDS+=	llvm-config${LLVM_SUFFIX}:${PORTSDIR}/devel/llvm${LLVM_SUFFIX}
RUN_DEPENDS+=	llvm-config${LLVM_SUFFIX}:${PORTSDIR}/devel/llvm${LLVM_SUFFIX}

LLVM_SUFFIX=	${PORTVERSION:S/.//g}

OPTIONS_DEFINE=	DOCS

USES=		compiler:features gmake
USE_GCC?=	4.6
USE_LDCONFIG=	yes
DOCSDIR=	${PREFIX}/share/doc/${UNIQUENAME}
UNIQUENAME=	${PORTNAME}${PKGNAMESUFFIX}

DRAGONEGG_RELEASE=	${PORTVERSION:C/\.r[0-9]*//}
DRAGONEGG_SO=		dragonegg-${DRAGONEGG_RELEASE}.so
DRAGONEGG_PATH=		${GCC_LIBDIR}/${DRAGONEGG_SO}
GCC_LIBDIR=		lib/${CC}

ALL_TARGET=
MAKE_ARGS=	GCC=${LOCALBASE}/bin/${CC} LLVM_CONFIG=llvm-config${LLVM_SUFFIX}

PLIST_FILES=		${GCC_LIBDIR}/${DRAGONEGG_SO}

.include <bsd.port.options.mk>

.if ${PORT_OPTIONS:MDOCS}
PORTDOCS=		README
.endif

.include <bsd.port.pre.mk>

.if ${COMPILER_FEATURES:Mlibc++}
IGNORE=	"Dragonegg can't work if LLVM was built with libc++"
.endif

post-patch:
	${REINPLACE_CMD} -e 's/%%CC%%/${CC}/' \
	    -e 's#%%PLUGINPATH%%#${LOCALBASE}/${DRAGONEGG_PATH}#' \
	    -e 's/arg-dragonegg/arg-dragonegg-${DRAGONEGG_RELEASE}/' \
	    ${WRKSRC}/README

do-install:
	${MKDIR} ${STAGEDIR}${LOCALBASE}/${GCC_LIBDIR}
	${INSTALL_LIB} ${WRKSRC}/dragonegg.so \
	    ${STAGEDIR}${LOCALBASE}/${GCC_LIBDIR}/${DRAGONEGG_SO}
.if ${PORT_OPTIONS:MDOCS}
	${MKDIR} ${STAGEDIR}${DOCSDIR}
	${INSTALL_DATA} ${WRKSRC}/README ${STAGEDIR}${DOCSDIR}
.endif

test:
	${CC} -fplugin=${PREFIX}/${DRAGONEGG_PATH} ${FILESDIR}/hello.c \
	    -o ${WRKDIR}/hello
	if [ "`${WRKDIR}/hello`" != "hello" ]; then \
		${ECHO_CMD} wrong answer from ${WRKDIR}/test/hello ;\
		${FALSE} ;\
	fi

.include <bsd.port.post.mk>