# # spec file for package llvm # # Copyright (c) 2016 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/ # # Change this to 0 if this is not the latest version of LLVM %define _latest 1 %bcond_with ffi %bcond_with oprofile %bcond_with valgrind %if !0%{?is_opensuse} || !0%{_latest} %bcond_with libcxx %bcond_with openmp %else %ifarch x86_64 %bcond_without libcxx %else %bcond_with libcxx %endif %ifarch ppc64 ppc64le %{ix86} x86_64 %bcond_without openmp %else %bcond_with openmp %endif %endif Name: llvm Version: 3.8.1 Release: 0 %define _relver 3.8.1 %define _minor 3.8 %define _sonum 3_8 %define _socxx 1 %define _revsn 273405 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}/clang-tools-extra-%{version}.src.tar.xz Source3: http://llvm.org/releases/%{version}/compiler-rt-%{version}.src.tar.xz Source4: http://llvm.org/releases/%{version}/libcxx-%{version}.src.tar.xz Source5: http://llvm.org/releases/%{version}/libcxxabi-%{version}.src.tar.xz Source6: http://llvm.org/releases/%{version}/openmp-%{version}.src.tar.xz # Docs are created manually, see below Source50: llvm-docs-%{version}.src.tar.xz Source51: 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 default-to-i586.patch -- Use i586 as default target for 32bit Patch3: default-to-i586.patch # PATCH-FIX-OPENSUSE arm_suse_support.diff --Enable ARM suse toolchain support 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: llvm-nonvoid-return.patch Patch20: glibc-2.23-libcxx.patch Patch21: glibc-2.24-libcxx.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: libstdc++-devel BuildRequires: libtool BuildRequires: ncurses-devel BuildRequires: ninja BuildRequires: procps BuildRequires: python-base BuildRequires: python-xml BuildRequires: pkgconfig(libedit) %if %{with ffi} BuildRequires: pkgconfig(libffi) %endif %if %{with valgrind} BuildRequires: pkgconfig(valgrind) %endif %if %{with oprofile} BuildRequires: oprofile-devel %endif # Avoid multiple provider errors Requires: libLLVM%{_sonum} # llvm does not work on ppc or s390 ExcludeArch: ppc s390 %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%{_sonum} Summary: Libraries for LLVM Group: Development/Libraries/C and C++ %description -n libLLVM%{_sonum} This package contains the shared libraries needed for LLVM. %package devel Summary: Header Files for LLVM Group: Development/Languages/Other Conflicts: otherproviders(cmake(LLVM)) Requires: %{name} = %{version} Requires: binutils-devel >= 2.21.90 Requires: bison Requires: flex Requires: groff Requires: libstdc++-devel Requires: libtool Requires: ncurses-devel Requires: pkgconfig(libedit) %if %{with ffi} Requires: pkgconfig(libffi) %endif %if %{with valgrind} Requires: pkgconfig(valgrind) %endif %if %{with oprofile} Requires: oprofile-devel %endif %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 Recommends: scan-build Recommends: scan-view Recommends: LLVMgold.so()(64bit) %if %{with openmp} && %{_latest} Recommends: libomp %endif # Avoid multiple provider errors Requires: libLTO%{_sonum} Requires: libc++%{_socxx} Requires: libclang%{_sonum} %description clang This package contains the clang (C language) frontend for LLVM. %package clang-checker Summary: Static code analyzer for CLANG Group: Development/Languages/Other Provides: scan-build Provides: scan-view Conflicts: otherproviders(scan-build) Conflicts: otherproviders(scan-view) # Avoid multiple provider errors Requires: libclang%{_sonum} %description clang-checker This package contains scan-build and scan-view, command line static code analyzers for CLANG. %package -n libclang%{_sonum} Summary: Library files needed for clang Group: Development/Libraries/C and C++ Requires: libstdc++-devel # Avoid multiple provider errors Requires: libLLVM%{_sonum} %description -n libclang%{_sonum} This package contains the shared libraries needed for clang. %package clang-devel Summary: CLANG frontend for LLVM (devel package) Group: Development/Languages/Other Conflicts: otherproviders(cmake(Clang)) Requires: llvm-clang = %{version} Requires: cmake(LLVM) = %{version} %description clang-devel This package contains the clang (C language) frontend for LLVM. (development files) %package -n libLTO%{_sonum} Summary: Link-time optimizer for LLVM Group: Development/Languages/Other # Avoid multiple provider errors Requires: libLLVM%{_sonum} %description -n libLTO%{_sonum} This package contains the link-time optimizer for LLVM. %package LTO-devel Summary: Link-time optimizer for LLVM (devel package) Group: Development/Languages/Other Provides: libLTO.so Conflicts: otherproviders(libLTO.so) Requires: cmake(LLVM) = %{version} # Avoid multiple provider errors Requires: libLTO%{_sonum} %description LTO-devel This package contains the link-time optimizer for LLVM. (development files) %package gold Summary: Gold linker plugin for LLVM Group: Development/Languages/Other Provides: LLVMgold.so()(64bit) Conflicts: otherproviders(LLVMgold.so()(64bit)) # Avoid multiple provider errors Requires: libLLVM%{_sonum} Requires: cmake(LLVM) = %{version} %description gold This package contains the Gold linker plugin for LLVM. %package -n libomp Summary: MPI plugin for LLVM Group: Development/Languages/Other Provides: libomp.so()(64bit) Conflicts: otherproviders(libomp.so()(64bit)) # Avoid multiple provider errors Requires: libLLVM%{_sonum} %description -n libomp This package contains the OpenMP MPI plugin for LLVM. %package -n libc++%{_socxx} Summary: C++ standard library implementation Group: Development/Libraries/C and C++ %description -n libc++%{_socxx} This package contains libc++, a new implementation of the C++ standard library, targeting C++11. %package libc++-devel Summary: C++ standard library implementation (devel package) Group: Development/Languages/C and C++ Provides: libc++.so Conflicts: otherproviders(libc++.so) %description libc++-devel This package contains libc++, a new implementation of the C++ standard library, targeting C++11. (development files) %package -n libc++abi%{_socxx} Summary: C++ standard library ABI Group: Development/Libraries/C and C++ %description -n libc++abi%{_socxx} This package contains the ABI for libc++, a new implementation of the C++ standard library, targeting C++11. %package libc++abi-devel Summary: C++ standard library ABI (devel package) Group: Development/Languages/C and C++ Provides: libc++abi.so Conflicts: otherproviders(libc++abi.so) # Avoid multiple provider errors Requires: %{name}-libc++-devel %description libc++abi-devel This package contains the ABI for libc++, a new implementation of the C++ standard library, targeting C++11. (development files) %package vim-plugins Summary: Vim plugins for LLVM Group: Productivity/Text/Editors Provides: vim-plugin-llvm Conflicts: otherproviders(vim-plugin-llvm) Requires: vim BuildArch: noarch %description vim-plugins This package contains vim plugins for LLVM like syntax highlighting. %package emacs-plugins Summary: Emacs plugins for LLVM Group: Productivity/Text/Editors Provides: emacs-llvm Conflicts: otherproviders(emacs-llvm) Requires: emacs BuildArch: noarch %description emacs-plugins This package contains Emacs plugins for LLVM like syntax highlighting. %package -n python-clang Summary: Python 2 bindings for libclang Group: Development/Languages/Python Requires: %{name}-clang-devel = %{version} Requires: python BuildArch: noarch %description -n python-clang This package contains the Python 2.x bindings to clang (C language) frontend for LLVM. %prep %setup -q -a 1 -a 2 -a 3 -a 4 -a 5 -a 6 -b 50 -a 51 -n llvm-%{version}.src %patch1 %patch2 %patch3 %patch4 %patch5 %patch6 -p1 %patch7 %patch8 -p1 %patch9 -p1 %if 0%{?suse_version} > 1320 %patch20 %patch21 %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 %{with openmp} mv openmp-%{version}.src projects/openmp %endif %if %{with libcxx} mv libcxx-%{version}.src projects/libcxx mv libcxxabi-%{version}.src projects/libcxxabi rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname.pass.cpp rm projects/libcxx/test/std/localization/locale.categories/category.time/locale.time.get.byname/get_monthname_wide.pass.cpp %endif # We hardcode i586 rm tools/clang/test/Driver/x86_features.c rm tools/clang/test/Driver/nacl-direct.c sed -i s,SVN_REVISION,\"%{_revsn}\",g tools/clang/lib/Basic/Version.cpp sed -i s,LLVM_REVISION,\"%{_revsn}\",g tools/clang/lib/Basic/Version.cpp # ARMv6 needs this exact host triple %ifarch armv6hl cat > autoconf/config.guess << EOF #!/bin/sh echo armv6hl-suse-linux-gnueabi EOF %endif %build # 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 flags+=" -mfloat-abi=hard -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp" %endif %ifarch armv7hl flags+=" -mfloat-abi=hard -march=armv7-a -mtune=cortex-a9 -mfpu=vfpv3-d16" %endif %ifarch %{ix86} x86_64 TARGETS_TO_BUILD="all" %else TARGETS_TO_BUILD=host %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 \ -DLLVM_TARGETS_TO_BUILD=${TARGETS_TO_BUILD} \ %if "%{_lib}" == "lib64" -DLLVM_LIBDIR_SUFFIX=64 \ %endif %if %{with ffi} -DLLVM_ENABLE_FFI=ON \ %endif %if %{with oprofile} -DLLVM_USE_OPROFILE=ON \ %endif -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 %install %cmake_install # Docs are prebuilt due to sphinx dependency # # pushd llvm-3.8.1.src/docs # make -f Makefile.sphinx man html # popd # pushd cfe-3.8.1.src/docs # make -f Makefile.sphinx man html # popd # tar cvJf llvm-docs-3.8.1.src.tar.xz llvm-3.8.1.src/docs/_build/{man,html} # tar cvJf cfe-docs-3.8.1.src.tar.xz cfe-3.8.1.src/docs/_build/{man,html} # Build man/html pages pushd docs 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 popd pushd 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 popd # install python bindings # The python bindings use the unversioned libclang.so, # so it doesn't make sense to have multiple versions of it %if %{_latest} install -d %{buildroot}%{python_sitelib}/clang pushd tools/clang/bindings/python cp clang/*.py %{buildroot}%{python_sitelib}/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 %endif mkdir -p %{buildroot}%{_libdir}/bfd-plugins ln -s %{_libdir}/LLVMgold.so %{buildroot}%{_libdir}/bfd-plugins/ 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} mv %{buildroot}%{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff mv %{buildroot}%{_datadir}/clang/clang-tidy-diff.py %{buildroot}%{_bindir}/clang-tidy-diff mv %{buildroot}%{_datadir}/clang/run-clang-tidy.py %{buildroot}%{_bindir}/run-clang-tidy chmod -x %{buildroot}%{_mandir}/man1/scan-build.1 # Stuff we don't want to include rm %{buildroot}%{_mandir}/man1/lit.1 # Put cmake files where they can be detected mkdir -p %{buildroot}%{_libdir}/cmake/llvm/ pushd %{buildroot}%{_datadir}/llvm/cmake/ for f in * ; do ln -s %{_datadir}/llvm/cmake/$f %{buildroot}%{_libdir}/cmake/llvm/$f done # This confuses the rpm cmake provides detection rm %{buildroot}%{_libdir}/cmake/llvm/LLVM-Config.cmake mkdir -p %{buildroot}%{_libdir}/cmake/clang/ pushd %{buildroot}%{_datadir}/clang/cmake/ for f in * ; do ln -s %{_datadir}/clang/cmake/$f %{buildroot}%{_libdir}/cmake/clang/$f done %if %{with libcxx} rm %{buildroot}%{_libdir}/libc++abi.a %endif %if %{with openmp} rm %{buildroot}%{_libdir}/libgomp.so rm %{buildroot}%{_libdir}/libiomp*.so %endif # We don't care about applescript or sublime text rm %{buildroot}%{_datadir}/clang/*.applescript rm %{buildroot}%{_datadir}/clang/clang-format-sublime.py %fdupes -s %{buildroot}%{_docdir}/%{name} %fdupes -s %{buildroot}%{_docdir}/%{name}-doc %check cd build %ifnarch armv7hl armv7l %if !0%{?qemu_user_space_build:1} # we just do not have enough memory with qemu emulation ninja -v %{?_smp_mflags} check ninja -v %{?_smp_mflags} clang-test %if %{with libcxx} ninja -v %{?_smp_mflags} check-libcxx ninja -v %{?_smp_mflags} check-libcxxabi %endif %endif %endif %post -n libLLVM%{_sonum} -p /sbin/ldconfig %postun -n libLLVM%{_sonum} -p /sbin/ldconfig %post -n libclang%{_sonum} -p /sbin/ldconfig %postun -n libclang%{_sonum} -p /sbin/ldconfig %post -n libLTO%{_sonum} -p /sbin/ldconfig %postun -n libLTO%{_sonum} -p /sbin/ldconfig %post gold -p /sbin/ldconfig %postun gold -p /sbin/ldconfig %post devel -p /sbin/ldconfig %postun devel -p /sbin/ldconfig %post clang-devel -p /sbin/ldconfig %postun clang-devel -p /sbin/ldconfig %post LTO-devel -p /sbin/ldconfig %postun LTO-devel -p /sbin/ldconfig %if %{with openmp} %post -n libomp -p /sbin/ldconfig %postun -n libomp -p /sbin/ldconfig %endif %if %{with libcxx} %post -n libc++%{_socxx} -p /sbin/ldconfig %postun -n libc++%{_socxx} -p /sbin/ldconfig %post -n libc++abi%{_socxx} -p /sbin/ldconfig %postun -n libc++abi%{_socxx} -p /sbin/ldconfig %post libc++-devel -p /sbin/ldconfig %postun libc++-devel -p /sbin/ldconfig %post libc++abi-devel -p /sbin/ldconfig %postun libc++abi-devel -p /sbin/ldconfig %endif %files %defattr(-,root,root) %{_bindir}/bugpoint %{_bindir}/llc %{_bindir}/lli %{_bindir}/llvm-* %{_bindir}/obj2yaml %{_bindir}/opt %{_bindir}/sancov %{_bindir}/verify-uselistorder %{_bindir}/yaml2obj %{_mandir}/man1/FileCheck.1%{ext_man} %{_mandir}/man1/bugpoint.1%{ext_man} %{_mandir}/man1/llc.1%{ext_man} %{_mandir}/man1/lli.1%{ext_man} %{_mandir}/man1/llvm-*.1%{ext_man} %{_mandir}/man1/opt.1%{ext_man} %{_mandir}/man1/tblgen.1%{ext_man} %exclude %{_bindir}/llvm-config %exclude %{_mandir}/man1/llvm-config.1%{ext_man} %files clang %defattr(-,root,root) %{_bindir}/c-index-test %{_bindir}/c++-analyzer %{_bindir}/ccc-analyzer %{_bindir}/clang %{_bindir}/clang-* %{_bindir}/clang++ %{_bindir}/git-clang-format %{_bindir}/modularize %{_bindir}/run-clang-tidy %{_mandir}/man1/clang.1%{ext_man} %dir %{_libdir}/clang/ %{_libdir}/clang/%{_relver}/ %files clang-checker %defattr(-,root,root) %{_bindir}/scan-build %{_bindir}/scan-view %{_datadir}/scan-build/ %{_datadir}/scan-view/ %{_mandir}/man1/scan-build.1%{ext_man} %files -n libLLVM%{_sonum} %defattr(-,root,root,-) %{_libdir}/libLLVM*.so.* %files -n libclang%{_sonum} %defattr(-,root,root,-) %{_libdir}/libclang*.so.* %files -n libLTO%{_sonum} %defattr(-,root,root) %{_libdir}/libLTO.so.* %files gold %defattr(-,root,root) %{_libdir}/LLVMgold.so %dir %{_libdir}/bfd-plugins/ %{_libdir}/bfd-plugins/LLVMgold.so %if %{with openmp} %files -n libomp %defattr(-,root,root) %{_libdir}/libomp.so %endif %if %{with libcxx} %files -n libc++%{_socxx} %defattr(-,root,root) %{_libdir}/libc++.so.* %files -n libc++abi%{_socxx} %defattr(-,root,root) %{_libdir}/libc++abi.so.* %files libc++-devel %defattr(-,root,root) %{_libdir}/libc++.so %{_libdir}/libc++abi.so %{_includedir}/c++/ %files libc++abi-devel %defattr(-,root,root) %{_libdir}/libc++abi.so %endif %files devel %defattr(-,root,root,-) %{_bindir}/llvm-config %{_libdir}/libLLVM*.so %{_libdir}/BugpointPasses.* %{_libdir}/LLVMHello.* %{_includedir}/llvm/ %{_includedir}/llvm-c/ %dir %{_datadir}/llvm/ %{_datadir}/llvm/cmake %{_libdir}/cmake/llvm %{_docdir}/llvm/ %{_mandir}/man1/llvm-config.1%{ext_man} %files clang-devel %defattr(-,root,root) %{_libdir}/libclang*.so %{_includedir}/clang/ %{_includedir}/clang-c/ %dir %{_datadir}/clang/ %{_datadir}/clang/cmake %{_libdir}/cmake/clang %{_docdir}/llvm-clang/ %files LTO-devel %defattr(-,root,root) %{_libdir}/libLTO.so %files emacs-plugins %defattr(-,root,root,-) %dir %{_datadir}/clang/ %{_datadir}/clang/clang-format.el %files vim-plugins %defattr(-,root,root,-) %doc utils/vim/README.vim %{_datadir}/vim/ %dir %{_datadir}/clang/ %{_datadir}/clang/clang-format.py # The python bindings use the unversioned libclang.so, # so it doesn't make sense to have multiple versions of it %if %{_latest} %files -n python-clang %defattr(-,root,root) %{python_sitelib}/clang/ %{python_sitelib}/clang/__init__.py %{python_sitelib}/clang/cindex.py %{python_sitelib}/clang/enumerations.py %{_docdir}/python-clang/ %endif %changelog