SHA256
1
0
forked from pool/llvm

Accepting request 178917 from home:tobijk:X11:XOrg

Review SR for llvm with cmake:
Please note:
1) Tests are commented out: Bug 15242
2) ARM Build failures due to incomplete build script (patches are fixed now)

-> But it at least builds Mesa with radeonsi driver enabled

OBS-URL: https://build.opensuse.org/request/show/178917
OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/llvm?expand=0&rev=221
This commit is contained in:
Ismail Dönmez 2013-06-14 14:24:42 +00:00 committed by Git OBS Bridge
parent c7a12a733a
commit 5385c8b9d0
3 changed files with 89 additions and 121 deletions

View File

@ -1,6 +1,6 @@
--- llvm/tools/clang/lib/Driver/ToolChains.cpp.orig 2012-11-22 10:26:49.202107824 +0100
+++ llvm/tools/clang/lib/Driver/ToolChains.cpp 2012-11-22 12:20:33.662825882 +0100
@@ -1056,10 +1056,12 @@ Generic_GCC::GCCInstallationDetector::GC
--- /tools/clang/lib/Driver/ToolChains.cpp.orig 2012-11-22 10:26:49.202107824 +0100
+++ /tools/clang/lib/Driver/ToolChains.cpp 2012-11-22 12:20:33.662825882 +0100
@@ -1082,11 +1082,13 @@ Generic_GCC::GCCInstallationDetector::GC
static const char *const ARMLibDirs[] = { "/lib" };
static const char *const ARMTriples[] = {
"arm-linux-gnueabi",
@ -10,6 +10,7 @@
static const char *const ARMHFTriples[] = {
"arm-linux-gnueabihf",
+ "armv7hl-suse-linux-gnueabi"
"armv7hl-redhat-linux-gnueabi"
};
static const char *const X86_64LibDirs[] = { "/lib64", "/lib" };

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Jun 13 18:33:31 UTC 2013 - tobias.johannes.klausmann@mni.thm.de
- Initial version of a cmake based buildscript
+ Updated arm_suse_support.diff (patch6) to work with llvm 3.3
+ Set version in spec to 3.3
-------------------------------------------------------------------
Thu Jun 13 11:42:33 UTC 2013 - idonmez@suse.com

196
llvm.spec
View File

@ -18,10 +18,11 @@
%define _revision 183898
%define _release_version 3.3
%define _supported_archs "arm,aarch64,powerpc,x86"
%define _supported_archs "AArch64;ARM;PowerPC;X86"
%define _experimental_archs "R600"
Name: llvm
Version: 3.2.91
Version: 3.3
Release: 0
Summary: Low Level Virtual Machine
License: NCSA
@ -47,6 +48,9 @@ Patch8: unreachable-code.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: cmake
%if 0%{?suse_version} >= 1220
BuildRequires: binutils-devel >= 2.21.90
%endif
@ -145,19 +149,10 @@ This package contains vim plugins for LLVM like syntax highlighting.
# We hardcode i586
rm tools/clang/test/Driver/x86_features.c
# lib64 related problems on 64bit
%if "%{_lib}" == "lib64"
rm tools/clang/test/Driver/linux-ld.c
%endif
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
# Nasty hardcoded path
sed -i s,/lib/,/%{_lib}/,g tools/clang/lib/Driver/Tools.cpp tools/clang/test/Preprocessor/iwithprefix.c
# Only enable target archs otherwise llvm-config is messed up
sed -i s,"subdirectories = .*","subdirectories = AArch64 ARM PowerPC X86", lib/Target/LLVMBuild.txt
sed -i s,"IntelJITEvents OProfileJIT","", lib/ExecutionEngine/LLVMBuild.txt
echo > utils/unittest/LLVMBuild.txt
@ -167,98 +162,62 @@ TOPLEVEL=$PWD
export SUSE_ASNEEDED=0
mkdir stage1 stage2
pushd stage1
mkdir Release
# autotools ignore --libdir
ln -s lib Release/lib64
../configure \
--enable-optimized \
--disable-assertions \
--with-optimize-option="-O0" \
cmake -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE="Release" \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_PIC=ON \
%ifarch %arm
--disable-sjlj-exceptions \
--disable-werror --enable-checking=release \
%ifarch armv5el armv5tel
--with-arch=armv5te --with-float=soft --with-mode=arm \
--build=armv5tel-suse-linux-gnueabi --host=armv5tel-suse-linux-gnueabi --target=armv5tel-suse-linux-gnueabi \
%endif
%ifarch armv7l armv7hl
--with-arch=armv7-a \
--with-tune=cortex-a9 \
--with-float=hard \
--with-fpu=vfpv3-d16 \
--with-abi=aapcs-vfp \
--build=armv7hl-suse-linux-gnueabi --host=armv7hl-suse-linux-gnueabi --target=armv7hl-suse-linux-gnueabi \
%if 0%{?suse_version} >= 1220
--with-mode=thumb \
%else
--with-mode=arm \
%endif
%endif
%endif
--enable-targets=host
make %{?_smp_mflags} clang-only
%endif
-DLLVM_TARGETS_TO_BUILD=ARM \
%else
-DCMAKE_C_FLAGS="-O0" \
-DCMAKE_CXX_FLAGS="-O0" \
-DLLVM_TARGETS_TO_BUILD=%{_supported_archs} \
%endif
-DLLVM_TARGET_ARCH=host \
../
make %{?_smp_mflags} clang
popd
pushd stage2
# autotools ignore --libdir
%ifnarch ppc64
mkdir Release+Debug
ln -s lib Release+Debug/lib64
%else
mkdir Release
ln -s lib Release/lib64
%endif
export CC=$TOPLEVEL/stage1/Release/bin/clang
export CXX=$TOPLEVEL/stage1/Release/bin/clang++
export CC=$TOPLEVEL/stage1/bin/clang
export CXX=$TOPLEVEL/stage1/bin/clang++
cmake -G "Unix Makefiles" \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_PREFIX=%{_prefix} \
%ifarch armv7l armv7hl
# This fixes the armv7 build. (Allow to run stage2 without problem)
export CFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
export CXXFLAGS="-mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16"
-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" \
%endif
../configure \
--prefix=%{_prefix} \
--enable-optimized \
--disable-assertions \
--enable-pic \
--disable-timestamps \
%ifarch x86_64
-DLLVM_LIBDIR_SUFFIX=64 \
%endif
-DLLVM_REQUIRES_RTTI=ON \
-DLLVM_ENABLE_TIMESTAMPS=OFF \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_ENABLE_PIC=ON \
%if 0%{?suse_version} >= 1220
--with-binutils-include=/usr/include \
-DLLVM_BINUTILS_INCDIR=/usr/include \
%endif
%ifarch %arm
--with-optimize-option="-U_GLIBCXX_ATOMIC_BUILTINS" \
--disable-sjlj-exceptions \
--disable-werror --enable-checking=release \
%ifarch armv5el armv5tel
--with-arch=armv5te --with-float=soft --with-mode=arm \
%endif
%ifarch armv7l armv7hl
--with-arch=armv7-a \
--with-tune=cortex-a9 \
--with-float=hard \
--with-fpu=vfpv3-d16 \
--with-abi=aapcs-vfp \
%if 0%{?suse_version} >= 1220
--with-mode=thumb \
-DLLVM_TARGETS_TO_BUILD=ARM \
%else
--with-mode=arm \
-DLLVM_TARGETS_TO_BUILD=%{_supported_archs} \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{_experimental_archs} \
%endif
%endif
--enable-targets=arm \
%else
--enable-targets=%{_supported_archs} \
%endif
%ifnarch ppc64
--enable-debug-symbols \
--enable-debug-runtime \
%endif
--with-clang-resource-dir="../%{_lib}/clang/%{_release_version}"
-DLLVM_BUILD_TESTS=ON \
../
make %{?_smp_mflags} REQUIRES_RTTI=1
@ -266,29 +225,27 @@ make %{?_smp_mflags} REQUIRES_RTTI=1
cd stage2
%if 0%{!?qemu_user_space_build:1}
# we just do not have enough memory with qemu emulation
make check
# Disable this check for now - http://llvm.org/bugs/show_bug.cgi?id=15242
#make check
cd tools/clang
make test
%endif
%install
cd stage2
%makeinstall
make install DESTDIR=%{buildroot}
cd ..
# Fixup libdir
%if "%{_lib}" == "lib64"
mv %{buildroot}%{_prefix}/lib %{buildroot}%{_prefix}/lib64
%endif
# Build man/html pages
cd docs
# Docs are prebuilt due to sphinx dependency -- cartman
#make -f Makefile.sphinx html man
rm -rf %{buildroot}/usr/docs
mkdir -p %{buildroot}%{_docdir}/llvm
cp -r _build/man/* %{buildroot}/usr/share/man/man1
cp -r _build/html/* %{buildroot}%{_docdir}/llvm/
#cp -r _build/man/* %{buildroot}/usr/share/man/man1
#cp -r _build/html/* %{buildroot}%{_docdir}/llvm/
cd ../tools/clang/docs
mkdir -p %{buildroot}%{_docdir}/llvm-clang/html
@ -297,12 +254,6 @@ cp *.css *.png *.html %{buildroot}%{_docdir}/llvm-clang/html
cp -r analyzer %{buildroot}%{_docdir}/llvm-clang
cd ../../..
# cleanup
file %{buildroot}/%{_bindir}/* | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
file %{buildroot}/%{_libdir}/%{name}/*.so | awk -F: '$2~/ELF/{print $1}' | xargs -r chrpath -d
find %{buildroot}%{_includedir}/clang -name '*.tmp' -exec rm {} +
chmod -x %{buildroot}/%{_libdir}/*.a
# install scan-build et al
install -d %{buildroot}%{_datadir}/clang
install -d %{buildroot}%{py_sitedir}
@ -356,10 +307,12 @@ install -m 644 utils/vim/*.vim %{buildroot}%{_datadir}/vim/site/syntax/
mv utils/vim/README utils/vim/README.vim
# Stuff we don't want to include
rm %{buildroot}%{_libdir}/libclang.a
rm %{buildroot}%{_libdir}/BugpointPasses.*
rm %{buildroot}%{_libdir}/LLVMHello.*
# Remove cmake files
rm -rf %{buildroot}/usr/share/llvm/cmake
%fdupes -s %{buildroot}%{_docdir}/%{name}
%fdupes -s %{buildroot}%{_docdir}/%{name}-doc
@ -380,15 +333,16 @@ rm %{buildroot}%{_libdir}/LLVMHello.*
%exclude %{_bindir}/%{name}-config
%{_bindir}/%{name}*
%{_bindir}/opt
%{_mandir}/man1/bugpoint.1%{ext_man}
%exclude %{_mandir}/man1/lit.1%{ext_man}
%{_mandir}/man1/tblgen.1%{ext_man}
%{_mandir}/man1/llc.1%{ext_man}
%{_mandir}/man1/lli.1%{ext_man}
%exclude %{_mandir}/man1/%{name}-config.1%{ext_man}
%{_mandir}/man1/llvm*.1%{ext_man}
%{_mandir}/man1/FileCheck.1%{ext_man}
%{_mandir}/man1/opt.1%{ext_man}
#%{_mandir}/man1/bugpoint.1%{ext_man}
#%exclude %{_mandir}/man1/lit.1%{ext_man}
#%{_mandir}/man1/tblgen.1%{ext_man}
#%{_mandir}/man1/llc.1%{ext_man}
#%{_mandir}/man1/lli.1%{ext_man}
#%exclude %{_mandir}/man1/%{name}-config.1%{ext_man}
#%{_mandir}/man1/llvm*.1%{ext_man}
#%{_mandir}/man1/FileCheck.1%{ext_man}
#%{_mandir}/man1/opt.1%{ext_man}
%files clang
%defattr(-,root,root)
@ -396,7 +350,7 @@ rm %{buildroot}%{_libdir}/LLVMHello.*
%{_bindir}/clang-*
%{_bindir}/clang++
%{_bindir}/clang-format
%{_bindir}/c-index-test
#%{_bindir}/c-index-test
%{_bindir}/ccc-analyzer
%{_bindir}/c++-analyzer
%{_bindir}/scan-build
@ -406,10 +360,17 @@ rm %{buildroot}%{_libdir}/LLVMHello.*
%{py_sitedir}/startfile.py
%{py_sitedir}/Resources
%{_datadir}/clang
%{_mandir}/man1/clang.1.gz
%exclude %{_libdir}/clang/3.3/lib/linux/libclang*.a
#%{_mandir}/man1/clang.1.gz
#%exclude %{_libdir}/libclang.so
%{_libdir}/libclang.so
%{_libdir}/libclang.so*
%{_libdir}/libclang*.so
%{_libdir}/libgtest*.so
%{_libdir}/libLTO.so
%{_libdir}/*profile*.a
%if 0%{?suse_version} >= 1220
%{_libdir}/LLVMgold.so
%{_libdir}/bfd-plugins/
@ -420,23 +381,22 @@ rm %{buildroot}%{_libdir}/LLVMHello.*
%defattr(-,root,root)
%{_includedir}/clang
%{_includedir}/clang-c
%{_libdir}/libLTO.a
%{_libdir}/libclang*.a
%{_libdir}/clang/3.3/lib/linux/libclang*.a
%{_libdir}/*profile*.so
%doc %{_docdir}/llvm-clang
%files devel
%defattr(-,root,root,-)
%{_bindir}/%{name}-config
%doc %{_mandir}/man1/%{name}-config.1%{ext_man}
#%doc %{_mandir}/man1/%{name}-config.1%{ext_man}
%{_includedir}/%{name}/
%{_includedir}/%{name}-c/
%{_libdir}/libLLVM*
%doc %{_docdir}/%{name}
#%doc %{_docdir}/%{name}
%files vim-plugins
%defattr(-,root,root,-)
%doc utils/vim/README.vim
#%doc utils/vim/README.vim
%{_datadir}/vim/
%changelog