# # spec file for package llvm # # Copyright (c) 2013 SUSE LINUX Products 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 170558 %define _release_version 3.2 %define _supported_archs "arm,powerpc,x86" Name: llvm Version: 3.2 Release: 0 Summary: Low Level Virtual Machine License: NCSA Group: Development/Languages/Other Url: http://www.llvm.org Source0: %{name}-%{version}.tar.bz2 Source100: %{name}-rpmlintrc # 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 Patch5: llvm-config-lib64.patch # PATCH-FIX-OPENSUSE arm_suse_support.diff --Enable ARM suse toolchain support Patch6: arm_suse_support.diff # PATCH-FIX-OPENSUSE disable_neon_in_armv7.diff -- Disable use of neon in armv7 openSUSE Patch7: disable_neon_in_armv7.diff # PATCH-FIX-UPSTREAM python-ulimit.patch Upstream r169695 Patch8: python-ulimit.patch Patch9: pr14795.patch Patch10: pr14831.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRequires: autoconf BuildRequires: automake %if 0%{?suse_version} >= 1220 BuildRequires: binutils-devel >= 2.21.90 %endif BuildRequires: bison BuildRequires: chrpath BuildRequires: fdupes BuildRequires: flex BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: groff %ifarch x86_64 # For tests BuildRequires: glibc-devel-32bit %endif BuildRequires: libffi-devel BuildRequires: libtool BuildRequires: python-base # 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 devel Summary: Libraries and Header Files for LLVM Group: Development/Languages/Other Requires: %{name} = %{version} Requires: libffi-devel Requires: libstdc++-devel >= 3.4 Obsoletes: llvm-doc < %{version} Provides: llvm-doc = %{version} %description devel This package contains library and header files needed to develop new native programs that use the LLVM infrastructure. %package doc Summary: Documentation for LLVM Group: Documentation/HTML Requires: %{name} = %{version} %description doc Documentation for the LLVM compiler infrastructure. %package clang Summary: CLANG frontend for LLVM Group: Development/Languages/Other Requires: %{name} = %{version} Requires: binutils Requires: libstdc++-devel Provides: clang %description clang This package contains the clang (C language) frontend for LLVM. %package clang-devel Summary: CLANG frontend for LLVM (devel package) Group: Development/Languages/Other Requires: 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. %prep %setup -q -n %{name} %patch1 -p1 %patch2 -p1 %patch3 -p1 %patch4 -p1 %if "%{_lib}" == "lib64" %patch5 -p1 %endif %ifarch %arm %patch6 -p1 %endif %ifarch armv7l armv7hl %patch7 -p0 %endif %patch8 -p1 %patch9 -p0 %patch10 -p0 # 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 # Only enable target archs otherwise llvm-config is messed up sed -i s,"subdirectories = .*","subdirectories = ARM PowerPC X86", lib/Target/LLVMBuild.txt sed -i s,"IntelJITEvents OProfileJIT","", lib/ExecutionEngine/LLVMBuild.txt echo > utils/unittest/LLVMBuild.txt %build TOPLEVEL=$PWD # as-needed avoids linking LLVMgold to LTO, just because cmake places -lLTO before the .o file is used export SUSE_ASNEEDED=0 mkdir stage1 stage2 pushd stage1 mkdir Release %if "%{_lib}" == "lib64" ln -s lib Release/lib64 %endif ../configure \ --enable-optimized \ --disable-assertions \ --with-optimize-option="-O0" \ %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 popd pushd stage2 mkdir Release+Debug # autotools ignore --libdir %if "%{_lib}" == "lib64" ln -s lib Release+Debug/lib64 %endif export CC=$TOPLEVEL/stage1/Release/bin/clang export CXX=$TOPLEVEL/stage1/Release/bin/clang++ %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" %endif ../configure \ --prefix=%{_prefix} \ --enable-optimized \ --disable-assertions \ --enable-pic \ --disable-timestamps \ %if 0%{?suse_version} >= 1220 --with-binutils-include=/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 \ %else --with-mode=arm \ %endif %endif --enable-targets=arm \ %else --enable-targets=%{_supported_archs} \ %endif --with-clang-resource-dir="../%{_lib}/clang/%{_release_version}" \ --enable-debug-symbols \ --enable-debug-runtime make %{?_smp_mflags} REQUIRES_RTTI=1 %check cd stage2 %if 0%{!?qemu_user_space_build:1} # we just do not have enough memory with qemu emulation make check cd tools/clang make test %endif %install cd stage2 %makeinstall 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/ cd ../tools/clang/docs mkdir -p %{buildroot}%{_docdir}/llvm-clang/html cp *.txt %{buildroot}%{_docdir}/llvm-clang 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} 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 pushd %{buildroot}%{_bindir} ln -s ccc-analyzer c++-analyzer popd %if 0%{?suse_version} >= 1220 mkdir -p %{buildroot}%{_libdir}/bfd-plugins ln -s %{_libdir}/LLVMgold.so %{buildroot}%{_libdir}/bfd-plugins/ %endif 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}%{_libdir}/libclang.a rm %{buildroot}%{_libdir}/BugpointPasses.* rm %{buildroot}%{_libdir}/LLVMHello.* %fdupes -s %{buildroot}%{_docdir}/%{name} %fdupes -s %{buildroot}%{_docdir}/%{name}-doc %post clang -p /sbin/ldconfig %postun clang -p /sbin/ldconfig %post clang-devel -p /sbin/ldconfig %postun clang-devel -p /sbin/ldconfig %files %defattr(-,root,root) %{_bindir}/bugpoint %{_bindir}/llc %{_bindir}/lli %{_bindir}/macho-dump %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} %files clang %defattr(-,root,root) %{_bindir}/clang %{_bindir}/clang-* %{_bindir}/clang++ %{_bindir}/c-index-test %{_bindir}/ccc-analyzer %{_bindir}/c++-analyzer %{_bindir}/scan-build %{_bindir}/scan-view %{py_sitedir}/ScanView.py %{py_sitedir}/Reporter.py %{py_sitedir}/startfile.py %{py_sitedir}/Resources %{_datadir}/clang %{_mandir}/man1/clang.1.gz %{_libdir}/libclang.so %{_libdir}/libLTO.so %{_libdir}/*profile*.a %if 0%{?suse_version} >= 1220 %{_libdir}/LLVMgold.so %{_libdir}/bfd-plugins/ %endif %{_libdir}/clang %files clang-devel %defattr(-,root,root) %{_includedir}/clang %{_includedir}/clang-c %{_libdir}/libLTO.a %{_libdir}/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} %{_includedir}/%{name}/ %{_includedir}/%{name}-c/ %{_libdir}/libLLVM* %doc %{_docdir}/%{name} %files vim-plugins %defattr(-,root,root,-) %doc utils/vim/README.vim %{_datadir}/vim/ %changelog