171 lines
5.7 KiB
Text
171 lines
5.7 KiB
Text
# $NetBSD: Makefile.common,v 1.48 2022/05/05 08:24:41 nia Exp $
|
|
# used by lang/clang/Makefile
|
|
# used by lang/clang-tools-extra/Makefile
|
|
|
|
.include "../../lang/llvm/version.mk"
|
|
|
|
DISTNAME= clang-${LLVM_VERSION}.src
|
|
CATEGORIES= lang devel
|
|
|
|
MAINTAINER= pkgsrc-users@NetBSD.org
|
|
HOMEPAGE= https://clang.llvm.org/
|
|
COMMENT= C language family frontend for LLVM
|
|
LICENSE= apache-2.0
|
|
|
|
CONFIGURE_DIRS= ${WRKDIR}/build
|
|
CMAKE_ARG_PATH= ${WRKSRC}
|
|
|
|
USE_LANGUAGES= c c++14
|
|
USE_CMAKE= yes
|
|
GCC_REQD+= 5
|
|
|
|
CMAKE_ARGS+= -DLLVM_CONFIG=${LLVM_CONFIG_PATH:Q}
|
|
CMAKE_ARGS+= -DCMAKE_BUILD_TYPE=Release
|
|
CMAKE_ARGS+= -DCMAKE_C_COMPILER=${CC:Q}
|
|
CMAKE_ARGS+= -DCMAKE_CXX_COMPILER=${CXX:Q}
|
|
|
|
.include "../../mk/compiler.mk"
|
|
|
|
CMAKE_ARGS.Darwin+= -DCMAKE_LIBTOOL=/usr/bin/libtool
|
|
.if defined(OSX_SDK_PATH)
|
|
CMAKE_ARGS.Darwin+= -DDEFAULT_SYSROOT=${OSX_SDK_PATH:Q}
|
|
.endif
|
|
|
|
# NetBSD < 10 did not provide ENOTRECOVERABLE
|
|
# https://bugs.llvm.org/show_bug.cgi?id=52587
|
|
.if ${OPSYS} == "NetBSD" && ${OPSYS_VERSION} < 099949
|
|
CXXFLAGS+= -D_GLIBCXX_HAVE_ENOTRECOVERABLE=1
|
|
CXXFLAGS+= -DENOTRECOVERABLE=98
|
|
.endif
|
|
|
|
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+= docs/tools/generate_formatted_state.py
|
|
REPLACE_PYTHON+= lib/Tooling/DumpTool/generate_cxx_src_locs.py
|
|
REPLACE_PYTHON+= test/AST/gen_ast_dump_json_test.py
|
|
REPLACE_PYTHON+= test/Analysis/check-analyzer-fixit.py
|
|
REPLACE_PYTHON+= test/Driver/check-time-trace-sections.py
|
|
REPLACE_PYTHON+= tools/clang-format/clang-format-diff.py
|
|
REPLACE_PYTHON+= tools/clang-format/git-clang-format
|
|
REPLACE_PYTHON+= tools/scan-build-py/bin/analyze-build
|
|
REPLACE_PYTHON+= tools/scan-build-py/bin/intercept-build
|
|
REPLACE_PYTHON+= tools/scan-build-py/bin/scan-build
|
|
REPLACE_PYTHON+= tools/scan-build-py/libexec/analyze-c++
|
|
REPLACE_PYTHON+= tools/scan-build-py/libexec/analyze-cc
|
|
REPLACE_PYTHON+= tools/scan-build-py/libexec/intercept-c++
|
|
REPLACE_PYTHON+= tools/scan-build-py/libexec/intercept-cc
|
|
REPLACE_PYTHON+= tools/scan-build/bin/set-xcode-analyzer
|
|
REPLACE_PYTHON+= tools/scan-view/bin/scan-view
|
|
REPLACE_PYTHON+= tools/scan-view/share/Reporter.py
|
|
REPLACE_PYTHON+= tools/scan-view/share/startfile.py
|
|
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/SATest.py
|
|
REPLACE_PYTHON+= utils/analyzer/SATestAdd.py
|
|
REPLACE_PYTHON+= utils/analyzer/SATestBuild.py
|
|
REPLACE_PYTHON+= utils/analyzer/SATestUpdateDiffs.py
|
|
REPLACE_PYTHON+= utils/analyzer/SumTimerInfo.py
|
|
REPLACE_PYTHON+= utils/analyzer/exploded-graph-rewriter.py
|
|
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/clangdiag.py
|
|
REPLACE_PYTHON+= utils/convert_arm_neon.py
|
|
REPLACE_PYTHON+= utils/creduce-clang-crash.py
|
|
REPLACE_PYTHON+= utils/hmaptool/hmaptool
|
|
REPLACE_PYTHON+= utils/modfuzz.py
|
|
REPLACE_PYTHON+= utils/module-deps-to-rsp.py
|
|
REPLACE_PYTHON+= utils/token-delta.py
|
|
REPLACE_PYTHON+= www/builtins.py
|
|
REPLACE_PYTHON+= www/make_cxx_dr_status
|
|
|
|
.if ${OPSYS} == "NetBSD" && ${PKGSRC_COMPILER:Mclang}
|
|
# command to check if clang is using libc++ or libstdc++
|
|
LIBCPP_CHECK!= \
|
|
printf '%s\n' \
|
|
'\#include <ciso646>' \
|
|
'\#ifdef _LIBCPP_VERSION' \
|
|
'YES' \
|
|
'\#endif' \
|
|
| ${CLANGBASE}/bin/clang++ -x c++ -E - 2>&1 \
|
|
| grep YES || true
|
|
.else
|
|
LIBCPP_CHECK= NO
|
|
.endif
|
|
|
|
# patch NetBSD::GetCXXStdlibType
|
|
.if ${OPSYS} == "NetBSD" && ${LIBCPP_CHECK} != YES
|
|
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/NetBSD.cpp
|
|
SUBST_SED.libcxx= -e 's,(Major >= 7 || Major == 0),(false),'
|
|
|
|
CMAKE_ARGS+= -DCLANG_DEFAULT_CXX_STDLIB:STRING="libstdc++"
|
|
.endif
|
|
|
|
# Enable full LLVM suite on SunOS
|
|
.if ${OPSYS} == "SunOS"
|
|
.include "../../lang/compiler-rt/buildlink3.mk"
|
|
.include "../../lang/libcxx/buildlink3.mk"
|
|
.include "../../lang/libcxxabi/buildlink3.mk"
|
|
.include "../../lang/libunwind/buildlink3.mk"
|
|
CMAKE_ARGS+= -DCLANG_DEFAULT_RTLIB:STRING="compiler-rt"
|
|
CMAKE_ARGS+= -DCLANG_DEFAULT_CXX_STDLIB:STRING="libc++"
|
|
.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 ${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
|
|
|
|
post-extract:
|
|
${MKDIR} ${WRKDIR}/build
|
|
|
|
.include "../../textproc/libxml2/buildlink3.mk"
|
|
.include "../../devel/zlib/buildlink3.mk"
|
|
.include "../../lang/python/application.mk"
|
|
.include "../../lang/python/tool.mk"
|
|
DEPENDS+= llvm-${PKGVERSION_NOREV}{,nb*}:../../lang/llvm
|
|
.include "../../lang/llvm/buildlink3.mk"
|