%global _smp_mflags -v -j8 %global maj_ver 10 %global min_ver 0 %global patch_ver 0 %global baserelease 1 # Components enabled if supported by target architecture: %define gold_arches %{ix86} x86_64 %{arm} aarch64 %{power64} s390x %ifarch %{gold_arches} %bcond_without gold %else %bcond_with gold %endif %define _prefix /usr/local/tools/llvm-%{maj_ver} %define _pkgdocdir %{_docdir}/llvm %global llvm_srcdir llvm-%{version}.src Name: llvm-%{maj_ver} Version: %{maj_ver}.%{min_ver}.%{patch_ver} Release: %{baserelease}%{?dist} Summary: The Low Level Virtual Machine License: NCSA URL: http://llvm.org Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{llvm_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/%{llvm_srcdir}.tar.xz.sig Source2: llvm-config.h BuildRequires: gcc BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: zlib-devel BuildRequires: libffi-devel BuildRequires: ncurses-devel # LLVM's LineEditor library will use libedit if it is available. BuildRequires: libedit-devel # We need python3-devel for pathfix.py. BuildRequires: python3-devel %if %{with gold} BuildRequires: binutils-devel %endif %if 0%{?epel} == 6 BuildRequires: libstdc++ BuildRequires: libstdc++-devel %else BuildRequires: libstdc++-static %endif %if 0%{?fedora} >= 24 BuildRequires: python3-sphinx %else BuildRequires: python %endif Requires: %{name}-libs%{?_isa} = %{version}-%{release} Provides: llvm(major) = %{maj_ver} %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. %if 0%{?epel} == 7 %define debug_package %{nil} %endif %package devel Summary: Libraries and header files for LLVM Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}-libs%{?_isa} = %{version}-%{release} # The installed LLVM cmake files will add -ledit to the linker flags for any # app that requires the libLLVMLineEditor, so we need to make sure # libedit-devel is available. Requires: libedit-devel Provides: llvm-devel(major) = %{maj_ver} %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 BuildArch: noarch Requires: %{name} = %{version}-%{release} %description doc Documentation for the LLVM compiler infrastructure. %package libs Summary: LLVM shared libraries %description libs Shared libraries for the LLVM compiler infrastructure. %package static Summary: LLVM static libraries %description static Static libraries for the LLVM compiler infrastructure. %prep %setup -q -n %{llvm_srcdir} %build mkdir -p _build cd _build %ifarch s390 %{arm} %ix86 # Decrease debuginfo verbosity to reduce memory consumption during final library linking %global optflags %(echo %{optflags} | sed 's/-g /-g1 /') %endif # force off shared libs as cmake macros turns it on. cmake .. -G Ninja \ -DBUILD_SHARED_LIBS:BOOL=OFF \ -DLLVM_PARALLEL_LINK_JOBS=1 \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DCMAKE_SHARED_LINKER_FLAGS="-Wl,-Bsymbolic -static-libstdc++" \ %ifarch s390 -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ %endif %if 0%{?__isa_bits} == 64 -DLLVM_LIBDIR_SUFFIX=64 \ %else -DLLVM_LIBDIR_SUFFIX= \ %endif \ -DLLVM_TARGETS_TO_BUILD=all \ -DLLVM_ENABLE_LIBCXX:BOOL=OFF \ -DLLVM_ENABLE_ZLIB:BOOL=ON \ -DLLVM_ENABLE_FFI:BOOL=ON \ -DLLVM_ENABLE_RTTI:BOOL=ON \ -DSPHINX_WARNINGS_AS_ERRORS:BOOL=OFF \ %if %{with gold} -DLLVM_BINUTILS_INCDIR=%{_includedir} \ %endif \ -DLLVM_BUILD_RUNTIME:BOOL=ON \ \ -DLLVM_INCLUDE_TOOLS:BOOL=ON \ -DLLVM_BUILD_TOOLS:BOOL=ON \ \ -DLLVM_INCLUDE_TESTS:BOOL=ON \ -DLLVM_BUILD_TESTS:BOOL=ON \ \ -DLLVM_INCLUDE_EXAMPLES:BOOL=ON \ -DLLVM_BUILD_EXAMPLES:BOOL=OFF \ \ -DLLVM_INCLUDE_UTILS:BOOL=ON \ -DLLVM_INSTALL_UTILS:BOOL=OFF \ \ -DLLVM_INCLUDE_DOCS:BOOL=ON \ -DLLVM_BUILD_DOCS:BOOL=ON \ %if 0%{?fedora} >= 24 -DLLVM_ENABLE_SPHINX:BOOL=ON \ %endif -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \ \ -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ -DLLVM_DYLIB_EXPORT_ALL:BOOL=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ -DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \ -DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \ \ %if 0%{?fedora} >= 24 -DSPHINX_EXECUTABLE=/usr/bin/sphinx-build-3 %endif \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ # Build libLLVM.so first. This ensures that when libLLVM.so is linking, there # are no other compile jobs running. This will help reduce OOM errors on the # builders without having to artificially limit the number of concurrent jobs. ninja-build %{?_smp_mflags} LLVM ninja-build %{?_smp_mflags} %install DESTDIR=%{buildroot} ninja-build %{?_smp_mflags} install -C _build # fix multi-lib mv -v %{buildroot}%{_bindir}/llvm-config{,-%{__isa_bits}} mv -v %{buildroot}%{_includedir}/llvm/Config/llvm-config{,-%{__isa_bits}}.h install -m 0644 %{SOURCE2} %{buildroot}%{_includedir}/llvm/Config/llvm-config.h # Fix for the removals of alternatives ln -s llvm-config-%{__isa_bits} %{buildroot}%{_bindir}/llvm-config mkdir -p %{buildroot}/etc/ld.so.conf.d echo %{_libdir} > %{buildroot}/etc/ld.so.conf.d/%{name}.conf %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig %files %{_bindir}/* %{_datadir}/opt-viewer %if 0%{?fedora} >= 24 %{_mandir}/man1/*.1 %endif %exclude %{_bindir}/llvm-config %exclude %{_bindir}/llvm-config-%{__isa_bits} %if 0%{?fedora} >= 24 %exclude %{_mandir}/man1/llvm-config.1 %endif %files libs %{_libdir}/libLLVM-%{maj_ver}*.so %{_libdir}/libLTO.so* %{_libdir}/libRemarks.so* %if %{with gold} %{_libdir}/LLVMgold.so %endif %config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}.conf %files devel %{_bindir}/llvm-config %{_bindir}/llvm-config-%{__isa_bits} %if 0%{?fedora} >= 24 %{_mandir}/man1/llvm-config* %endif %{_includedir}/llvm %{_includedir}/llvm-c %{_libdir}/libLLVM.so %{_libdir}/cmake/llvm %files doc %if 0%{?fedora} >= 24 %doc %{_pkgdocdir}/html %endif %files static %{_libdir}/*.a %changelog * Tue Jul 21 2020 Evgeny Akhmetkhanov - 10.0.0-1 - Initial spec for EL7 from FC33