Accepting request 368685 from home:namtrac:branches:devel:tools:compiler

- Update to llvm 3.8.0
  * See http://llvm.org/releases/3.8.0/docs/ReleaseNotes.html and
    http://llvm.org/releases/3.8.0/tools/clang/docs/ReleaseNotes.html
- Fold lldb build into llvm and disable python support
- Drop clang-disable-ada-extension.patch, libcxxabi-exceptions.patch
  and cmake-host-triple.patch
- Add revert-cmake-soname.patch to fix soname handling

OBS-URL: https://build.opensuse.org/request/show/368685
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm?expand=0&rev=430
This commit is contained in:
Martin Pluskal
2016-03-09 06:32:53 +00:00
committed by Git OBS Bridge
parent e8b1875bae
commit f49d2e187c
37 changed files with 327 additions and 510 deletions

300
llvm.spec
View File

@@ -16,14 +16,16 @@
#
%define _revision 246586
%define _release_version 3.7.0
%define _revision 262553
%define _release_version 3.8.0
%define build_lldb 0
%define build_libcxx 0
%define build_openmp 0
%ifarch x86_64
%define build_libcxx 1
%define build_lldb 1
%endif
%ifarch ppc64 ppc64le %{ix86} x86_64
@@ -31,7 +33,7 @@
%endif
Name: llvm
Version: 3.7.0
Version: 3.8.0
Release: 0
Summary: Low Level Virtual Machine
License: NCSA
@@ -47,27 +49,27 @@ Source5: http://llvm.org/releases/%{version}/openmp-%{version}.src.tar.xz
# cd docs
# make -f Makefile.sphinx man html
# cd ..
# tar cvJf llvm-docs-3.7.0.src.tar.xz llvm-3.7.0.src/docs/_build/{man,html}
# tar cvJf llvm-docs-3.8.0.src.tar.xz llvm-3.8.0.src/docs/_build/{man,html}
Source6: llvm-docs-%{version}.src.tar.xz
Source7: cfe-docs-%{version}.src.tar.xz
Source8: http://llvm.org/releases/%{version}/clang-tools-extra-%{version}.src.tar.xz
Source9: http://llvm.org/releases/%{version}/lldb-%{version}.src.tar.xz
Source100: %{name}-rpmlintrc
Source101: baselibs.conf
# 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
Patch2: assume-opensuse.patch
# PATCH-FIX-OPENSUSE clang-disable-ada-extension.patch idoenmez@suse.de -- Don't run gcc for ada files
Patch3: clang-disable-ada-extension.patch
# PATCH-FIX-OPENSUSE default-to-i586.patch -- Use i586 as default target for 32bit
Patch4: default-to-i586.patch
Patch3: default-to-i586.patch
# PATCH-FIX-OPENSUSE arm_suse_support.diff --Enable ARM suse toolchain support
Patch6: arm_suse_support.diff
Patch7: cmake-host-triple.patch
Patch10: clang-resourcedirs.patch
Patch11: libcxxabi-exceptions.patch
Patch13: llvm-remove-clang-only-flags.patch
Patch15: llvm-fix-find-gcc5-install.patch
Patch16: glibc-2.23-libcxx.patch
Patch4: arm_suse_support.diff
Patch5: clang-resourcedirs.patch
Patch6: llvm-remove-clang-only-flags.patch
Patch7: llvm-fix-find-gcc5-install.patch
Patch8: revert-cmake-soname.patch
Patch9: lldb-cmake.patch
Patch10: glibc-2.23-libcxx.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: binutils-devel >= 2.21.90
BuildRequires: bison
@@ -75,14 +77,15 @@ BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: flex
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: groff
BuildRequires: libedit-devel
BuildRequires: libstdc++-devel
BuildRequires: libtool
BuildRequires: llvm-clang
BuildRequires: ncurses-devel
BuildRequires: ninja
BuildRequires: python-base
BuildRequires: python-xml
Requires: libLLVM = %{version}-%{release}
# llvm does not work on ppc or s390
ExcludeArch: ppc s390
@@ -113,11 +116,6 @@ new native programs that use the LLVM infrastructure.
%package clang
Summary: CLANG frontend for LLVM
Group: Development/Languages/Other
Requires: %{name} = %{version}
Requires: binutils
Requires: gcc
Requires: libclang = %{version}-%{release}
Requires: libstdc++-devel
Provides: clang
%description clang
@@ -157,25 +155,41 @@ Requires: python
%description -n python-clang
This package contains the Python bindings to clang (C language) frontend for LLVM.
%if %{build_lldb}
%package -n lldb
Summary: Next generation high-performance debugger
Group: Development/Languages
# We don't want to provide an unstable lldb-devel package now.
# Reconsider later when it has a stable API.
Provides: lldb-devel = %{version}
Obsoletes: lldb-devel < %{version}
%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.
%endif
%prep
%setup -q -a 1 -a 2 -a 3 -a 4 -a 5 -a 7 -b 6 -n %{name}-%{version}.src
%setup -q -a 1 -a 2 -a 3 -a 4 -a 5 -a 7 -a 8 -a 9 -b 6 -n %{name}-%{version}.src
%patch1
%patch2
%patch3
%patch4
%patch6
%patch7 -p1
%patch10
%patch11
%patch13 -p1
%patch15
%patch5
%patch6 -p1
%patch7
%patch8 -p1
%patch9
%if 0%{?suse_version} > 1320
%patch16
%patch10
%endif
# Move into right place
mv cfe-%{version}.src tools/clang
mv compiler-rt-%{version}.src projects/compiler-rt
mv clang-tools-extra-%{version}.src tools/clang/tools/extra
%if %{build_openmp}
mv openmp-%{version}.src projects/openmp
@@ -189,6 +203,10 @@ rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.
rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp
%endif
%if %{build_lldb}
mv lldb-%{version}.src tools/lldb
%endif
# We hardcode i586
rm tools/clang/test/Driver/x86_features.c
rm tools/clang/test/Driver/nacl-direct.c
@@ -196,51 +214,45 @@ rm tools/clang/test/Driver/nacl-direct.c
sed -i s,SVN_REVISION,\"%{_revision}\",g tools/clang/lib/Basic/Version.cpp
sed -i s,LLVM_REVISION,\"%{_revision}\",g tools/clang/lib/Basic/Version.cpp
%if %{build_lldb}
sed -i s,LLDB_REVISION,\"%{_revision}\",g tools/lldb/source/lldb.cpp
%endif
# ARMv6 needs this exact host triple
%ifarch armv6hl
cat > autoconf/config.guess << EOF
#!/bin/sh
echo armv6hl-suse-linux-gnueabi
EOF
%endif
%build
TOPLEVEL=$PWD
mkdir stage1 stage2
pushd stage1
# Define host-triple
%ifarch %{ix86}
%define host_triple i586-suse-linux
%endif
%ifarch x86_64
%define host_triple x86_64-suse-linux
%endif
%ifarch armv6hl
%define host_triple armv6hl-suse-linux-gnueabi
%endif
%ifarch armv7hl
%define host_triple armv7hl-suse-linux-gnueabi
%endif
%ifarch aarch64
%define host_triple aarch64-suse-linux
%endif
%ifarch ppc64
%define host_triple powerpc64-suse-linux
sed -i s,'${CMAKE_SYSTEM_PROCESSOR}','"PowerPC"',g ../cmake/modules/AddLLVM.cmake
%endif
%ifarch ppc64le
%define host_triple powerpc64le-suse-linux
sed -i s,'${CMAKE_SYSTEM_PROCESSOR}','"PowerPC"',g ../cmake/modules/AddLLVM.cmake
%endif
%ifarch s390x
%define host_triple s390x-suse-linux
sed -i s,'${CMAKE_SYSTEM_PROCESSOR}','"SystemZ"',g ../cmake/modules/AddLLVM.cmake
%endif
export CC=clang
export CXX=clang++
cmake -G "Ninja" \
-DBUILD_SHARED_LIBS=OFF \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_TARGETS_TO_BUILD=host \
-DCMAKE_C_FLAGS="-O0" \
-DCMAKE_CXX_FLAGS="-O0" \
-DLLVM_HOST_TRIPLE=%{host_triple} \
-DLLDB_DISABLE_PYTHON=ON \
%ifarch armv6hl
-DCMAKE_C_FLAGS="-target armv6hl-suse-linux-gnueabi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DCMAKE_CXX_FLAGS="-target armv6hl-suse-linux-gnueabi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DLLVM_DEFAULT_TARGET_TRIPLE=armv6-unknown-linux-gnueabihf \
%endif
%ifarch armv7hl
-DCMAKE_C_FLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16" \
-DCMAKE_CXX_FLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16" \
-DLLVM_DEFAULT_TARGET_TRIPLE=armv7l-unknown-linux-gnueabihf \
%endif
..
ninja %{?_smp_mflags} clang
ninja %{?_smp_mflags} clang -v
popd
pushd stage2
@@ -254,12 +266,11 @@ cmake -G "Ninja" \
-DCMAKE_BUILD_TYPE=Release \
%else
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_HOST_TRIPLE=%{host_triple} \
%endif
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
%ifarch armv6hl
-DCMAKE_C_FLAGS="-mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DCMAKE_CXX_FLAGS="-mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DCMAKE_C_FLAGS="-target armv6hl-suse-linux-gnueabi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DCMAKE_CXX_FLAGS="-target armv6hl-suse-linux-gnueabi -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DLLVM_DEFAULT_TARGET_TRIPLE=armv6-unknown-linux-gnueabihf \
%endif
%ifarch armv7hl
@@ -275,18 +286,17 @@ cmake -G "Ninja" \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_BINUTILS_INCDIR=/usr/include \
%if %{build_openmp}
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp \
%endif
%ifarch %{ix86} x86_64
-DLLVM_TARGETS_TO_BUILD="all" \
%else
-DLLVM_TARGETS_TO_BUILD=host \
%endif
-DLLVM_INCLUDE_TESTS=OFF \
%if %{build_lldb}
-DLLDB_DISABLE_PYTHON=ON \
%endif
..
ninja %{?_smp_mflags}
ninja %{?_smp_mflags} -v
%check
cd stage2
@@ -294,54 +304,11 @@ cd stage2
%if 0%{!?qemu_user_space_build:1}
# we just do not have enough memory with qemu emulation
# Rebuild to enable tests, if we enable
# at first time gtest junk ends up in installed
# cmake files
rm CMakeCache.txt
cmake -G "Ninja" \
-DBUILD_SHARED_LIBS=ON \
%ifarch %arm ppc64 ppc64le
-DCMAKE_BUILD_TYPE=Release \
%else
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DLLVM_HOST_TRIPLE=%{host_triple} \
%endif
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
%ifarch armv6hl
-DCMAKE_C_FLAGS="-mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DCMAKE_CXX_FLAGS="-mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" \
-DLLVM_DEFAULT_TARGET_TRIPLE=armv6-unknown-linux-gnueabihf \
%endif
%ifarch armv7hl
-DCMAKE_C_FLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16" \
-DCMAKE_CXX_FLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16" \
-DLLVM_DEFAULT_TARGET_TRIPLE=armv7l-unknown-linux-gnueabihf \
%endif
%if "%{_lib}" == "lib64"
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
-DLLVM_REQUIRES_RTTI=ON \
-DLLVM_ENABLE_TIMESTAMPS=OFF \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_BINUTILS_INCDIR=/usr/include \
%if %{build_openmp}
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp \
%endif
%ifarch %{ix86} x86_64
-DLLVM_TARGETS_TO_BUILD="all" \
%else
-DLLVM_TARGETS_TO_BUILD=host \
%endif
-DLLVM_INCLUDE_TESTS=ON \
-DLLVM_BUILD_TESTS=ON \
..
ninja %{?_smp_mflags}
ninja check
ninja clang-test
%if %{build_libcxx}
ninja check-libcxx
ninja check-libcxxabi
%endif
@@ -356,7 +323,7 @@ cd ..
# Build man/html pages
cd docs
# Docs are prebuilt due to sphinx dependency -- cartman
# Docs are prebuilt due to sphinx dependency
#make -f Makefile.sphinx html man
rm -rf %{buildroot}/usr/docs
@@ -371,28 +338,6 @@ cp -r _build/man/* %{buildroot}/usr/share/man/man1
cp -r _build/html/* %{buildroot}%{_docdir}/llvm-clang/html
cd ../../..
# install scan-build et al
install -d %{buildroot}%{_datadir}/clang
install -d %{buildroot}%{py_sitedir}
pushd tools/clang/tools
for file in scan-build/ccc-analyzer scan-build/scan-build \
scan-view/scan-view; do
install $file %{buildroot}%{_bindir}
done
for file in scan-build/scanview.css scan-build/sorttable.js; do
install -m 644 $file %{buildroot}%{_datadir}/clang/
done
for file in scan-view/Reporter.py scan-view/ScanView.py \
scan-view/startfile.py; do
install -m 644 $file %{buildroot}%{py_sitedir}
done
install -d %{buildroot}%{py_sitedir}/Resources/
for file in scan-view/Resources/*; do
install -m 644 $file %{buildroot}%{py_sitedir}/Resources/
done
popd
# install python bindings
install -d %{buildroot}%{py_sitedir}/clang
pushd tools/clang/bindings/python
@@ -402,50 +347,31 @@ cp -r examples %{buildroot}%{_docdir}/python-clang
install -d %{buildroot}%{_docdir}/python-clang/tests/cindex/INPUTS
cp -r tests %{buildroot}%{_docdir}/python-clang
popd
pushd %{buildroot}%{_bindir}
ln -s ccc-analyzer c++-analyzer
popd
mkdir -p %{buildroot}%{_libdir}/bfd-plugins
ln -s %{_libdir}/LLVMgold.so %{buildroot}%{_libdir}/bfd-plugins/
sed -i 's,RealBin/bin/clang,RealBin/clang,' \
%{buildroot}%{_bindir}/scan-build
sed -i 's,RealBin/bin/ccc-analyzer,RealBin/ccc-analyzer,' \
%{buildroot}%{_bindir}/scan-build
sed -i 's,RealBin/bin/ccc-analyzer,RealBin/ccc-analyzer,' \
%{buildroot}%{_bindir}/scan-build
sed -i 's,$RealBin/sorttable.js,%{_datadir}/clang/sorttable.js,' \
%{buildroot}%{_bindir}/scan-build
sed -i 's,$RealBin/scanview.css,%{_datadir}/clang/scanview.css,' \
%{buildroot}%{_bindir}/scan-build
sed -i 's,RealBin/bin,RealBin,' \
%{buildroot}%{_bindir}/scan-build
install -m 755 -d %{buildroot}%{_datadir}/vim/site/
for i in ftdetect ftplugin indent syntax; do
cp -r utils/vim/$i %{buildroot}%{_datadir}/vim/site/
done
mv utils/vim/README utils/vim/README.vim
mv %{buildroot}%{_prefix}/libexec/{c++,ccc}-analyzer %{buildroot}%{_bindir}
chmod -x %{buildroot}%{_mandir}/man1/scan-build.1
# Stuff we don't want to include
rm %{buildroot}%{_mandir}/man1/lit.1
%if %{build_openmp}
rm -f %{buildroot}%{_libdir}/libgomp.so
rm %{buildroot}%{_libdir}/libgomp.so
rm %{buildroot}%{_libdir}/libiomp*.so
%endif
%if %{build_libcxx}
# Create an libc++.so as an ldscript
rm %{buildroot}%{_libdir}/libc++.so
cat > %{buildroot}%{_libdir}/libc++.so <<EOF
GROUP ( %{_libdir}/libc++.so.1 %{_libdir}/libc++abi.so )
EOF
%if %{build_lldb}
rm %{buildroot}%{_libdir}/liblldb*.a
rm %{buildroot}%{_libdir}/liblldb.so
rm -r %{buildroot}%{_includedir}/lldb
%endif
%fdupes -s %{buildroot}%{_docdir}/%{name}
@@ -468,14 +394,14 @@ EOF
%{_bindir}/bugpoint
%{_bindir}/llc
%{_bindir}/lli
%{_bindir}/macho-dump
%exclude %{_bindir}/%{name}-config
%{_bindir}/%{name}*
%exclude %{_bindir}/llvm-config
%{_bindir}/llvm*
%{_bindir}/obj2yaml
%{_bindir}/opt
%{_bindir}/sancov
%{_bindir}/verify-uselistorder
%{_bindir}/yaml2obj
%exclude %{_mandir}/man1/%{name}-config.1%{ext_man}
%exclude %{_mandir}/man1/llvm-config.1%{ext_man}
%{_mandir}/man1/bugpoint.1%{ext_man}
%{_mandir}/man1/tblgen.1%{ext_man}
%{_mandir}/man1/llc.1%{ext_man}
@@ -490,25 +416,25 @@ EOF
%files clang
%defattr(-,root,root)
%{_bindir}/c-index-test
%{_bindir}/c++-analyzer
%{_bindir}/ccc-analyzer
%{_bindir}/clang
%{_bindir}/clang-*
%{_bindir}/clang++
%{_bindir}/clang-format
%{_bindir}/ccc-analyzer
%{_bindir}/c++-analyzer
%{_bindir}/git-clang-format
%{_bindir}/modularize
%{_bindir}/scan-build
%{_bindir}/scan-view
%{py_sitedir}/ScanView.py
%{py_sitedir}/Reporter.py
%{py_sitedir}/startfile.py
%{py_sitedir}/Resources
%{_datadir}/clang
%{_datadir}/scan-build
%{_datadir}/scan-view
%{_mandir}/man1/clang.1%{ext_man}
%{_mandir}/man1/scan-build.1%{ext_man}
%{_libdir}/libLTO.*
%if %{build_openmp}
%{_libdir}/libomp.so
%{_libdir}/libiomp5.so
%endif
%if %{build_libcxx}
%{_libdir}/libc++*
@@ -534,16 +460,16 @@ EOF
%files devel
%defattr(-,root,root,-)
%{_bindir}/%{name}-config
%{_bindir}/llvm-config
%{_libdir}/libLLVM*.so
%{_libdir}/BugpointPasses.*
%{_libdir}/LLVMHello.*
%doc %{_mandir}/man1/%{name}-config.1%{ext_man}
%{_includedir}/%{name}/
%{_includedir}/%{name}-c/
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/cmake/
%doc %{_docdir}/%{name}
%doc %{_mandir}/man1/llvm-config.1%{ext_man}
%{_includedir}/llvm/
%{_includedir}/llvm-c/
%dir %{_datadir}/llvm
%{_datadir}/llvm/cmake/
%doc %{_docdir}/llvm
%files vim-plugins
%defattr(-,root,root,-)
@@ -556,7 +482,13 @@ EOF
%{py_sitedir}/clang/__init__.py
%{py_sitedir}/clang/cindex.py
%{py_sitedir}/clang/enumerations.py
%doc %{_docdir}/python-clang
%if %{build_lldb}
%files -n lldb
%defattr(-,root,root,-)
%{_libdir}/liblldb.so.*
%{_bindir}/lldb*
%endif
%changelog