commit a5cedf87fcbbd4292652cc9a3f8de7d2de9dad2c Author: ABF Date: Sat Jul 27 15:56:34 2019 +0000 Automatic import for version 8.0.1-1 diff --git a/.abf.yml b/.abf.yml new file mode 100644 index 0000000..b314f6c --- /dev/null +++ b/.abf.yml @@ -0,0 +1,6 @@ +sources: + "cfe-8.0.1.src.tar.xz": e1d7f274c4fd623f19255cc52c6d7b39cf8769ee + "clang-tools-extra-8.0.1.src.tar.xz": 0174e060781fc01e5f97f2ff9b51a03165d7b37a + "compiler-rt-8.0.1.src.tar.xz": f6520fb47fae9cc4362a9d50abee22019c27457a + "llvm-8.0.1.src.tar.xz": 09964f9eabc364f221a3caefbdaea28557273b4a + "polly-8.0.1.src.tar.xz": 70670752494e016ce0edd1f9fc2d8d2fca4654f7 diff --git a/cfe-8.0.1-i586-unknown-linux-gnu.patch b/cfe-8.0.1-i586-unknown-linux-gnu.patch new file mode 100644 index 0000000..8947724 --- /dev/null +++ b/cfe-8.0.1-i586-unknown-linux-gnu.patch @@ -0,0 +1,12 @@ +diff -ur cfe-8.0.1.src-patch/lib/Driver/ToolChains/Gnu.cpp cfe-8.0.1.src/lib/Driver/ToolChains/Gnu.cpp +--- cfe-8.0.1.src-patch/lib/Driver/ToolChains/Gnu.cpp 2019-01-16 00:04:36.000000000 +0300 ++++ cfe-8.0.1.src/lib/Driver/ToolChains/Gnu.cpp 2019-07-27 17:47:41.099583212 +0300 +@@ -1905,7 +1905,7 @@ + "i586-redhat-linux", "i386-redhat-linux", "i586-suse-linux", + "i486-slackware-linux", "i686-montavista-linux", "i586-linux-gnu", + "i686-linux-android", "i386-gnu", "i486-gnu", +- "i586-gnu", "i686-gnu"}; ++ "i586-gnu", "i686-gnu", "i586-unknown-linux-gnu"}; + + static const char *const MIPSLibDirs[] = {"/lib"}; + static const char *const MIPSTriples[] = { diff --git a/clang-gcc-wrapper.macros b/clang-gcc-wrapper.macros new file mode 100644 index 0000000..4bbb163 --- /dev/null +++ b/clang-gcc-wrapper.macros @@ -0,0 +1,21 @@ +%clang_gcc_wrapper() \ +# clang wrapper to remove compiler flags that clang does not know \ +# how-to in Russian: https://nixtux.ru/768 \ +BIN_DIR="${BIN_DIR:-$(pwd)/local_bin}" \ +mkdir -p "$BIN_DIR" \ +install -m 0755 %{_datadir}/clang/clang-gcc-wrapper.sh "${BIN_DIR}/clang++" \ +sed -e "s,_CLANG_,$(which clang++),g" -i "${BIN_DIR}/clang++" \ +install -m 0755 %{_datadir}/clang/clang-gcc-wrapper.sh "${BIN_DIR}/clang" \ +sed -e "s,_CLANG_,$(which clang),g" -i "${BIN_DIR}/clang" \ +export PATH="${BIN_DIR}:${PATH}" \ +# set variables \ +CLANG="$(which clang)" \ +CLANGXX="$(which clang++)" \ +CC="clang" \ +CXX="clang++" \ +CPP="clang++" \ +# validate that clang wrapper is in PATH \ +echo "$CLANG" | grep -q "$BIN_DIR" \ +echo "$CLANGXX" | grep -q "$BIN_DIR" \ +export CLANG CLANGXX CC CXX CPP \ +%{nil} diff --git a/clang-gcc-wrapper.sh b/clang-gcc-wrapper.sh new file mode 100644 index 0000000..26420a8 --- /dev/null +++ b/clang-gcc-wrapper.sh @@ -0,0 +1,23 @@ +#!/bin/sh +# Author: mikhailnov +# Clean flags that clang does not know to fix building QtWebEngine with clang + +# _CLANG_ must be changed to /usr/bin/clang++ and then to /usr/bin/clang in another copy of this wrapper +if echo "$@" | grep -qE 'fvar-tracking-assignments|frecord-gcc-switches' + then + echo "DEBUG: clang-wrapper: arguements will be cut-out!" + echo "DEBUG: arguements were: " + echo "=========================" + echo "$@" + echo "=========================" + new_args="$(echo "$@" | sed -e 's/-fvar-tracking-assignments//g' -e 's/-frecord-gcc-switches//g')" + echo "DEBUG: new arguements are with and without expansion: " + echo "=========================" + echo ${new_args} + echo "=========================" + echo "${new_args}" + # https://stackoverflow.com/a/37141139 (??) + _CLANG_ ${new_args} || _CLANG_ "${new_args}" + else + _CLANG_ "$@" +fi diff --git a/ignore_group.patch b/ignore_group.patch new file mode 100644 index 0000000..7202c96 --- /dev/null +++ b/ignore_group.patch @@ -0,0 +1,12 @@ +diff -ur cfe-8.0.1.src-patch/include/clang/Driver/Options.td cfe-8.0.1.src/include/clang/Driver/Options.td +--- cfe-8.0.1.src-patch/include/clang/Driver/Options.td 2019-02-07 14:14:24.000000000 +0300 ++++ cfe-8.0.1.src/include/clang/Driver/Options.td 2019-07-27 18:05:03.049037905 +0300 +@@ -1760,6 +1760,8 @@ + def fuse_init_array : Flag<["-"], "fuse-init-array">, Group, Flags<[CC1Option]>, + HelpText<"Use .init_array instead of .ctors">; + def fno_var_tracking : Flag<["-"], "fno-var-tracking">, Group; ++def fno_var_tracking_assignments : Flag<["-"], "fno-var-tracking-assignments">, Group; ++def fvar_tracking_assignments : Flag<["-"], "fvar-tracking-assignments">, Group; + def fverbose_asm : Flag<["-"], "fverbose-asm">, Group; + def fvisibility_EQ : Joined<["-"], "fvisibility=">, Group, + HelpText<"Set the default symbol visibility for all global declarations">, Values<"hidden,default">; diff --git a/llvm.rpmlintrc b/llvm.rpmlintrc new file mode 100644 index 0000000..4b47213 --- /dev/null +++ b/llvm.rpmlintrc @@ -0,0 +1,7 @@ +addFilter("E: hardcoded-library-path") +addFilter("E: incoherent-version-in-name") +addFilter("E: devel-dependency") +addFilter("E: shared-lib-without-dependency-information") +# 202 warnings +addFilter("W: devel-file-in-non-devel-package") +addFilter("W: invalid-license") diff --git a/llvm.spec b/llvm.spec new file mode 100644 index 0000000..4bc312b --- /dev/null +++ b/llvm.spec @@ -0,0 +1,423 @@ +%bcond_without clang +%bcond_without polly +%bcond_without compiler + +Summary: Low Level Virtual Machine (LLVM) +Name: llvm +Version: 8.0.1 +Release: 1 +License: NCSA +Group: Development/Other +Url: http://llvm.org/ +Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/llvm-8.0.1.src.tar.xz +Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/cfe-8.0.1.src.tar.xz +Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/clang-tools-extra-8.0.1.src.tar.xz +Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/polly-8.0.1.src.tar.xz +Source4: https://github.com/llvm/llvm-project/releases/download/llvmorg-8.0.1/compiler-rt-8.0.1.src.tar.xz +Source1000: llvm.rpmlintrc +Source1010: clang-gcc-wrapper.macros +Source1011: clang-gcc-wrapper.sh +Patch0: cfe-%{version}-i586-unknown-linux-gnu.patch +# fvar-tracking-assignments and fno-var-tracking-assignments +Patch1: ignore_group.patch +BuildRequires: binutils-devel +BuildRequires: bison +BuildRequires: chrpath +BuildRequires: cmake +BuildRequires: flex +BuildRequires: graphviz +BuildRequires: groff +BuildRequires: libstdc++-devel +BuildRequires: libtool +BuildRequires: pkgconfig(libffi) +BuildRequires: pkgconfig(libtirpc) +BuildRequires: sed +BuildRequires: tcl +BuildRequires: zip +Requires: libstdc++-devel + +%description +LVM is a robust system, particularly well suited for developing new mid-level +language-independent analyses and optimizations of all sorts, including those +that require extensive interprocedural analysis. LLVM is also a great target +for front-end development for conventional or research programming languages, +including those which require compile-time, link-time, or run-time optimization +for effective implementation, proper tail calls or garbage collection. + +%files +%doc LICENSE.TXT +%{_bindir}/bugpoint +%{_bindir}/dsymutil +%{_bindir}/llc +%{_bindir}/lli +%{_bindir}/llvm* +%exclude %{_bindir}/llvm-config +%{_bindir}/obj2yaml +%{_bindir}/opt +%{_bindir}/sancov +%{_bindir}/sanstats +%{_bindir}/verify-uselistorder +%{_bindir}/yaml2obj +%{_datadir}/opt-viewer + +#---------------------------------------------------------------------------- + +%define plugins %mklibname %{name}-plugins + +%package -n %{plugins} +Summary: LLVM plugins +Group: System/Libraries +Provides: %{name}-plugins = %{EVRD} +Conflicts: %{_lib}llvm3.8 < 3.8.0-2 +Conflicts: %{_lib}llvm-devel < 3.8.0-2 + +%description -n %{plugins} +LLVM plugins. + +%files -n %{plugins} +%{_libdir}/BugpointPasses.so +%{_libdir}/LLVMHello.so +%{_libdir}/LLVMgold.so + +#---------------------------------------------------------------------------- +%define major 8 +%define maj_min %{major}.0 +%define maj_api %{maj_min}.1 +%define libname %mklibname %name %{major} + +%package -n %{libname} +Summary: LLVM shared libraries +Group: System/Libraries +Requires: %{plugins} +Conflicts: llvm < 3.0-4 + +%description -n %{libname} +Shared libraries for the LLVM compiler infrastructure. This is needed by +programs that are dynamically linked against libLLVM. + +%files -n %{libname} +%{_libdir}/libLLVM-%{major}.so +%{_libdir}/libLLVM-%{maj_api}.so + +#---------------------------------------------------------------------------- +%define lto_maj %{major} +%define liblto %mklibname lto %{lto_maj} + +%package -n %{liblto} +Summary: LLVM shared library +Group: System/Libraries +Conflicts: %{_lib}llvm-plugins < 6.0.0-3 + +%description -n %{liblto} +Shared library for the LLVM compiler infrastructure. + +%files -n %{liblto} +%{_libdir}/libLTO.so.%{lto_maj}* + +#---------------------------------------------------------------------------- + +%package -n %{devname} +Summary: Development files for LLVM +Group: Development/Other +Provides: llvm-devel = %{EVRD} +Requires: %{libname} = %{EVRD} +Requires: %{liblto} = %{EVRD} +Requires: %{name} = %{EVRD} +Requires: llvm-polly = %{EVRD} + +Obsoletes: llvm-polly-devel < %{EVRD} +Provides: llvm-polly-devel = %{EVRD} + +Conflicts: llvm < 3.0-7 +Conflicts: %{_lib}llvm3.0 < 3.0-9 +Conflicts: %{_lib}llvm-plugins < 6.0.0-3 + +%description -n %{devname} +This package contains the development files for LLVM. + +%files -n %{devname} +%{_bindir}/%{name}-config +%{_includedir}/%{name} +%{_includedir}/%{name}-c +%{_libdir}/cmake/%{name}/* +%{_libdir}/libLLVM*.a +%{_libdir}/libLLVM.so +%{_libdir}/libLTO.so +%{_libdir}/libOptRemarks.so* +%if %{with polly} +%{_includedir}/polly +%{_libdir}/cmake/polly/*.cmake +%{_libdir}/libPolly*.a +%endif + +#---------------------------------------------------------------------------- + +%package doc +Summary: Documentation for LLVM +Group: Books/Computer books +Requires: %{name} = %{EVRD} +BuildArch: noarch + +%description doc +Documentation for the LLVM compiler infrastructure. + +%files doc +%doc README.txt +%doc docs/tutorial +%doc examples + +#---------------------------------------------------------------------------- +%if %{with polly} +%package polly +Summary: Polyhedral optimizations for LLVM +License: MIT +Group: Development/Other + +%description polly +Polly is a polyhedral optimizer for LLVM. + +Using an abstract mathematical representation it analyzes and optimizes +the memory access pattern of a program. This includes data-locality +optimizations for cache locality as well as automatic parallelization +for thread-level and SIMD parallelism. + +Our overall goal is an integrated optimizer for data-locality and +parallelism that takes advantage of multi-cores, cache hierarchies, +short vector instructions as well as dedicated accelerators. + +%files polly +%{_bindir}/pollycc +%{_bindir}/pollyc++ +%{_libdir}/LLVMPolly.so +%endif +#---------------------------------------------------------------------------- +%if %{with clang} +%define clang_maj 8 +%define clang_api %{maj_api} +%define libclang %mklibname clang %{clang_maj} +# TODO: %%{_bindir}/clang is linked against static libclang.a, could it be +# linked against libclang.so instead, like llvm-* are against livLLVM.so? + +%package -n clang +Summary: A C language family front-end for LLVM +License: NCSA +Group: Development/Other +# TODO: is this requires:llvm needed, or just legacy from fedora pkg layout? +Requires: llvm = %{EVRD} +# clang requires gcc, clang++ requires libstdc++-devel +Requires: gcc +Requires: libstdc++-devel >= %{gcc_version} + +%description -n clang +clang: noun + 1. A loud, resonant, metallic sound. + 2. The strident call of a crane or goose. + 3. C-language family front-end toolkit. + +The goal of the Clang project is to create a new C, C++, Objective C +and Objective C++ front-end for the LLVM compiler. Its tools are built +as libraries and designed to be loosely-coupled and extensible. + +%files -n clang +%{_bindir}/c-index-test +%{_bindir}/clang* +%{_bindir}/diagtool +%{_bindir}/hmaptool +%{_bindir}/clang-tblgen +%{_datadir}/clang/bash-autocomplete.sh +%{_datadir}/clang/clang-gcc-wrapper.sh +%{_datadir}/clang/clang-include-fixer.el +%{_datadir}/clang/clang-include-fixer.py +%{_datadir}/clang/clang-rename.el +%{_datadir}/clang/clang-rename.py +%{_datadir}/clang/clang-tidy-diff.py +%{_datadir}/clang/run-clang-tidy.py +%{_datadir}/clang/run-find-all-symbols.py +%{_libdir}/clang/ +%{_sys_macros_dir}/clang-gcc-wrapper.macros + +#---------------------------------------------------------------------------- + +%package -n %{libclang} +Summary: Shared library for clang +Group: System/Libraries + +%description -n %{libclang} +Shared libraries for the clang compiler. This is needed by +programs that are dynamically linked against libclang. + +%files -n %{libclang} +%{_libdir}/libclang.so.%{maj_ver} +%{_libdir}/libclang-%{clang_major}.so +%{_libdir}/libclang-%{maj_api}.so + +#---------------------------------------------------------------------------- + +%package -n %{devclang} +Summary: Development files for clang +Group: Development/Other +Requires: %{libclang} = %{EVRD} +Provides: clang-devel = %{EVRD} +Conflicts: llvm-devel < 3.1 +Obsoletes: clang-devel < 3.1 + +%description -n %{devclang} +This package contains header files and libraries needed for using +libclang. + +%files -n %{devclang} +%dir %{_datadir}/clang/ +%{_includedir}/clang +%{_includedir}/clang-c +%{_libdir}/cmake/clang/ClangConfig.cmake +%{_libdir}/cmake/clang/ClangTargets-relwithdebinfo.cmake +%{_libdir}/cmake/clang/ClangTargets.cmake +%{_libdir}/libclang*.a +%{_libdir}/libclang.so + +#---------------------------------------------------------------------------- + +%package -n clang-analyzer +Summary: A source code analysis framework +License: NCSA +Group: Development/Other +Requires: clang = %{EVRD} +# not picked up automatically since files are currently not instaled +# in standard Python hierarchies yet +Requires: python + +%description -n clang-analyzer +The Clang Static Analyzer consists of both a source code analysis +framework and a standalone tool that finds bugs in C and Objective-C +programs. The standalone tool is invoked from the command-line, and is +intended to run in tandem with a build of a project or code base. + +%files -n clang-analyzer +%{_bindir}/scan-build +%{_bindir}/scan-view +%{_datadir}/scan-build/ +%{_datadir}/scan-view/ +%{_mandir}/man1/scan-build.1.* +%{_prefix}/libexec/c++-analyzer +%{_prefix}/libexec/ccc-analyzer +%endif + +#---------------------------------------------------------------------------- + +%prep +%setup -qn %{name}-%{version}.src -a1 -a2 -a3 -a4 + +%if %{with clang} +rm -rf tools/clang +mv cfe-%{version}.src tools/clang +mv clang-tools-extra-%{version}.src tools/clang/tools/extra +pushd tools/clang +%patch0 -p1 -b .gnu~ +%patch1 -p1 ignore_group.patch +popd +%endif + +%if %{with polly} +mv polly-%{version}.src tools/polly +%endif + +%if %{with compiler} +mv compiler-rt-%{version}.src projects/compiler-rt +%endif + +%build +# Build with gcc/g++, not clang if it happens to be installed +export CC=gcc +export CXX=g++ +export LD=ld.gold + +# A couple more fixes from OMV + a workaround for a bug (?) in GCC 4.9: +# https://llvm.org/bugs/show_bug.cgi?id=20080 and +# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61659 +# (-fno-devirtualize) +# +# compiler-rt assumes off_t is 64 bits -- make sure this is true even on +# 32 bit OSes +%ifarch %ix86 +# compiler-rt doesn't support ix86 with x<6 either +export CFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -g1" +export CXXFLAGS="%{optflags} -march=i686 -D_LARGEFILE_SOURCE=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -fno-devirtualize -g1" +%else +export CXXFLAGS="%{optflags} -fno-devirtualize -g1" +%endif + + +%ifarch %ix86 +# Fix noexecstack +for i in projects/compiler-rt/lib/builtins/i386/*.S; do + cat >>$i <<'EOF' +#if defined(__linux__) && defined(__ELF__) +.section .note.GNU-stack,"",%progbits +#endif +EOF +done +%endif + +%cmake \ + -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ +%ifarch %_build_arch + -DLLVM_LIBDIR_SUFFIX="64" \ +%else + -DLLVM_LIBDIR_SUFFIX="" \ +%endif +%if %{with polly} + -DWITH_POLLY:BOOL=ON \ + -DLINK_POLLY_INTO_TOOLS:BOOL=ON \ +%endif + -DLLVM_ENABLE_FFI:BOOL=ON \ + -DLLVM_ENABLE_RTTI:BOOL=ON \ + -DLLVM_BINUTILS_INCDIR=%{_includedir} \ + -DLLVM_INCLUDE_UTILS:BOOL=ON \ + -DLLVM_BUILD_LLVM_DYLIB=ON \ + -DLLVM_LINK_LLVM_DYLIB=ON \ + -DOCAMLFIND=NOTFOUND + +%make + +%install + +%makeinstall_std -C build +%if %{with polly} +# [From OMV] +# Polly bits as described on +# http://polly.llvm.org/example_load_Polly_into_clang.html +cat >%{buildroot}%{_bindir}/pollycc <<'EOF' +#!/bin/sh +exec %{_bindir}/clang -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@" +EOF +cat >%{buildroot}%{_bindir}/pollyc++ <<'EOF' +#!/bin/sh +exec %{_bindir}/clang++ -O3 -Xclang -load -Xclang %{_libdir}/LLVMPolly.so "$@" +EOF +chmod 0755 %{buildroot}%{_bindir}/pollycc %{buildroot}%{_bindir}/pollyc++ +%endif + +%if %{with clang} +# Clang - Git integration. Not needed. + rm -f %{buildroot}%{_bindir}/git-clang-format + +# Remove editor integration files + rm -f %{buildroot}%{_datadir}/clang/clang-format* + +# Symlinks for libclang to maintain compatibility with the older releases. + ln -s %{_libdir}/libclang.so.clang_maj %{buildroot}%{_libdir}/libclang-%{clang_major}.so + ln -s %{_libdir}/libclang.so.clang_maj %{buildroot}%{_libdir}/libclang-%{maj_api}.so + +#add clang-tblgen + cp -a build/bin/clang-tblgen %{buildroot}%{_bindir} + +# install clang-gcc-wrapper +install -D -m 0644 %{SOURCE1011} %{buildroot}%{_datadir}/clang/ +mkdir -p %{buildroot}%{_sys_macros_dir} +install -m 0644 %{SOURCE1010} %{buildroot}%{_sys_macros_dir}/ +%endif + +# Install libraries used for testing +cp -a build/%{_lib}/BugpointPasses.so %{buildroot}%{_libdir} +cp -a build/%{_lib}/LLVMHello.so %{buildroot}%{_libdir} \ No newline at end of file