blob: b6845ccad5e41ec35e25f8088ebfb219aaf9cbeb (
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
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
|
# New ports collection makefile for: clang
# Date created: 24 Oct 2009
# Whom: Brooks Davis
#
# $FreeBSD$
#
PORTNAME= clang
PORTVERSION= 3.2
PORTREVISION= 2
CATEGORIES= lang devel
MASTER_SITES= http://llvm.org/releases/${PORTVERSION}/
DISTNAME= ${PORTNAME}-${PORTVERSION}.src
DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
${LLVM_SOURCE}
EXTRACT_ONLY= ${LLVM_SOURCE}
MAINTAINER= brooks@FreeBSD.org
COMMENT= C, Objective-C, and C++ compiler
CONFLICTS= clang-devel-[23]*
CLANG_NAME= clang-${PORTVERSION}.src
CLANG_SOURCE= ${CLANG_NAME}${EXTRACT_SUFX}
LLVM_NAME= llvm-${PORTVERSION}.src
LLVM_SOURCE= ${LLVM_NAME}${EXTRACT_SUFX}
WRKSRC= ${WRKDIR}/${LLVM_NAME}
BUILD_WRKSRC= ${WRKSRC}/tools/clang
INSTALL_WRKSRC= ${WRKSRC}/tools/clang
BUILD_DEPENDS+= llvm>=${PORTVERSION}:${PORTSDIR}/devel/llvm
RUN_DEPENDS+= llvm>=${PORTVERSION}:${PORTSDIR}/devel/llvm
.if defined(PACKAGE_BUILDING)
BUILD_DEPENDS+= runtest:${PORTSDIR}/misc/dejagnu
.endif
GNU_CONFIGURE= yes
USE_GMAKE= yes
USE_LDCONFIG= yes
USE_PERL5= yes
USE_PYTHON= yes
MAKE_JOBS_SAFE= yes
MAKE_ARGS= CLANG_TBLGEN=${WRKSRC}/${RELTYPE}/bin/clang-tblgen \
LLVMIncDir=${LOCALBASE}/include \
LLVMToolDir=${LOCALBASE}/bin \
LLVMLibDir=${LOCALBASE}/lib
OPTIONS_DEFINE= ASSERTS DOCS
ASSERTS_DESC= Enable assertions (thread unsafe)
CONFIGURE_ARGS+= --enable-optimized
MAN1= clang.1
PLIST_SUB+= PORTVERSION=${PORTVERSION}
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MASSERTS}
CONFIGURE_ARGS+= --enable-assertions
RELTYPE= Release+Asserts
.else
CONFIGURE_ARGS+= --disable-assertions
RELTYPE= Release
.endif
.if ${PORT_OPTIONS:MDOCS}
CONFIGURE_ARGS+= --enable-docs
.else
CONFIGURE_ARGS+= --disable-docs
.endif
.include <bsd.port.pre.mk>
.if ${ARCH} == "sparc64"
BROKEN= Does not compile on sparc64
.endif
post-extract:
cd ${WRKSRC}/tools && \
tar xf ${DISTDIR}/${CLANG_SOURCE} && \
${MV} ${CLANG_NAME} clang
post-patch:
${REINPLACE_CMD} -e 's|${PORTVERSION}svn|${PORTVERSION}|g' \
${WRKSRC}/configure
${REINPLACE_CMD} -e 's|\(PROJ_docsdir.*:=\).*$$|\1${DOCSDIR}|g' \
${WRKSRC}/Makefile.config.in
${REINPLACE_CMD} -e 's|\(PROJ_mandir.*:=\).*$$|\1${MANPREFIX}/man|g' \
${WRKSRC}/Makefile.config.in
${REINPLACE_CMD} -e 's|/usr/bin/env perl|${PERL}|' \
-e 's|%%DATADIR%%|${DATADIR}|' \
${WRKSRC}/tools/clang/tools/scan-build/ccc-analyzer \
${WRKSRC}/tools/clang/tools/scan-build/c++-analyzer \
${WRKSRC}/tools/clang/tools/scan-build/scan-build
${REINPLACE_CMD} -e 's|/usr/bin/env python|${PYTHON_CMD}|' \
${WRKSRC}/tools/clang/tools/scan-view/scan-view
pre-build:
${LN} -sf ${LOCALBASE}/include/llvm/Intrinsics.gen ${WRKSRC}/include/llvm/
${MKDIR} ${WRKSRC}/${RELTYPE}/lib
${LN} -sf ${LOCALBASE}/lib/libLLVM-${PORTVERSION}.so ${WRKSRC}/${RELTYPE}/lib/
${LN} -sf ${LOCALBASE}/lib/libLLVMTableGen.a ${WRKSRC}/${RELTYPE}/lib/
${LN} -sf ${LOCALBASE}/lib/libLLVMSupport.a ${WRKSRC}/${RELTYPE}/lib/
cd ${WRKSRC}/utils/unittest && ${GMAKE}
post-build:
@cd ${WRKSRC}/tools/clang/docs/tools && ${GMAKE} clang.1
post-install:
@${LN} -sf clang ${PREFIX}/bin/clang-cpp
@${INSTALL_SCRIPT} ${WRKSRC}/tools/clang/tools/scan-build/ccc-analyzer \
${WRKSRC}/tools/clang/tools/scan-build/c++-analyzer \
${WRKSRC}/tools/clang/tools/scan-build/scan-build \
${WRKSRC}/tools/clang/tools/scan-view/scan-view \
${PREFIX}/bin
@${MKDIR} ${PYTHONPREFIX_SITELIBDIR}
@${MKDIR} ${PYTHONPREFIX_SITELIBDIR}/Resources
@${INSTALL_SCRIPT} ${WRKSRC}/tools/clang/tools/scan-view/*.py \
${PYTHONPREFIX_SITELIBDIR}
@${INSTALL_SCRIPT} ${WRKSRC}/tools/clang/tools/scan-view/Resources/* \
${PYTHONPREFIX_SITELIBDIR}/Resources
@${MKDIR} ${DATADIR}
@${INSTALL_DATA} ${WRKSRC}/tools/clang/tools/scan-build/scanview.css ${DATADIR}
@${INSTALL_DATA} ${WRKSRC}/tools/clang/tools/scan-build/sorttable.js ${DATADIR}
@${INSTALL_MAN} ${WRKSRC}/tools/clang/docs/tools/clang.1 \
${MANPREFIX}/man/man1/
TEST_CMD= '(cd ${WRKSRC}/test; ${SETENV} ${MAKE_ENV} ${GMAKE} check)'
regression-test: ${BUILD_COOKIE}
if [ `${ID} -u` = 0 ]; then \
${CHOWN} -R nobody ${WRKSRC}/test; \
su -m nobody -c ${TEST_CMD}; \
else \
${SH} -c ${TEST_CMD}; \
fi
PLIST_FILE_LIST= bin/ccc-analyzer \
bin/c++-analyzer \
bin/clang \
bin/clang++ \
bin/clang-check \
bin/clang-cpp \
bin/clang-tblgen \
bin/c-index-test \
bin/scan-build \
bin/scan-view \
lib/libclang*
PLIST_DIR_LIST= include/clang \
include/clang-c \
lib/clang
PLIST_PYFILE_LIST= ScanView.py \
Reporter.py \
Resources/* \
startfile.py
PLIST_PYDIR_LIST= Resources
build-plist:
${RM} -f ${PLIST}
cd ${PREFIX} && \
(ls ${PLIST_FILE_LIST}; ${FIND} ${PLIST_DIR_LIST} -type f) | \
${SED} -e 's|${PORTVERSION}|%%PORTVERSION%%|' | ${SORT} >> ${PLIST}
${FIND} ${DATADIR} ${DOCSDIR} -type f | \
${SED} -e 's|${DATADIR}|%%DATADIR%%|' \
-e 's|${DOCSDIR}|%%PORTDOCS%%%%DOCSDIR%%|' | ${SORT} >> ${PLIST}
cd ${PYTHONPREFIX_SITELIBDIR} && \
ls ${PLIST_PYFILE_LIST} | ${SORT} | \
${SED} -e 's|^|%%PYTHON_SITELIBDIR%%/|' >> ${PLIST}
cd ${PREFIX} && \
${FIND} ${PLIST_DIR_LIST} -type d | \
${SED} -e 's|${PORTVERSION}|%%PORTVERSION%%|' | \
${SORT} -r | ${SED} -e 's|^|@dirrm |' >> ${PLIST}
cd ${PYTHONPREFIX_SITELIBDIR} && \
${FIND} ${PLIST_PYDIR_LIST} -type d | ${SORT} -r | \
${SED} -e 's|^|@dirrm %%PYTHON_SITELIBDIR%%/|' >> ${PLIST}
${FIND} ${DATADIR} ${DOCSDIR} -type d | ${SORT} -r | \
${SED} -e 's|${DATADIR}|@dirrm %%DATADIR%%|' \
-e 's|${DOCSDIR}|%%PORTDOCS%%@dirrm %%DOCSDIR%%|' >> ${PLIST}
.include <bsd.port.post.mk>
|