# # spec file for package llvm # # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed # upon. The license for this file, and modifications and additions to the # file, is the same license as for the pristine package itself (unless the # license for the pristine package is not an Open Source License, in which # case the license is the MIT License). An "Open Source License" is a # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ # %define _revision 230777 %define _release_version 3.6.0 %define build_libcxx 0 %ifarch x86_64 %define build_libcxx 1 %endif Name: llvm Version: 3.6.0 Release: 0 Summary: Low Level Virtual Machine License: NCSA Group: Development/Languages/Other Url: http://www.llvm.org Source0: http://llvm.org/releases/%{version}/llvm-%{version}.src.tar.xz Source1: http://llvm.org/releases/%{version}/cfe-%{version}.src.tar.xz Source2: http://llvm.org/releases/%{version}/compiler-rt-%{version}.src.tar.xz Source3: http://llvm.org/releases/%{version}/libcxx-%{version}.src.tar.xz Source4: http://llvm.org/releases/%{version}/libcxxabi-%{version}.src.tar.xz # Manually created docs # cd docs # make -f Makefile.sphinx man html # cd .. # tar cvJf llvm-docs-3.6.0.src.tar.xz llvm-3.6.0.src/docs/_build/{man,html} Source5: llvm-docs-%{version}.src.tar.xz Source6: cfe-docs-%{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 # PATCH-FIX-OPENSUSE arm_suse_support.diff --Enable ARM suse toolchain support Patch6: arm_suse_support.diff Patch7: cmake-host-triple.patch # PATCH-FIX-OPENSUSE aarch64-suse-support.patch -- Enable AArch64 suse toolchain support Patch8: aarch64-suse-support.patch Patch10: clang-resourcedirs.patch Patch11: libcxxabi-exceptions.patch Patch13: llvm-remove-clang-only-flags.patch Patch15: llvm-fix-find-gcc5-install.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: binutils-devel >= 2.21.90 BuildRequires: bison BuildRequires: cmake BuildRequires: fdupes BuildRequires: flex BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: groff BuildRequires: libffi-devel BuildRequires: libtool BuildRequires: ncurses-devel BuildRequires: ninja BuildRequires: python-base BuildRequires: python-xml Requires: libLLVM = %{version}-%{release} # llvm does not work on ppc, only ppc64 ExcludeArch: ppc %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 functionality. %package -n libLLVM Summary: Libraries for LLVM Group: Development/Libraries/C and C++ %description -n libLLVM This package contains the shared libraries needed for LLVM. %package devel Summary: Header Files for LLVM Group: Development/Languages/Other Requires: %{name} = %{version} %description devel This package contains library and header files needed to develop 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 This package contains the clang (C language) frontend for LLVM. %package -n libclang Summary: Library files needed for clang Group: Development/Libraries/C and C++ %description -n libclang This package contains the shared libraries needed for clang. %package clang-devel Summary: CLANG frontend for LLVM (devel package) Group: Development/Languages/Other Requires: llvm-clang = %{version} Requires: llvm-devel = %{version} %description clang-devel This package contains the clang (C language) frontend for LLVM. (development files) %package vim-plugins Summary: Vim plugins for LLVM Group: Productivity/Text/Editors Requires: vim %description vim-plugins This package contains vim plugins for LLVM like syntax highlighting. %package -n python-clang Summary: Python bindings for libclang Group: Development/Languages/Python Requires: libclang = %{version} Requires: python %description -n python-clang This package contains the Python bindings to clang (C language) frontend for LLVM. %prep %setup -q -a 1 -a 2 -a 3 -a 4 -a 6 -b 5 -n %{name}-%{version}.src %patch1 %patch2 %patch3 %patch4 %patch6 %patch7 -p1 %patch8 %patch10 %patch11 %patch13 -p1 %patch15 # Move into right place mv cfe-%{version}.src tools/clang mv compiler-rt-%{version}.src projects/compiler-rt %if %{build_libcxx} mv libcxx-%{version}.src projects/libcxx mv libcxxabi-%{version}.src projects/libcxxabi %endif # We hardcode i586 rm tools/clang/test/Driver/x86_features.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 %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 390x %define host_triple s390x-suse-linux sed -i s,'${CMAKE_SYSTEM_PROCESSOR}','"SystemZ"',g ../cmake/modules/AddLLVM.cmake %endif cmake -G "Ninja" \ -DBUILD_SHARED_LIBS=OFF \ -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} \ .. ninja %{?_smp_mflags} clang 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 \ -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 \ %ifarch %{ix86} x86_64 -DLLVM_TARGETS_TO_BUILD="host;R600" \ %else -DLLVM_TARGETS_TO_BUILD=host \ %endif -DLLVM_INCLUDE_TESTS=OFF \ .. ninja %{?_smp_mflags} %check cd stage2 %ifnarch armv7hl armv7l %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 \ %ifarch %{ix86} x86_64 -DLLVM_TARGETS_TO_BUILD="host;R600" \ %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} # Uncomment when llvm 3.6 hits #ninja check-libcxx ninja check-libcxxabi %endif %endif %endif %install cd stage2 DESTDIR=%{buildroot} ninja install cd .. # 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/html mkdir -p %{buildroot}/usr/share/man/man1 cp -r _build/man/* %{buildroot}/usr/share/man/man1 cp -r _build/html/* %{buildroot}%{_docdir}/llvm/html cd ../tools/clang/docs mkdir -p %{buildroot}%{_docdir}/llvm-clang/html 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 cp clang/*.py %{buildroot}%{py_sitedir}/clang install -d %{buildroot}%{_docdir}/python-clang/examples/cindex 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/syntax/ 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}%{_mandir}/man1/lit.1 %if %{build_libcxx} # Create an libc++.so as an ldscript rm %{buildroot}%{_libdir}/libc++.so cat > %{buildroot}%{_libdir}/libc++.so <