File project.diff of Package llvm

--- lldb-cmake.patch.orig
+++ lldb-cmake.patch
@@ -29,3 +29,16 @@ Index: lldb-3.8.0.src/source/Core/IOHand
  #endif
  
  // C++ Includes
+Index: lldb-3.8.0.src/scripts/prepare_bindings.py
+===================================================================
+--- lldb-3.8.0.src/scripts/prepare_bindings.py.mm	2015-11-25 18:49:47.000000000 +0100
++++ lldb-3.8.0.src/scripts/prepare_bindings.py	2016-08-01 16:42:47.000000000 +0200
+@@ -34,7 +34,7 @@ def prepare_binding_for_language(scripts
+     the process will exit where it fails.
+     """
+     # Ensure the language-specific prepare module exists.
+-    script_name = "prepare_binding_{}.py".format(script_lang)
++    script_name = "prepare_binding_{0}.py".format(script_lang)
+     lang_path = os.path.join(scripts_dir, script_lang)
+     script_path = os.path.join(lang_path, script_name)
+     if not os.path.exists(script_path):
--- lldb.spec.orig
+++ lldb.spec
@@ -25,6 +25,8 @@ License:        NCSA
 Group:          Development/Tools/Debuggers
 Url:            http://lldb.llvm.org
 Source:         http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
+Source102:      argparse.py
+Source103:      importlib.py
 # PATCH-FIX-OPENSUSE lldb-cmake.patch -- Let us set LLDB_REVISION and fix ncurses include path.
 Patch0:         lldb-cmake.patch
 # PATCH-FIX-UPSTREAM D15067.id41365.diff -- Patch from upstream review system to fix out of tree build (http://reviews.llvm.org/D15067)
@@ -33,6 +35,10 @@ Patch1:         D15067.id41365.diff
 Patch2:         lldb-add-pthread-dl-libs.patch
 BuildRequires:  cmake
 BuildRequires:  fdupes
+%if 0%{?suse_version} <= 1110
+BuildRequires:  gcc48-c++
+BuildRequires:  xz
+%endif
 BuildRequires:  libedit-devel
 BuildRequires:  libffi-devel
 BuildRequires:  libxml2-devel
@@ -82,6 +88,11 @@ This package contains the development fi
 sed -i s,LLDB_REVISION,\"%{_revision}\",g source/lldb.cpp #"
 
 %build
+%if 0%{?suse_version} <= 1110
+cp $RPM_SOURCE_DIR/argparse.py .
+cp $RPM_SOURCE_DIR/importlib.py .
+export PYTHONPATH=$PWD
+%endif
 mkdir build
 pushd build
 
--- llvm.changes.orig
+++ llvm.changes
@@ -21,6 +21,14 @@ Wed May 18 11:14:38 UTC 2016 - idonmez@s
 - Disable libcxx/lldb/openmp for SLE fate#319582 
 
 -------------------------------------------------------------------
+Tue Apr 26 13:59:05 UTC 2016 - matz@suse.de
+
+- On SLE11 add build requires on xz.
+- Use Makefiles, accept lower version python and cmake, hack
+  around a ld.so bug with $ORIGIN, add argparse.py to make python
+  2.6.9 usable.
+
+-------------------------------------------------------------------
 Mon Apr 25 07:25:22 UTC 2016 - idonmez@suse.com
 
 - Update rpmlintrc to whitelist libLTO.so 
--- llvm.spec.orig
+++ llvm.spec
@@ -62,6 +62,8 @@ Source8:        http://llvm.org/releases
 Source9:        http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
 Source100:      %{name}-rpmlintrc
 Source101:      baselibs.conf
+Source102:      argparse.py
+Source103:      importlib.py
 # PATCH-FIX-OPENSUSE set-revision.patch idoenmez@suse.de -- Allow us to set revision
 Patch1:         set-revision.patch
 # PATCH-FIX-OPENSUSE assume-opensuse.patch idoenmez@suse.de -- Always enable openSUSE/SUSE features
@@ -77,22 +79,31 @@ Patch8:         revert-cmake-soname.patc
 Patch9:         lldb-cmake.patch
 Patch10:        glibc-2.23-libcxx.patch
 Patch11:        glibc-2.24-libcxx.patch
+Patch12:        cmake-lower-version.diff
+Patch13:        lldb-old-glibc.diff
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 BuildRequires:  binutils-devel >= 2.21.90
 BuildRequires:  bison
 BuildRequires:  cmake
 BuildRequires:  fdupes
 BuildRequires:  flex
+%if 0%{?suse_version} <= 1110
+BuildRequires:  gcc48
+BuildRequires:  gcc48-c++
+%else
 BuildRequires:  gcc
 BuildRequires:  gcc-c++
+%endif
 BuildRequires:  groff
 BuildRequires:  libedit-devel
-BuildRequires:  libstdc++-devel
 BuildRequires:  libtool
 BuildRequires:  ncurses-devel
 BuildRequires:  ninja
 BuildRequires:  python-base
 BuildRequires:  python-xml
+%if 0%{?suse_version} <= 1110
+BuildRequires:  xz
+%endif
 # llvm does not work on ppc or s390
 ExcludeArch:    ppc s390
 
@@ -123,7 +134,17 @@ new native programs that use the LLVM in
 %package clang
 Summary:        CLANG frontend for LLVM
 Group:          Development/Languages/Other
+%if 0%{?suse_version} <= 1110
+# clang needs a gcc libstdc++ installation, at least the version
+# it was compiled with (i.e. 4.8 here).  To auto-detect and accept
+# that GCC install it needs more than just the headers, it needs
+# the compiler installed :-/  Otherwise users always would have to
+# use -stdlib=libc++ (to use clangs libc++).  So to make
+# life easy simply add a Requires on a GCC c++ compiler.
+Requires:       gcc48-c++
+%else
 Requires:       libstdc++-devel
+%endif
 
 %description clang
 This package contains the clang (C language) frontend for LLVM.
@@ -193,6 +214,9 @@ disassembler.
 %patch10
 %patch11
 %endif
+%patch11
+%patch12
+%patch13
 
 # Move into right place
 mv cfe-%{version}.src tools/clang
@@ -209,6 +233,15 @@ mv libcxxabi-%{version}.src projects/lib
 
 rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp
 rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
+
+%if 0%{?suse_version} <= 1110
+# Very old glibc, no C11 support yet, so just don't test for it.
+rm projects/libcxx/test/std/depr/depr.c.headers/uchar_h.pass.cpp
+# glibc doesn't provide cxa_thread_atexit_impl, and clang doesn't
+# provide a fallback implementation for cxa_thread_exit, like GCC does
+# just don't test it.
+rm projects/libcxxabi/test/cxa_thread_atexit_test.pass.cpp
+%endif
 %endif
 
 %if %{build_lldb}
@@ -236,13 +269,30 @@ EOF
 
 %build
 TOPLEVEL=$PWD
+%if 0%{?suse_version} <= 1110
+cp $RPM_SOURCE_DIR/argparse.py .
+cp $RPM_SOURCE_DIR/importlib.py .
+export PYTHONPATH=$PWD
+%endif
 mkdir stage1 stage2
 pushd stage1
 
+%if 0%{?suse_version} <= 1110
+export CC=gcc-4.8
+export CXX=g++-4.8
+%else
 export CC=gcc
 export CXX=g++
+%endif
 
+%if 0%{?suse_version} <= 1110
+# the old cmake and ninja don't track deps on shared libs correctly
+# (it's trying to run an executable before the .so.3.8 symlink is created)
+# so use Makefiles.
+cmake -G "Unix Makefiles" \
+%else
 cmake -G "Ninja" \
+%endif
       -DBUILD_SHARED_LIBS=ON \
       -DCMAKE_BUILD_TYPE=Release \
       -DLLVM_ENABLE_ASSERTIONS=OFF \
@@ -250,15 +300,46 @@ cmake -G "Ninja" \
       -DLLDB_DISABLE_PYTHON=ON \
       ..
 
+%if 0%{?suse_version} <= 1110
+# On SLE11 support for $ORIGIN is slightly broken.  It works in ldd,
+# but when running the executable it fails
+export LD_LIBRARY_PATH=$TOPLEVEL/stage1/lib
+make %{?_smp_mflags} VERBOSE=1 clang
+%else
 ninja %{?_smp_mflags} clang -v
+%endif
+
+%if 0%{?suse_version} <= 1110
+# For stage2 we need a different LD_LIBRARY_PATH, but the stage1 executables
+# really need the stage1 libpath.  OTOH during stage2 also stage2 binaries are run
+# (e.g. llvm-tblgen), so we can't have both.  So add some wrapper scripts.
+# clangs behaviour changes according to argv[0], which must be clang++ for linking
+# c++ programs; exec changes the program name.
+for i in clang clang++; do
+  cat > bin/w$i <<EOF
+#!/bin/sh
+export LD_LIBRARY_PATH=$TOPLEVEL/stage1/lib
+exec \`dirname \$0\`/$i \${1+"\$@"}
+EOF
+  chmod +x bin/w$i
+done
+
+%endif
 
 popd
 pushd stage2
 
+%if 0%{?suse_version} <= 1110
+export CC=$TOPLEVEL/stage1/bin/wclang
+export CXX=$TOPLEVEL/stage1/bin/wclang++
+
+cmake -G "Unix Makefiles" \
+%else
 export CC=$TOPLEVEL/stage1/bin/clang
 export CXX=$TOPLEVEL/stage1/bin/clang++
 
 cmake -G "Ninja" \
+%endif
       -DBUILD_SHARED_LIBS=ON \
 %ifarch %arm ppc64 ppc64le
       -DCMAKE_BUILD_TYPE=Release \
@@ -292,29 +373,51 @@ cmake -G "Ninja" \
 %endif
       ..
 
+%if 0%{?suse_version} <= 1110
+export LD_LIBRARY_PATH=$TOPLEVEL/stage2/lib64
+make %{?_smp_mflags} VERBOSE=1
+%else
 ninja %{?_smp_mflags} -v
+%endif
 
 %check
+TOPLEVEL=$PWD
 cd stage2
 %ifnarch armv7hl armv7l
 %if 0%{!?qemu_user_space_build:1}
 # we just do not have enough memory with qemu emulation
 
+%if 0%{?suse_version} <= 1110
+export LD_LIBRARY_PATH=$TOPLEVEL/stage2/lib64
+export PYTHONPATH=$TOPLEVEL
+make check
+make clang-test
+%else
 ninja check
 ninja clang-test
+%endif
 
 %if %{build_libcxx}
 
+%if 0%{?suse_version} <= 1110
+make check-libcxx
+make check-libcxxabi
+%else
 ninja check-libcxx
 ninja check-libcxxabi
 %endif
+%endif
 
 %endif
 %endif
 
 %install
 cd stage2
+%if 0%{?suse_version} <= 1110
+DESTDIR=%{buildroot} make install
+%else
 DESTDIR=%{buildroot} ninja install
+%endif
 cd ..
 
 # Build man/html pages