SHA256
1
0
forked from pool/llvm

Accepting request 424333 from home:scarabeus_iv:branches:devel:tools:compiler

- Convert to use %cmake macros

- Start conversion to use cmake macros with now introduced
  compatibility for ninja
- Reduce number of threads if we don't have enough memory
- Add patch for the nonvoid returns:
  * llvm-nonvoid-return.patch

OBS-URL: https://build.opensuse.org/request/show/424333
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm?expand=0&rev=466
This commit is contained in:
Ismail Dönmez 2016-09-02 07:08:38 +00:00 committed by Git OBS Bridge
parent b4b09af30a
commit dc80bb7862
5 changed files with 110 additions and 82 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Aug 31 10:24:31 UTC 2016 - tchvatal@suse.com
- Convert to use %cmake macros
-------------------------------------------------------------------
Thu Aug 25 16:42:02 UTC 2016 - ronisbr@gmail.com

View File

@ -82,30 +82,23 @@ This package contains the development files for LLDB.
sed -i s,LLDB_REVISION,\"%{_revision}\",g source/lldb.cpp #"
%build
mkdir build
pushd build
cmake -DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DBUILD_SHARED_LIBS=OFF \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
-DCMAKE_BUILD_TYPE=Release \
%if "%{_lib}" == "lib64"
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
-DLLVM_RUNTIME_OUTPUT_INTDIR=$PWD/bin \
-DLLVM_LIBRARY_OUTPUT_INTDIR=$PWD/%{_lib} \
-DPYTHON_VERSION_MAJOR=%{py_major} \
-DPYTHON_VERSION_MINOR=%{py_minor} \
-G "Ninja" \
..
ninja
%define __builder ninja
%cmake \
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DBUILD_SHARED_LIBS=OFF \
%if "%{_lib}" == "lib64"
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
-DLLVM_RUNTIME_OUTPUT_INTDIR=$PWD/bin \
-DLLVM_LIBRARY_OUTPUT_INTDIR=$PWD/%{_lib} \
-DPYTHON_VERSION_MAJOR=%{py_major} \
-DPYTHON_VERSION_MINOR=%{py_minor}
%make_jobs
%install
pushd build
DESTDIR=%{buildroot} ninja install
%cmake_install
# Python: fix binary libraries location.
rm %{buildroot}%{py_sitedir}/lldb/_lldb.so

13
llvm-nonvoid-return.patch Normal file
View File

@ -0,0 +1,13 @@
Index: llvm-3.8.0.src/openmp-3.8.0.src/runtime/src/kmp_dispatch.cpp
===================================================================
--- llvm-3.8.0.src.orig/openmp-3.8.0.src/runtime/src/kmp_dispatch.cpp
+++ llvm-3.8.0.src/openmp-3.8.0.src/runtime/src/kmp_dispatch.cpp
@@ -254,7 +254,7 @@ test_then_inc< kmp_int64 >( volatile kmp
// compare_and_swap template (general template should NOT be used)
template< typename T >
static __forceinline kmp_int32
-compare_and_swap( volatile T *p, T c, T s ) { KMP_ASSERT(0); };
+compare_and_swap( volatile T *p, T c, T s );
template<>
__forceinline kmp_int32

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Aug 26 10:03:56 UTC 2016 - tchvatal@suse.com
- Start conversion to use cmake macros with now introduced
compatibility for ninja
- Reduce number of threads if we don't have enough memory
- Add patch for the nonvoid returns:
* llvm-nonvoid-return.patch
-------------------------------------------------------------------
Thu Jul 28 09:59:01 UTC 2016 - normand@linux.vnet.ibm.com

128
llvm.spec
View File

@ -77,6 +77,7 @@ Patch8: revert-cmake-soname.patch
Patch9: lldb-cmake.patch
Patch10: glibc-2.23-libcxx.patch
Patch11: glibc-2.24-libcxx.patch
Patch12: llvm-nonvoid-return.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: binutils-devel >= 2.21.90
BuildRequires: bison
@ -91,6 +92,7 @@ BuildRequires: libstdc++-devel
BuildRequires: libtool
BuildRequires: ncurses-devel
BuildRequires: ninja
BuildRequires: procps
BuildRequires: python-base
BuildRequires: python-xml
# llvm does not work on ppc or s390
@ -193,6 +195,7 @@ disassembler.
%patch10
%patch11
%endif
%patch12 -p1
# Move into right place
mv cfe-%{version}.src tools/clang
@ -235,88 +238,93 @@ EOF
%endif
%build
TOPLEVEL=$PWD
mkdir stage1 stage2
pushd stage1
export CC=gcc
export CXX=g++
cmake -G "Ninja" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=Release \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLDB_DISABLE_PYTHON=ON \
..
ninja %{?_smp_mflags} clang -v
popd
pushd stage2
export CC=$TOPLEVEL/stage1/bin/clang
export CXX=$TOPLEVEL/stage1/bin/clang++
cmake -G "Ninja" \
-DBUILD_SHARED_LIBS=ON \
%ifarch %arm ppc64 ppc64le
-DCMAKE_BUILD_TYPE=Release \
%else
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
%endif
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
# Disable c/xx/flags as the clang fails to build with hardening right now
#flags="%{optflags} -fno-strict-aliasing"
flags="-fno-strict-aliasing"
%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" \
flags+=" -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp"
%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" \
flags+=" -mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
%endif
# do not eat all memory
ninjaproc="%{?jobs:%{jobs}}"
echo "Available memory:"
free
echo "System limits:"
ulimit -a
if test -n "$ninjaproc" -a "$ninjaproc" -gt 1 ; then
mem_per_process=1000
max_mem=`LANG=C free -t -m | sed -n "s|^Mem: *\([0-9]*\).*$|\1|p"`
max_jobs="$(($max_mem / $mem_per_process))"
test "$ninjaproc" -gt "$max_jobs" && ninjaproc="$max_jobs" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits"
test "$ninjaproc" -le 0 && ninjaproc=1 && echo "Warning: Do not use the parallel build at all becuse of memory limits"
fi
%define __builder ninja
%define __builddir stage1
# -z,now is breaking now, it needs to be fixed
%cmake \
-DCMAKE_C_FLAGS="$flags" \
-DCMAKE_CXX_FLAGS="$flags" \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLDB_DISABLE_PYTHON=ON \
-DCMAKE_SKIP_RPATH:BOOL=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed"
ninja -v -j $ninjaproc
cd ..
%define __builddir build
export CC=${PWD}/stage1/bin/clang
export CXX=${PWD}/stage1/bin/clang++
# -z,now is breaking now, it needs to be fixed
%cmake \
-DCMAKE_C_FLAGS="$flags" \
-DCMAKE_CXX_FLAGS="$flags" \
-DLLVM_REQUIRES_RTTI=ON \
-DLLVM_ENABLE_TIMESTAMPS=OFF \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_PIC=ON \
-DLLVM_BINUTILS_INCDIR=/usr/include \
%ifarch %{ix86} x86_64
-DLLVM_TARGETS_TO_BUILD="all" \
%else
-DLLVM_TARGETS_TO_BUILD=host \
%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 \
%ifarch %{ix86} x86_64
-DLLVM_TARGETS_TO_BUILD="all" \
%else
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
%if %{build_lldb}
-DLLDB_DISABLE_PYTHON=ON \
-DLLDB_DISABLE_PYTHON=ON \
%endif
..
ninja %{?_smp_mflags} -v
-DCMAKE_SKIP_RPATH:BOOL=OFF \
-DCMAKE_EXE_LINKER_FLAGS="-Wl,--as-needed" \
-DCMAKE_MODULE_LINKER_FLAGS="-Wl,--as-needed" \
-DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed"
ninja -v -j $ninjaproc
%check
cd stage2
cd build
%ifnarch armv7hl armv7l
%if 0%{!?qemu_user_space_build:1}
# we just do not have enough memory with qemu emulation
ninja check
ninja clang-test
ninja -v %{?_smp_mflags} check
ninja -v %{?_smp_mflags} clang-test
%if %{build_libcxx}
ninja check-libcxx
ninja check-libcxxabi
ninja -v %{?_smp_mflags} check-libcxx
ninja -v %{?_smp_mflags} check-libcxxabi
%endif
%endif
%endif
%install
cd stage2
DESTDIR=%{buildroot} ninja install
cd ..
%cmake_install
# Build man/html pages
cd docs
# Docs are prebuilt due to sphinx dependency