diff --git a/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch b/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch new file mode 100644 index 0000000000000000000000000000000000000000..2c15ece8f2053a266e7bb11067934b4d5519249e --- /dev/null +++ b/0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch @@ -0,0 +1,52 @@ +From a1bccf89a02accab69b359ef004faa95257333c0 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Fri, 7 Sep 2018 18:27:16 +0000 +Subject: [PATCH] Convert clang-format-diff.py to python3 using 2to3 + +--- + tools/clang-format/clang-format-diff.py | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/tools/clang-format/clang-format-diff.py b/tools/clang-format/clang-format-diff.py +index ffa30e70dd..1525a3815c 100755 +--- a/tools/clang-format/clang-format-diff.py ++++ b/tools/clang-format/clang-format-diff.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/python3 + # + #===- clang-format-diff.py - ClangFormat Diff Reformatter ----*- python -*--===# + # +@@ -27,7 +27,7 @@ import difflib + import re + import string + import subprocess +-import StringIO ++import io + import sys + + +@@ -89,9 +89,9 @@ def main(): + ['-lines', str(start_line) + ':' + str(end_line)]) + + # Reformat files containing changes in place. +- for filename, lines in lines_by_file.iteritems(): ++ for filename, lines in lines_by_file.items(): + if args.i and args.verbose: +- print 'Formatting', filename ++ print('Formatting', filename) + command = [args.binary, filename] + if args.i: + command.append('-i') +@@ -109,7 +109,7 @@ def main(): + if not args.i: + with open(filename) as f: + code = f.readlines() +- formatted_code = StringIO.StringIO(stdout).readlines() ++ formatted_code = io.StringIO(stdout).readlines() + diff = difflib.unified_diff(code, formatted_code, + filename, filename, + '(before formatting)', '(after formatting)') +-- +2.14.3 + diff --git a/0001-Convert-scan-view-to-python3-using-2to3.patch b/0001-Convert-scan-view-to-python3-using-2to3.patch new file mode 100644 index 0000000000000000000000000000000000000000..2534c6ed475b97f8d12d164370366793e7e5fb8c --- /dev/null +++ b/0001-Convert-scan-view-to-python3-using-2to3.patch @@ -0,0 +1,93 @@ +From c760f8d703af0c67774681b5a259d5dd3a1e5a77 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Wed, 19 Sep 2018 08:53:10 -0700 +Subject: [PATCH] Convert scan-view to python3 using 2to3 + +--- + tools/scan-view/bin/scan-view | 24 ++++++++++++------------ + 1 file changed, 12 insertions(+), 12 deletions(-) + +diff --git a/tools/scan-view/bin/scan-view b/tools/scan-view/bin/scan-view +index 1b6e8ba..ca3dac5 100755 +--- a/tools/scan-view/bin/scan-view ++++ b/tools/scan-view/bin/scan-view +@@ -7,9 +7,9 @@ import sys + import imp + import os + import posixpath +-import thread ++import _thread + import time +-import urllib ++import urllib.request, urllib.parse, urllib.error + import webbrowser + + # How long to wait for server to start. +@@ -27,7 +27,7 @@ kMaxPortsToTry = 100 + + def url_is_up(url): + try: +- o = urllib.urlopen(url) ++ o = urllib.request.urlopen(url) + except IOError: + return False + o.close() +@@ -35,7 +35,7 @@ def url_is_up(url): + + + def start_browser(port, options): +- import urllib ++ import urllib.request, urllib.parse, urllib.error + import webbrowser + + url = 'http://%s:%d' % (options.host, port) +@@ -52,10 +52,10 @@ def start_browser(port, options): + sys.stderr.flush() + time.sleep(kSleepTimeout) + else: +- print >> sys.stderr, 'WARNING: Unable to detect that server started.' ++ print('WARNING: Unable to detect that server started.', file=sys.stderr) + + if options.debug: +- print >> sys.stderr, '%s: Starting webbrowser...' % sys.argv[0] ++ print('%s: Starting webbrowser...' % sys.argv[0], file=sys.stderr) + webbrowser.open(url) + + +@@ -69,9 +69,9 @@ def run(port, options, root): + + import ScanView + try: +- print 'Starting scan-view at: http://%s:%d' % (options.host, +- port) +- print ' Use Ctrl-C to exit.' ++ print('Starting scan-view at: http://%s:%d' % (options.host, ++ port)) ++ print(' Use Ctrl-C to exit.') + httpd = ScanView.create_server((options.host, port), + options, root) + httpd.serve_forever() +@@ -80,9 +80,9 @@ def run(port, options, root): + + + def port_is_open(port): +- import SocketServer ++ import socketserver + try: +- t = SocketServer.TCPServer((kDefaultHost, port), None) ++ t = socketserver.TCPServer((kDefaultHost, port), None) + except: + return False + t.server_close() +@@ -135,7 +135,7 @@ def main(): + # Kick off thread to wait for server and start web browser, if + # requested. + if args.startBrowser: +- t = thread.start_new_thread(start_browser, (port, args)) ++ t = _thread.start_new_thread(start_browser, (port, args)) + + run(port, args, args.root) + +-- +1.8.3.1 + diff --git a/0001-Don-t-prefer-python2.7.patch b/0001-Don-t-prefer-python2.7.patch new file mode 100644 index 0000000000000000000000000000000000000000..28ca4e013e3f37f43a4b0b10f09827ab27672e7d --- /dev/null +++ b/0001-Don-t-prefer-python2.7.patch @@ -0,0 +1,24 @@ +From d13bd5108e3471cc6f6203ba1c0c0e67323bbb12 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Wed, 5 Sep 2018 21:43:42 -0700 +Subject: [PATCH] Don't prefer python2.7 + +--- + CMakeLists.txt | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 52b8819..6f233fd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -109,7 +109,6 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) + set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX} ) + + if(LLVM_INCLUDE_TESTS) +- set(Python_ADDITIONAL_VERSIONS 2.7) + include(FindPythonInterp) + if(NOT PYTHONINTERP_FOUND) + message(FATAL_ERROR +-- +1.8.3.1 + diff --git a/0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch b/0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch new file mode 100644 index 0000000000000000000000000000000000000000..b9d0aee4942286548644c74269f8a157868bf781 --- /dev/null +++ b/0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch @@ -0,0 +1,120 @@ +From d84a971ba917569829b51fff6057e5fd0d85e402 Mon Sep 17 00:00:00 2001 +From: Tom Stellard +Date: Thu, 18 Jan 2018 02:57:51 +0000 +Subject: [PATCH] Driver: Prefer vendor supplied gcc toolchain + +Summary: +This patch fixes an issue on Fedora where if you had the x86_64 cross +compiler installed on your x86_64 system, then clang would use that compiler +as the default toolchain. This was happening because the cross compiler +is installed to /usr/lib/gcc/x86_64-linux-gnu/ and this directory comes before +the default compiler directory (/usr/lib/gcc/x86_64-redhat-linux/) in the search +list. + +This patch re-orders the search list so that vendor supplied gcc toolchains +are selected before toolchains with a generic target, which should prevent +these kind of issues on other OSes too. + +Subscribers: srhines, cfe-commits + +Differential Revision: https://reviews.llvm.org/D42608 +--- + lib/Driver/ToolChains/Gnu.cpp | 47 ++++++++++++++++++++++--------------------- + 1 file changed, 24 insertions(+), 23 deletions(-) + +diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp +index 3755673..5a49a6e 100644 +--- a/lib/Driver/ToolChains/Gnu.cpp ++++ b/lib/Driver/ToolChains/Gnu.cpp +@@ -1811,18 +1811,19 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + // lifetime or initialization issues. + static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; + static const char *const AArch64Triples[] = { +- "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", +- "aarch64-suse-linux"}; ++ "aarch64-redhat-linux", "aarch64-suse-linux", ++ "aarch64-none-linux-gnu", "aarch64-linux-gnu"}; + static const char *const AArch64beLibDirs[] = {"/lib"}; + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", + "aarch64_be-linux-gnu"}; + + static const char *const ARMLibDirs[] = {"/lib"}; + static const char *const ARMTriples[] = {"arm-linux-gnueabi"}; +- static const char *const ARMHFTriples[] = {"arm-linux-gnueabihf", +- "armv7hl-redhat-linux-gnueabi", ++ static const char *const ARMHFTriples[] = {"armv7hl-redhat-linux-gnueabi", + "armv6hl-suse-linux-gnueabi", +- "armv7hl-suse-linux-gnueabi"}; ++ "armv7hl-suse-linux-gnueabi", ++ "arm-linux-gnueabihf", ++ }; + static const char *const ARMebLibDirs[] = {"/lib"}; + static const char *const ARMebTriples[] = {"armeb-linux-gnueabi"}; + static const char *const ARMebHFTriples[] = { +@@ -1830,19 +1831,19 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + + static const char *const X86_64LibDirs[] = {"/lib64", "/lib"}; + static const char *const X86_64Triples[] = { +- "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", +- "x86_64-pc-linux-gnu", "x86_64-redhat-linux6E", +- "x86_64-redhat-linux", "x86_64-suse-linux", +- "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", +- "x86_64-slackware-linux", "x86_64-unknown-linux", +- "x86_64-amazon-linux"}; ++ "x86_64-redhat-linux6E", "x86_64-redhat-linux", ++ "x86_64-suse-linux", "x86_64-slackware-linux", ++ "x86_64-manbo-linux-gnu", "x86_64-amazon-linux", ++ "x86_64-linux-gnu", "x86_64-unknown-linux-gnu", ++ "x86_64-pc-linux-gnu", "x86_64-linux-gnu", ++ "x86_64-unknown-linux"}; + static const char *const X32LibDirs[] = {"/libx32"}; + static const char *const X86LibDirs[] = {"/lib32", "/lib"}; + static const char *const X86Triples[] = { +- "i686-linux-gnu", "i686-pc-linux-gnu", "i486-linux-gnu", +- "i386-linux-gnu", "i386-redhat-linux6E", "i686-redhat-linux", +- "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", +- "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu"}; ++ "i386-redhat-linux6E", "i686-redhat-linux", "i586-redhat-linux", ++ "i386-redhat-linux", "i586-suse-linux", "i486-slackware-linux", ++ "i686-montavista-linux", "i686-linux-gnu", "i686-pc-linux-gnu", ++ "i486-linux-gnu", "i386-linux-gnu", "i586-linux-gnu"}; + + static const char *const MIPSLibDirs[] = {"/lib"}; + static const char *const MIPSTriples[] = {"mips-linux-gnu", "mips-mti-linux", +@@ -1864,16 +1865,16 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + + static const char *const PPCLibDirs[] = {"/lib32", "/lib"}; + static const char *const PPCTriples[] = { +- "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe", +- "powerpc-suse-linux", "powerpc-montavista-linuxspe"}; ++ "powerpc-suse-linux", "powerpc-montavista-linuxspe", ++ "powerpc-linux-gnu", "powerpc-unknown-linux-gnu", "powerpc-linux-gnuspe"}; + static const char *const PPC64LibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64Triples[] = { +- "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu", +- "powerpc64-suse-linux", "ppc64-redhat-linux"}; ++ "powerpc64-suse-linux", "ppc64-redhat-linux", ++ "powerpc64-linux-gnu", "powerpc64-unknown-linux-gnu"}; + static const char *const PPC64LELibDirs[] = {"/lib64", "/lib"}; + static const char *const PPC64LETriples[] = { +- "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu", +- "powerpc64le-suse-linux", "ppc64le-redhat-linux"}; ++ "powerpc64le-suse-linux", "ppc64le-redhat-linux", ++ "powerpc64le-linux-gnu", "powerpc64le-unknown-linux-gnu"}; + + static const char *const RISCV32LibDirs[] = {"/lib", "/lib32"}; + static const char *const RISCVTriples[] = {"riscv32-unknown-linux-gnu", +@@ -1889,8 +1890,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + + static const char *const SystemZLibDirs[] = {"/lib64", "/lib"}; + static const char *const SystemZTriples[] = { +- "s390x-linux-gnu", "s390x-unknown-linux-gnu", "s390x-ibm-linux-gnu", +- "s390x-suse-linux", "s390x-redhat-linux"}; ++ "s390x-ibm-linux-gnu", "s390x-suse-linux", "s390x-redhat-linux", ++ "s390x-linux-gnu", "s390x-unknown-linux-gnu"}; + + + using std::begin; +-- +1.8.3.1 + diff --git a/clang-10.0.1.src.tar.xz b/cfe-7.0.0.src.tar.xz similarity index 57% rename from clang-10.0.1.src.tar.xz rename to cfe-7.0.0.src.tar.xz index 81b5af1b269cd42dbd6b7834e801b2984dffa4ea..ccc1c48e66b4ae2839de433baab6c2ae21e67e1e 100644 Binary files a/clang-10.0.1.src.tar.xz and b/cfe-7.0.0.src.tar.xz differ diff --git a/clang-tools-extra-10.0.1.src.tar.xz b/clang-tools-extra-10.0.1.src.tar.xz deleted file mode 100644 index 7dda61c42e50be509efab212b3152c74c26d8319..0000000000000000000000000000000000000000 Binary files a/clang-tools-extra-10.0.1.src.tar.xz and /dev/null differ diff --git a/clang-tools-extra-7.0.0.src.tar.xz b/clang-tools-extra-7.0.0.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..b35f09d0e14686561003de9701fd3e760b8f20e2 Binary files /dev/null and b/clang-tools-extra-7.0.0.src.tar.xz differ diff --git a/clang.spec b/clang.spec index b83d71e5a8f1a0c670d8a7589ab1ef96754be766..53cb7f1c4e8f84065fe4698957b93b47f09234b8 100644 --- a/clang.spec +++ b/clang.spec @@ -1,22 +1,27 @@ -%global maj_ver 10 +%global maj_ver 7 %global min_ver 0 -%global patch_ver 1 -%global clang_srcdir clang-%{version}.src +%global patch_ver 0 + +%global clang_srcdir cfe-%{version}.src %global clang_tools_srcdir clang-tools-extra-%{version}.src Name: clang -Version: 10.0.1 -Release: 0 +Version: %{maj_ver}.%{min_ver}.%{patch_ver} +Release: 7 License: NCSA Summary: An "LLVM native" C/C++/Objective-C compiler URL: http://llvm.org -Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_srcdir}.tar.xz -Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{clang_tools_srcdir}.tar.xz -Source2: clang-config.h - -Patch0000: 0001-lit.cfg-Add-hack-so-lit-can-find-not-and-FileCheck.patch -Patch0001: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch -Patch0002: 0001-gtest-reorg.patch +Source0: http://releases.llvm.org/%{version}/%{clang_srcdir}.tar.xz +Source1: http://llvm.org/releases/%{version}/%{clang_tools_srcdir}.tar.xz +Source100: clang-config.h + +Patch0: 0001-lit.cfg-Add-hack-so-lit-can-find-not-and-FileCheck.patch +Patch1: 0001-GCC-compatibility-Ignore-fstack-clash-protection.patch +Patch2: 0001-Driver-Prefer-vendor-supplied-gcc-toolchain.patch +Patch4: 0001-gtest-reorg.patch +Patch5: 0001-Don-t-prefer-python2.7.patch +Patch6: 0001-Convert-clang-format-diff.py-to-python3-using-2to3.patch +Patch7: 0001-Convert-scan-view-to-python3-using-2to3.patch BuildRequires: cmake gcc-c++ python-sphinx git BuildRequires: llvm-devel = %{version} @@ -24,8 +29,7 @@ BuildRequires: compiler-rt = %{version} BuildRequires: llvm-static = %{version} BuildRequires: llvm-googletest = %{version} BuildRequires: libxml2-devel perl-generators ncurses-devel emacs libatomic -BuildRequires: python3-lit python3-sphinx python3-devel -BuildRequires: clang +BuildRequires: python2-lit python3-lit python2-rpm-macros python3-sphinx python3-devel Requires: libstdc++-devel gcc-c++ emacs-filesystem Provides: clang(major) = %{maj_ver} @@ -78,14 +82,24 @@ A set of extra tools built using Clang's tooling API. Summary: clang-format integration for git Requires: %{name} = %{version}-%{release} Requires: git +Requires: python2 %description -n git-clang-format clang-format integration for git. +%package -n python2-clang +Summary: Python2 bindings for clang +Requires: %{name}-libs = %{version}-%{release} +Requires: python2 +%description -n python2-clang +%{summary}. + %prep %setup -T -q -b 1 -n %{clang_tools_srcdir} pathfix.py -i %{__python3} -pn \ clang-tidy/tool/*.py +pathfix.py -i %{__python2} -pn \ + include-fixer/find-all-symbols/tool/run-find-all-symbols.py %autosetup -n %{clang_srcdir} -p1 -Sgit pathfix.py -i %{__python3} -pn \ @@ -137,8 +151,11 @@ cd _build %install %make_install -C _build +mkdir -p %{buildroot}%{python2_sitelib}/clang/ +install -p -m644 bindings/python/clang/* %{buildroot}%{python2_sitelib}/clang/ + mv -v %{buildroot}%{_includedir}/clang/Config/config{,-%{__isa_bits}}.h -install -m 0644 %{SOURCE2} %{buildroot}%{_includedir}/clang/Config/config.h +install -m 0644 %{SOURCE100} %{buildroot}%{_includedir}/clang/Config/config.h mkdir -p %{buildroot}%{_emacs_sitestartdir} for f in clang-format.el clang-rename.el clang-include-fixer.el; do @@ -153,20 +170,15 @@ rm -Rvf %{buildroot}%{_pkgdocdir} rm -vf %{buildroot}%{_datadir}/clang/bash-autocomplete.sh ln -s clang++ %{buildroot}%{_bindir}/clang++-%{maj_ver} -cp -p %{_libdir}/libclang*so.7 %{buildroot}%{_libdir} -cp -p %{_libdir}/libfindAllSymbols.so.7 %{buildroot}%{_libdir} %check -# Checking is disabled because we don't pack libLLVMTestingSupport.a, which makes -# standalone build of clang impossible. - -#cd _build -#PATH=%{_libdir}/llvm:$PATH make %{?_smp_mflags} check-clang || \ -#%ifarch %{arm} -#: -#%else -#false -#%endif +cd _build +PATH=%{_libdir}/llvm:$PATH make %{?_smp_mflags} check-clang || \ +%ifarch %{arm} +: +%else +false +%endif %files %{_bindir}/clang @@ -177,12 +189,7 @@ cp -p %{_libdir}/libfindAllSymbols.so.7 %{buildroot}%{_libdir} %{_bindir}/clang-cl %{_bindir}/clang-cpp %{_bindir}/clang-format -%{_bindir}/clang-doc -%{_bindir}/clang-extdef-mapping -%{_bindir}/clang-move -%{_bindir}/clang-offload-wrapper -%{_bindir}/clang-scan-deps -%{_bindir}/pp-trace +%{_bindir}/clang-func-mapping %{_bindir}/clang-import-test %{_bindir}/clang-offload-bundler %{_bindir}/diagtool @@ -208,6 +215,7 @@ cp -p %{_libdir}/libfindAllSymbols.so.7 %{buildroot}%{_libdir} %files analyzer %{_bindir}/scan-view %{_bindir}/scan-build +%{_bindir}/scan-build %{_libexecdir}/ccc-analyzer %{_libexecdir}/c++-analyzer %{_datadir}/scan-view/ @@ -233,13 +241,17 @@ cp -p %{_libdir}/libfindAllSymbols.so.7 %{buildroot}%{_libdir} %{_datadir}/clang/run-clang-tidy.py* %{_datadir}/clang/run-find-all-symbols.py* %{_datadir}/clang/clang-rename.py* -%{_datadir}/clang/index.js -%{_datadir}/clang/clang-doc-default-stylesheet.css %files -n git-clang-format %{_bindir}/git-clang-format +%files -n python2-clang +%{python2_sitelib}/clang/ + %changelog +* Tue Nov 03 2020 Jeffery.Gao - 7.0.0-7 +- reback to 7.0.0, because nodejs upgrade after update 20.03 + * Sat Oct 10 2020 Jeffery.Gao - 10.0.1-0 - Upgrade to 10.0.1 diff --git a/clang.yaml b/clang.yaml deleted file mode 100644 index 7d98bd835f0acc97da741f20f900a6ebae1512c5..0000000000000000000000000000000000000000 --- a/clang.yaml +++ /dev/null @@ -1,4 +0,0 @@ -version_control: github -src_repo: llvm/llvm-project -tag_prefix: ^llvmorg- -seperator: .