-%bcond_with doxygen
-%bcond_without clang
-
-%global downloadurl http://llvm.org/%{?prerel:pre-}releases/%{version}%{?prerel:/%{prerel}}
-
-# gold linker support
-# arch list from binutils spec
-%global gold_arches %ix86 x86_64
-%ifarch %gold_arches
-%bcond_without gold
-%else
-%bcond_with gold
-%endif
-
-Name: llvm
-Version: 3.5.0
-Release: 0
-VCS: platform/upstream/llvm#submit/tizen/20130912.090411-0-gd860bd21c282d949117b5c9b73865809e1c5aacc
-Summary: The Low Level Virtual Machine
-
-Group: Development/Toolchain
-License: NCSA
-URL: http://llvm.org/
-Source0: llvm-%{version}.src.tar.gz
-Source1: cfe-%{version}.src.tar.xz
-# multilib fixes
-Source2: llvm-Config-config.h
-Source3: llvm-Config-llvm-config.h
-Source1001: llvm.manifest
-
+Name: llvm
+Summary: PUT SUMMARY HERE
+Version: 3.8.1
+Release: 1
+Group: Development/Toolchain
+License: NCSA
+Source0: %{name}-%{version}.tar.gz
+Source1: clang.tar.gz
+Source2: lldb.tar.gz
+Source1001: llvm.manifest
+Patch: lldb.patch
+Patch1: tls-patch.patch
+
+BuildRequires: cmake
+BuildRequires: python
BuildRequires: python-devel
-BuildRequires: bison
-BuildRequires: chrpath
-BuildRequires: flex
-BuildRequires: gcc-c++ >= 3.4
-BuildRequires: groff
-BuildRequires: libffi-devel
-BuildRequires: libtool-ltdl-devel
-%if %{with gold}
-BuildRequires: binutils-devel
-%endif
-BuildRequires: zip
-# for doxygen documentation
-%if %{with doxygen}
-BuildRequires: doxygen graphviz
-%endif
-Requires: libllvm = %{version}-%{release}
+BuildRequires: swig
+Requires: libllvm = %{version}-%{release}
+
%description
-LLVM is a compiler infrastructure designed for compile-time,
-link-time, runtime, and idle-time optimization of programs from
-arbitrary programming languages. The compiler infrastructure includes
-mirror sets of programming tools as well as libraries with equivalent
+LLVM is a compiler infrastructure designed for compile-time, link-time, runtime,
+and idle-time optimization of programs from arbitrary programming languages.
+LLVM is written in C++ and has been developed since 2000 at the University of
+Illinois and Apple. It currently supports compilation of C and C++ programs,
+using front-ends derived from GCC 4.0.1. A new front-end for the C family of
+languages is in development. The compiler infrastructure
+includes mirror sets of programming tools as well as libraries with equivalent
functionality.
-
%package devel
-Summary: Libraries and header files for LLVM
-Requires: %{name} = %{version}-%{release}
-Requires: libffi-devel
-Requires: libstdc++-devel >= 3.4
-Provides: llvm-static = %{version}-%{release}
-Requires(pre): update-alternatives
+Summary: Libraries and Header Files for LLVM %{version}
+Requires: %{name} = %{version}
%description devel
-This package contains library and header files needed to develop new
-native programs that use the LLVM infrastructure.
-
-
-
+This package contains library and header files needed to develop
+new native programs that use the LLVM infrastructure.
%package -n libllvm
-Summary: LLVM shared libraries
+Summary: LLVM shared libraries
%description -n libllvm
Shared libraries for the LLVM compiler infrastructure.
-
-%if %{with clang}
%package -n clang
-Summary: A C language family front-end for LLVM
-License: NCSA
-Requires: llvm = %{version}-%{release}
-# clang requires gcc, clang++ requires libstdc++-devel
-Requires: gcc
-Requires: libstdc++-devel
+Summary: Clang %{version} (C Language family frontend for LLVM)
+License: NCSA
+Requires: llvm = %{version}-%{release}
+Provides: libclang.so.%{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.
-
+A new front-end for the C family of languages is in development.
%package -n clang-devel
-Summary: Header files for clang
-Requires: clang = %{version}-%{release}
+Summary: Clang %{version} Development Library
+Requires: clang = %{version}-%{release}
%description -n clang-devel
-This package contains header files for the Clang compiler.
-
-
-%package -n clang-analyzer
-Summary: A source code analysis framework
-License: NCSA
-Requires: clang = %{version}-%{release}
-# 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.
-
-
-%package -n clang-doc
-Summary: Documentation for Clang
-BuildArch: noarch
-Requires: %{name} = %{version}-%{release}
+This package contains the clang (C language) frontend for LLVM.
+(development files)
-%description -n clang-doc
-Documentation for the Clang compiler front-end.
-%endif
+%package -n lldb
+Summary: LLDB
+License: NCSA
-%if %{with doxygen}
-%package apidoc
-Summary: API documentation for LLVM
-BuildArch: noarch
-Requires: %{name}-doc = %{version}-%{release}
-
-
-%description apidoc
-API documentation for the LLVM compiler infrastructure.
-
-
-%if %{with clang}
-%package -n clang-apidoc
-Summary: API documentation for Clang
-BuildArch: noarch
-Requires: clang-doc = %{version}-%{release}
-
-
-%description -n clang-apidoc
-API documentation for the Clang compiler.
-%endif
-%endif
-
+%description -n lldb
+LLDB is a next generation, high-performance debugger. It is built as a set
+of reusable components which highly leverage existing libraries in the
+larger LLVM Project, such as the Clang expression parser and LLVM
+disassembler.
+%package -n lldb-devel
+Summary: Development header files for LLDB
+Requires: lldb = %{version}-%{release}
+%description -n lldb-devel
+The package contains header files for the LLDB debugger.
%prep
-%setup -q -n llvm-%{version}.src %{?with_clang:-a1}
+%setup -q -n llvm-%{version}.src
cp %{SOURCE1001} .
-rm -r -f tools/clang
-%if %{with clang}
-mv cfe-%{version}%{?prerel}.src tools/clang
-%endif
-
-
-
-
-# fix ld search path
-sed -i 's|/lib /usr/lib $lt_ld_extra|%{_libdir} $lt_ld_extra|' \
- ./configure
-
+cd tools
+echo `pwd`
+gzip -dc %{SOURCE1} | tar -xvf -
+gzip -dc %{SOURCE2} | tar -xvf -
+pwd
+%patch -p2
+cd ..
+%patch -P 1 -p1
%build
-# Build without -ftree-pre as a workaround for clang segfaulting on x86_64.
-# https://bugzilla.redhat.com/show_bug.cgi?id=791365
-%global optflags %(echo %{optflags} | sed 's/-O2 /-O2 -fno-tree-pre /')
-
-# Disabling assertions now, rec. by pure and needed for OpenGTL
-%configure \
- --prefix=%{_prefix} \
- --libdir=%{_libdir}/%{name} \
-%if %{with doxygen}
- --enable-doxygen \
-%endif
-%if %{with gold}
- --with-binutils-include=%{_includedir} \
-%endif
- --enable-targets=all \
-%ifarch armv7hl armv7l
- --with-cpu=cortex-a8 \
- --with-tune=cortex-a8 \
- --with-arch=armv7-a \
- --with-float=hard \
- --with-fpu=vfpv3-d16 \
- --with-abi=aapcs-linux \
-%endif
- --disable-assertions \
- --enable-debug-runtime \
- --enable-jit \
- --enable-libffi \
- --enable-shared
-
-# FIXME file this
-# configure does not properly specify libdir
-sed -i 's|(PROJ_prefix)/lib|(PROJ_prefix)/%{_lib}/%{name}|g' Makefile.config
-
-# FIXME upstream need to fix this
-# llvm-config.cpp hardcodes lib in it
-sed -i 's|ActiveLibDir = ActivePrefix + "/lib"|ActiveLibDir = ActivePrefix + "/%{_lib}/%{name}"|g' tools/llvm-config/llvm-config.cpp
-
-make %{_smp_mflags} REQUIRES_RTTI=1 VERBOSE=1 OPTIMIZE_OPTION="%{optflags}"
-
-%check
-# the Koji build server does not seem to have enough RAM
-# for the default 16 threads
-
-make check LIT_ARGS="-v -j4" \
-%ifarch %{arm}
- | tee llvm-testlog-%{_arch}.txt
-%else
- %{nil}
-%endif
-
-%if %{with clang}
-# FIXME:
-# unexpected failures on all platforms with GCC 4.7.0.
-# capture logs
-make -C tools/clang/test TESTARGS="-v -j4" \
- | tee clang-testlog-%{_arch}.txt
-%endif
-
-%install
-make install DESTDIR=%{buildroot} \
- PROJ_docsdir=/moredocs
-# multilib fixes
-mv %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}}
+mkdir build
+cd build
+cmake \
+ -DCMAKE_C_COMPILER=/usr/bin/gcc \
+ -DCMAKE_CXX_COMPILER=/usr/bin/g++ \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DLLVM_ENABLE_ASSERTIONS=No \
+ -DLLVM_TARGETS_TO_BUILD='X86;ARM' \
+ -DLLVM_BUILD_LLVM_DYLIB=1 \
+ -DLLDB_DISABLE_LIBEDIT=1 \
+ -DLLDB_DISABLE_PYTHON=1 \
+ -DLLDB_DISABLE_CURSES=1 ..
+
+make %{?jobs:-j%jobs}
-pushd %{buildroot}%{_includedir}/llvm/Config
-mv config.h config-%{__isa_bits}.h
-cp -p %{SOURCE2} config.h
-mv llvm-config.h llvm-config-%{__isa_bits}.h
-cp -p %{SOURCE3} llvm-config.h
-popd
-
-# Create ld.so.conf.d entry
-mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
-cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf << EOF
-%{_libdir}/llvm
-EOF
-
-%if %{with clang}
-# Static analyzer not installed by default:
-# http://clang-analyzer.llvm.org/installation#OtherPlatforms
-mkdir -p %{buildroot}%{_libdir}/clang-analyzer
-# create launchers
-for f in scan-{build,view}; do
- ln -s %{_libdir}/clang-analyzer/$f/$f %{buildroot}%{_bindir}/$f
-done
-
-(cd tools/clang/tools && cp -pr scan-{build,view} \
- %{buildroot}%{_libdir}/clang-analyzer/)
-%endif
-
-# Move documentation back to build directory
-#
-mv %{buildroot}/moredocs .
-rm -f moredocs/*.tar.gz
-rm -f moredocs/ocamldoc/html/*.tar.gz
-
-# and separate the apidoc
-%if %{with doxygen}
-mv moredocs/html/doxygen apidoc
-mv tools/clang/docs/doxygen/html clang-apidoc
-%endif
-
-# And prepare Clang documentation
-#
-%if %{with clang}
-mkdir clang-docs
-for f in LICENSE.TXT NOTES.txt README.txt; do # TODO.txt; do
- ln tools/clang/$f clang-docs/
-done
-rm -rf tools/clang/docs/{doxygen*,Makefile*,*.graffle,tools}
-%endif
-
-
-file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
-file %{buildroot}/%{_libdir}/llvm/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
-#chrpath -d %%{buildroot}/%%{_libexecdir}/clang-cc
-
-# Get rid of erroneously installed example files.
-rm %{buildroot}%{_libdir}/%{name}/*LLVMHello.*
-
-# FIXME file this bug
-sed -i 's,ABS_RUN_DIR/lib",ABS_RUN_DIR/%{_lib}/%{name}",' \
- %{buildroot}%{_bindir}/llvm-config-%{__isa_bits}
-
-chmod -x %{buildroot}%{_libdir}/%{name}/*.a
-
-# remove documentation makefiles:
-# they require the build directory to work
-find examples -name 'Makefile' | xargs -0r rm -f
-#rm %{buildroot}/usr/lib/llvm/libLLVM-3.5svn.so
-
-
-cd $RPM_BUILD_DIR
-
-%remove_docs
-
-
-%post -n libllvm -p /sbin/ldconfig
+%install
+cd build
+%make_install
-%postun -n libllvm -p /sbin/ldconfig
+rm -rf %{buildroot}/usr/lib/debug/*
+rm -rf %{buildroot}/usr/local/lib/lib*.a
-%if %{with clang}
%post -n clang -p /sbin/ldconfig
-
%postun -n clang -p /sbin/ldconfig
-%endif
-
-%posttrans devel
-# link llvm-config to the platform-specific file;
-# use ISA bits as priority so that 64-bit is preferred
-# over 32-bit if both are installed
-/usr/sbin/update-alternatives \
- --install \
- %{_bindir}/llvm-config \
- llvm-config \
- %{_bindir}/llvm-config-%{__isa_bits} \
- %{__isa_bits}
-
-%postun devel
-if [ $1 -eq 0 ]; then
- /usr/sbin/update-alternatives --remove llvm-config \
- %{_bindir}/llvm-config-%{__isa_bits}
-fi
-exit 0
+%post -n lldb -p /sbin/ldconfig
+%postun -n lldb -p /sbin/ldconfig
+
+%clean
+echo Cleaning %{buildroot}
+#rm -rf %{buildroot}
%files
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%license LICENSE.TXT
-%{_bindir}/bugpoint
-%{_bindir}/llc
-%{_bindir}/lli
-%exclude %{_bindir}/llvm-config-%{__isa_bits}
-%{_bindir}/llvm*
-%{_bindir}/macho-dump
-%{_bindir}/opt
-%{_bindir}/FileCheck
-%{_bindir}/count
-%{_bindir}/not
-%{_bindir}/lli-child-target
+/usr/local/bin/bugpoint
+/usr/local/bin/llc
+/usr/local/bin/lli
+/usr/local/bin/llvm-ar
+/usr/local/bin/llvm-as
+/usr/local/bin/llvm-bcanalyzer
+/usr/local/bin/llvm-c-test
+/usr/local/bin/llvm-config
+/usr/local/bin/llvm-cov
+/usr/local/bin/llvm-cxxdump
+/usr/local/bin/llvm-diff
+/usr/local/bin/llvm-dis
+/usr/local/bin/llvm-dsymutil
+/usr/local/bin/llvm-dwarfdump
+/usr/local/bin/llvm-dwp
+/usr/local/bin/llvm-extract
+/usr/local/bin/llvm-lib
+/usr/local/bin/llvm-link
+/usr/local/bin/llvm-lto
+/usr/local/bin/llvm-mc
+/usr/local/bin/llvm-mcmarkup
+/usr/local/bin/llvm-nm
+/usr/local/bin/llvm-objdump
+/usr/local/bin/llvm-pdbdump
+/usr/local/bin/llvm-profdata
+/usr/local/bin/llvm-ranlib
+/usr/local/bin/llvm-readobj
+/usr/local/bin/llvm-rtdyld
+/usr/local/bin/llvm-size
+/usr/local/bin/llvm-split
+/usr/local/bin/llvm-stress
+/usr/local/bin/llvm-symbolizer
+/usr/local/bin/llvm-tblgen
+/usr/local/bin/obj2yaml
+/usr/local/bin/opt
+/usr/local/bin/sancov
+/usr/local/bin/scan-build
+/usr/local/bin/scan-view
+/usr/local/bin/verify-uselistorder
+/usr/local/bin/yaml2obj
+/usr/local/lib/BugpointPasses.so
+/usr/local/lib/LLVMHello.so
+/usr/local/lib/libLTO.so
%files devel
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_bindir}/llvm-config-%{__isa_bits}
-%{_includedir}/%{name}
-%{_includedir}/%{name}-c
-%{_libdir}/%{name}/*.a
-%{_datadir}/%{name}/cmake/*.cmake
+/usr/local/include/llvm/*
+/usr/local/include/llvm-c/*
+/usr/local/share/*
%files -n libllvm
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%config(noreplace) %{_sysconfdir}/ld.so.conf.d/llvm-%{_arch}.conf
-%dir %{_libdir}/%{name}
-%if %{with clang}
-%exclude %{_libdir}/%{name}/libclang.so
-%endif
-%{_libdir}/%{name}/*.so
-
-%if %{with clang}
+/usr/local/lib/libLLVM*.so*
+
+
%files -n clang
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_bindir}/clang*
-%{_bindir}/c-index-test
-%{_libdir}/%{name}/libclang.so
-%{_prefix}/lib/clang
+/usr/local/bin/c-index-test
+/usr/local/bin/clang
+/usr/local/bin/clang++
+/usr/local/bin/clang-3.8
+/usr/local/bin/clang-check
+/usr/local/bin/clang-cl
+/usr/local/bin/clang-format
+/usr/local/bin/git-clang-format
+/usr/local/lib/clang/3.8.1/include/*
+/usr/local/lib/libclang.so
+/usr/local/lib/libclang.so.3.8
+/usr/local/libexec/c++-analyzer
+/usr/local/libexec/ccc-analyzer
%files -n clang-devel
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_includedir}/clang
-%{_includedir}/clang-c
+/usr/local/include/clang/*
+/usr/local/include/clang-c/*
-%files -n clang-analyzer
+%files -n lldb
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%{_bindir}/scan-build
-%{_bindir}/scan-view
-%{_libdir}/clang-analyzer
-%endif
-
-
-%if %{with doxygen}
-%files apidoc
+/usr/local/bin/lldb
+/usr/local/bin/lldb-3.8.1
+/usr/local/bin/lldb-argdumper
+/usr/local/bin/lldb-mi
+/usr/local/bin/lldb-mi-3.8.1
+/usr/local/bin/lldb-server
+/usr/local/bin/lldb-server-3.8.1
+/usr/local/lib/liblldb.so
+/usr/local/lib/liblldb.so.3.8.1
+
+%files -n lldb-devel
%manifest %{name}.manifest
%defattr(-,root,root,-)
-%doc apidoc/*
-
-%if %{with clang}
-%files -n clang-apidoc
-%manifest %{name}.manifest
-%defattr(-,root,root,-)
-%doc clang-apidoc/*
-%endif
-%endif
-
+/usr/local/include/lldb/*