pkgsrc/lang/clang/Makefile.common
wiz 29dc0af201 clang: update to 10.0.0nb4.
Make perl a run-time dependency to fix

ERROR: [check-interpreter.mk] The interpreter "/usr/pkg/bin/perl" of "/usr/pkg/bin/scan-build" does not exist.
ERROR: [check-interpreter.mk] The interpreter "/usr/pkg/bin/perl" of "/usr/pkg/libexec/c++-analyzer" does not exist.
ERROR: [check-interpreter.mk] The interpreter "/usr/pkg/bin/perl" of "/usr/pkg/libexec/ccc-analyzer" does not exist.
2020-07-02 10:45:38 +00:00

141 lines
4.4 KiB
Text

# $NetBSD: Makefile.common,v 1.46 2020/07/02 10:45:38 wiz 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
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/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/hmaptool/hmaptool
REPLACE_PYTHON+= utils/token-delta.py
REPLACE_PYTHON+= www/builtins.py
.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"