blob: 08d0ab22b617c52c4af4cad9156eeacfa07d0982 (
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
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
|
# $NetBSD: Makefile.common,v 1.17 2017/01/05 11:54:32 adam Exp $
# used by lang/clang/Makefile
# used by lang/clang-static-analyzer/Makefile
DISTNAME= cfe-3.9.1.src
CATEGORIES= lang devel
MASTER_SITES= http://llvm.org/releases/${PKGVERSION_NOREV}/
EXTRACT_SUFX= .tar.xz
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://clang.llvm.org/
COMMENT= C language family frontend for LLVM
LICENSE= modified-bsd
DISTINFO_FILE= ${.CURDIR}/../../lang/clang/distinfo
PATCHDIR= ${.CURDIR}/../../lang/clang/patches
CONFIGURE_DIRS= ${WRKDIR}/build
CMAKE_ARG_PATH= ${WRKSRC}
USE_LANGUAGES= c c++
USE_CMAKE= yes
GCC_REQD+= 4.8
CMAKE_ARGS+= -DLLVM_CONFIG=${LLVM_CONFIG_PATH}
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
CMAKE_ARGS+= -DCMAKE_C_COMPILER=gcc
CMAKE_ARGS+= -DCMAKE_CXX_COMPILER=g++
# XXX can't disable static-analyzer without also disabling ARCMT
CMAKE_ARGS+= -DCLANG_ENABLE_ARCMT=OFF
REPLACE_PERL+= test/make_test_dirs.pl
REPLACE_PERL+= tools/scan-build/bin/scan-build
REPLACE_PERL+= tools/scan-build/libexec/c++-analyzer
REPLACE_PERL+= tools/scan-build/libexec/ccc-analyzer
REPLACE_PERL+= utils/TestUtils/pch-test.pl
REPLACE_PERL+= utils/analyzer/reducer.pl
REPLACE_PERL+= utils/analyzer/update_plist_test.pl
REPLACE_PERL+= www/demo/index.cgi
REPLACE_PYTHON+= bindings/python/examples/cindex/cindex-dump.py
REPLACE_PYTHON+= bindings/python/examples/cindex/cindex-includes.py
REPLACE_PYTHON+= docs/tools/dump_ast_matchers.py
REPLACE_PYTHON+= docs/tools/dump_format_style.py
REPLACE_PYTHON+= tools/clang-format/clang-format-diff.py
REPLACE_PYTHON+= tools/clang-format/git-clang-format
REPLACE_PYTHON+= tools/scan-build/bin/set-xcode-analyzer
REPLACE_PYTHON+= tools/scan-view/bin/scan-view
REPLACE_PYTHON+= utils/ABITest/ABITestGen.py
REPLACE_PYTHON+= utils/CIndex/completion_logger_server.py
REPLACE_PYTHON+= utils/CaptureCmd
REPLACE_PYTHON+= utils/CmpDriver
REPLACE_PYTHON+= utils/FindSpecRefs
REPLACE_PYTHON+= utils/FuzzTest
REPLACE_PYTHON+= utils/TestUtils/deep-stack.py
REPLACE_PYTHON+= utils/analyzer/CmpRuns.py
REPLACE_PYTHON+= utils/analyzer/SATestAdd.py
REPLACE_PYTHON+= utils/analyzer/SATestBuild.py
REPLACE_PYTHON+= utils/analyzer/SumTimerInfo.py
REPLACE_PYTHON+= utils/analyzer/ubiviz
REPLACE_PYTHON+= utils/check_cfc/check_cfc.py
REPLACE_PYTHON+= utils/check_cfc/obj_diff.py
REPLACE_PYTHON+= utils/check_cfc/test_check_cfc.py
REPLACE_PYTHON+= utils/token-delta.py
REPLACE_PYTHON+= www/builtins.py
.include "../../mk/compiler.mk"
.if ${OPSYS} == "NetBSD" && !empty(PKGSRC_COMPILER:Mclang)
# command to check if clang is using libc++ or libstdc++
LIBCPP_CHECK_SH= printf "\#include <ciso646>\n\#ifdef _LIBCPP_VERSION\nYES\n\#endif" | ${CLANGBASE}/bin/clang++ -x c++ -E - 2>&1 | grep YES || true
.else
LIBCPP_CHECK_SH= echo NO
.endif
# patch NetBSD::GetCXXStdlibType
.if ${OPSYS} == "NetBSD" && empty(LIBCPP_CHECK_SH:sh:MYES)
SUBST_CLASSES+= libcxx
SUBST_STAGE.libcxx= pre-configure
SUBST_MESSAGE.libcxx= Patching toolchain to use libstdc++ (matching the host compiler)
SUBST_FILES.libcxx= lib/Driver/ToolChains.cpp
SUBST_FILES.libcxx+= lib/Driver/Tools.cpp
SUBST_SED.libcxx= -e 's,(Major >= 7 || (Major == 6 && Minor == 99 && Micro >= 49) || Major == 0),(false),'
CMAKE_ARGS+= -DCLANG_DEFAULT_CXX_STDLIB:STRING="libstdc++"
.endif
# 3.8.0 -> 3.8
LLVM_MAJOR= ${PKGVERSION_NOREV:C/^([0-9]+\.[0-9]+)\..*$/\1/}
PLIST_SUBST+= LLVM_MAJOR=${LLVM_MAJOR}
PLIST_VARS+= notdylib
.if ${_OPSYS_SHLIB_TYPE} == "dylib"
SOEXT= dylib
.else
SOEXT= so
PLIST.notdylib= yes
.endif
PLIST_SUBST+= SOEXT=${SOEXT}
PKG_OPTIONS_VAR= PKG_OPTIONS.clang
PKG_SUPPORTED_OPTIONS= tests
.include "../../mk/bsd.options.mk"
.if !empty(PKG_OPTIONS:Mtests)
CMAKE_ARGS+= -DLLVM_INCLUDE_TESTS=ON
CMAKE_ARGS+= -DCLANG_INCLUDE_TESTS=ON
TEST_TARGET= clang-test
TEST_ENV+= LD_LIBRARY_PATH=${WRKDIR}/build/lib
.include "../../devel/googletest/buildlink3.mk"
.else
CMAKE_ARGS+= -DLLVM_INCLUDE_TESTS=OFF
CMAKE_ARGS+= -DCLANG_INCLUDE_TESTS=OFF
.endif
# At least LLVM 3.9.0 and subprojects don't correctly add C++11 flags
# automatically.
CXXFLAGS+= -std=c++11
post-extract:
${RUN} mkdir -p ${WRKDIR}/build
.include "../../textproc/libxml2/buildlink3.mk"
.include "../../devel/zlib/buildlink3.mk"
.include "../../lang/python/tool.mk"
DEPENDS+= llvm-${PKGVERSION_NOREV}{,nb*}:../../lang/llvm
.include "../../lang/llvm/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"
|