From 058c493f3e0b96b807117728c0adefd00e8d1d19 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 19 Sep 2017 23:44:35 +0000 Subject: [PATCH] Disable LLDB builds on 10.x as they don't link. Attempt to correct default targets. [0] Fix more references to clang-format50 and use a more future proof patching approach. [1] Build and install pp-trace with the EXTRAS target. PR: 219779 [0], 220995 [1], 222380 [2] --- devel/llvm50/Makefile | 13 +++++++- ...tools_clang-format_clang-format-sublime.py | 14 ++++++++ ...s_clang_tools_clang-format_clang-format.py | 2 +- ..._clang_tools_clang-format_git-clang-format | 32 +++++++++++++++++++ devel/llvm50/pkg-plist | 1 + 5 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format-sublime.py create mode 100644 devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_git-clang-format diff --git a/devel/llvm50/Makefile b/devel/llvm50/Makefile index aa79ed5f1b5e..097706bf3c57 100644 --- a/devel/llvm50/Makefile +++ b/devel/llvm50/Makefile @@ -2,6 +2,7 @@ PORTNAME= llvm DISTVERSION= 5.0.0 +PORTREVISON= 1 CATEGORIES= devel lang MASTER_SITES= http://llvm.org/${PRE_}releases/${LLVM_RELEASE}/${RCDIR} PKGNAMESUFFIX= ${LLVM_SUFFIX} @@ -39,6 +40,8 @@ SUB_LIST= LLVM_PREFIX="${LLVM_PREFIX}" LLVM_SUFFIX="${LLVM_SUFFIX}" CMAKE_INSTALL_PREFIX= ${LLVM_PREFIX} CMAKE_ARGS= -DLLVM_BUILD_LLVM_DYLIB=ON +CMAKE_ARGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=${CONFIGURE_TARGET} +CMAKE_ARGS+= -DLLVM_HOST_TRIPLE=${CONFIGURE_TARGET} # Following commit https://github.com/kitware/cmake/commit/956054 # we need to either change the whole man-shuffle below, or simply # redefine CMAKE_INSTALL_MANDIR @@ -50,6 +53,7 @@ OPTIONS_DEFINE_i386= COMPILER_RT OPTIONS_DEFAULT= CLANG EXTRAS LIT LLD LLDB OPTIONS_DEFAULT_amd64= COMPILER_RT GOLD OPENMP OPTIONS_DEFAULT_i386= COMPILER_RT +OPTIONS_EXCLUDE_FreeBSD_10= LLDB OPTIONS_SUB= yes CLANG_DESC= Build clang @@ -58,6 +62,8 @@ CLANG_EXTRA_PATCHES= \ ${PATCHDIR}/clang-patch-fopenmp.diff \ ${PATCHDIR}/clang-patch-tools_clang_lib_Headers_CMakeLists.txt \ ${PATCHDIR}/clang-patch-tools_clang_tools_clang-format_clang-format.py \ + ${PATCHDIR}/clang-patch-tools_clang_tools_clang-format_clang-format-sublime.py \ + ${PATCHDIR}/clang-patch-tools_clang_tools_clang-format_git-clang-format \ ${PATCHDIR}/clang-patch-tools_clang_tools_scan-build_libexec_ccc-analyzer CLANG_CONFLICTS_INSTALL= clang-devel-3.[1234567]* CLANG_DISTFILES= cfe-${DISTVERSION}.src${EXTRACT_SUFX} @@ -168,7 +174,8 @@ EXTRAS_COMMANDS+= \ clang-reorder-fields \ clang-tidy \ find-all-symbols \ - modularize + modularize \ + pp-trace EXTRAS_LIBS= libclangApplyReplacements \ libclangChangeNamespace \ libclangIncludeFixer \ @@ -356,6 +363,10 @@ post-patch: post-patch-CLANG-on: ${REINPLACE_CMD} -e 's|%%LLVM_PREFIX%%|${LLVM_PREFIX}|' \ ${PATCH_WRKSRC}/tools/clang/lib/Driver/ToolChains/CommonArgs.cpp + ${REINPLACE_CMD} -e 's|%%LLVM_SUFFIX%%|${LLVM_SUFFIX}|' \ + ${PATCH_WRKSRC}/tools/clang/tools/clang-format/clang-format.py \ + ${PATCH_WRKSRC}/tools/clang/tools/clang-format/clang-format-sublime.py \ + ${PATCH_WRKSRC}/tools/clang/tools/clang-format/git-clang-format post-build-COMPILER_RT-on: ${MKDIR} ${WRKDIR}/compiler-rt-build diff --git a/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format-sublime.py b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format-sublime.py new file mode 100644 index 000000000000..2c8909f1e1d1 --- /dev/null +++ b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format-sublime.py @@ -0,0 +1,14 @@ + +$FreeBSD$ + +--- tools/clang/tools/clang-format/clang-format-sublime.py.orig ++++ tools/clang/tools/clang-format/clang-format-sublime.py +@@ -18,7 +18,7 @@ + import subprocess + + # Change this to the full path if clang-format is not on the path. +-binary = 'clang-format' ++binary = 'clang-format%%LLVM_SUFFIX%%' + + # Change this to format according to other formatting styles. See the output of + # 'clang-format --help' for a list of supported styles. The default looks for diff --git a/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format.py b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format.py index 9cf506dd1480..2962d3f4cbcb 100644 --- a/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format.py +++ b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_clang-format.py @@ -5,7 +5,7 @@ # set g:clang_format_path to the path to clang-format if it is not on the path # Change this to the full path if clang-format is not on the path. -binary = 'clang-format' -+binary = 'clang-format39' ++binary = 'clang-format%%LLVM_SUFFIX%%' if vim.eval('exists("g:clang_format_path")') == "1": binary = vim.eval('g:clang_format_path') diff --git a/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_git-clang-format b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_git-clang-format new file mode 100644 index 000000000000..5c5ae3581228 --- /dev/null +++ b/devel/llvm50/files/clang-patch-tools_clang_tools_clang-format_git-clang-format @@ -0,0 +1,32 @@ + +$FreeBSD$ + +--- tools/clang/tools/clang-format/git-clang-format.orig ++++ tools/clang/tools/clang-format/git-clang-format +@@ -90,7 +90,7 @@ + usage=usage, formatter_class=argparse.RawDescriptionHelpFormatter, + description=desc) + p.add_argument('--binary', +- default=config.get('clangformat.binary', 'clang-format'), ++ default=config.get('clangformat.binary', 'clang-format%%LLVM_SUFFIX%%'), + help='path to clang-format'), + p.add_argument('--commit', + default=config.get('clangformat.commit', 'HEAD'), +@@ -344,7 +344,7 @@ + + + def run_clang_format_and_save_to_tree(changed_lines, revision=None, +- binary='clang-format', style=None): ++ binary='clang-format%%LLVM_SUFFIX%%', style=None): + """Run clang-format on each file and save the result to a git tree. + + Returns the object ID (SHA-1) of the created tree.""" +@@ -397,7 +397,7 @@ + + + def clang_format_to_blob(filename, line_ranges, revision=None, +- binary='clang-format', style=None): ++ binary='clang-format%%LLVM_SUFFIX%%', style=None): + """Run clang-format on the given file and save the result to a git blob. + + Runs on the file in `revision` if not None, or on the file in the working diff --git a/devel/llvm50/pkg-plist b/devel/llvm50/pkg-plist index 6525a0651f1f..bbc9cd27bb1d 100644 --- a/devel/llvm50/pkg-plist +++ b/devel/llvm50/pkg-plist @@ -64,6 +64,7 @@ bin/sancov%%LLVM_SUFFIX%% %%EXTRAS%%bin/clang-tidy%%LLVM_SUFFIX%% %%EXTRAS%%bin/find-all-symbols%%LLVM_SUFFIX%% %%EXTRAS%%bin/modularize%%LLVM_SUFFIX%% +%%EXTRAS%%bin/pp-trace%%LLVM_SUFFIX%% %%LLD%%bin/lld%%LLVM_SUFFIX%% %%LLD%%bin/lld-link%%LLVM_SUFFIX%% %%LIT%%bin/lit%%LLVM_SUFFIX%%