加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
llvm.spec 9.33 KB
一键复制 编辑 原始数据 按行查看 历史
liyunfei 提交于 2024-01-03 09:41 . remove sys_llvm for clang-15 toolchain
%bcond_with sys_llvm
%bcond_without check
%global maj_ver 15
%global min_ver 0
%global patch_ver 7
%if %{with sys_llvm}
%global pkg_name llvm
%global install_prefix %{_prefix}
%else
%global pkg_name llvm%{maj_ver}
%global install_prefix %{_libdir}/%{name}
%endif
%global install_bindir %{install_prefix}/bin
%global install_includedir %{install_prefix}/include
%if 0%{?__isa_bits} == 64
%global install_libdir %{install_prefix}/lib64
%else
%global install_libdir %{install_prefix}/lib
%endif
%global install_srcdir %{install_prefix}/src
%global install_docdir %{install_prefix}/share/doc
%global max_link_jobs %{_smp_build_ncpus}
%global targets_to_build "all"
%global experimental_targets_to_build ""
%global build_install_prefix %{buildroot}%{install_prefix}
%global llvm_triple %{_host}
# Disable LTO as this causes crash if gcc lto enabled.
%define _lto_cflags %{nil}
Name: %{pkg_name}
Version: %{maj_ver}.%{min_ver}.%{patch_ver}
Release: 7
Summary: The Low Level Virtual Machine
License: NCSA
URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-%{version}.src.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/cmake-%{version}.src.tar.xz
Patch1: 0001-Backport-RISCV-Handle-o-inline-asm-memory-constraint.patch
Patch2: 0002-Prevent-environment-variables-from-exceeding-NAME_MA.patch
BuildRequires: binutils-devel
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: libedit-devel
BuildRequires: libffi-devel
BuildRequires: multilib-rpm-config
BuildRequires: ncurses-devel
BuildRequires: ninja-build
BuildRequires: python3-devel
BuildRequires: python3-psutil
BuildRequires: python3-recommonmark
BuildRequires: python3-sphinx
BuildRequires: python3-setuptools
BuildRequires: zlib-devel
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.
%package devel
Summary: Libraries and header files for LLVM
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: libedit-devel
Requires: %{name}-static%{?_isa} = %{version}-%{release}
Requires(post): %{_sbindir}/alternatives
Requires(postun): %{_sbindir}/alternatives
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
Conflicts: %{name}-devel < 8
Provides: llvm-static(major) = %{maj_ver}
%description static
Static libraries for the LLVM compiler infrastructure.
%package test
Summary: LLVM regression tests
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Provides: llvm-test(major) = %{maj_ver}
%description test
LLVM regression tests.
%package googletest
Summary: LLVM's modified googletest sources
%description googletest
LLVM's modified googletest sources.
%prep
%setup -T -q -b 1 -n cmake-%{version}.src
cd ..
mv cmake-%{version}.src cmake
%setup -T -q -b 0 -n llvm-%{version}.src
%autopatch -p2
pathfix.py -i %{__python3} -pn \
test/BugPoint/compile-custom.ll.py \
tools/opt-viewer/*.py \
utils/update_cc_test_checks.py
%build
mkdir -p _build
cd _build
%cmake .. -G Ninja \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DLLVM_PARALLEL_LINK_JOBS=%{max_link_jobs} \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DLLVM_TARGETS_TO_BUILD=%{targets_to_build} \
-DLLVM_ENABLE_LIBCXX:BOOL=OFF \
-DLLVM_ENABLE_ZLIB:BOOL=ON \
-DLLVM_ENABLE_FFI:BOOL=ON \
-DLLVM_ENABLE_RTTI:BOOL=ON \
-DLLVM_USE_PERF:BOOL=ON \
-DLLVM_BINUTILS_INCDIR=%{_includedir} \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=%{experimental_targets_to_build} \
-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_LIT_ARGS=-v \
-DLLVM_INCLUDE_EXAMPLES:BOOL=ON \
-DLLVM_BUILD_EXAMPLES:BOOL=OFF \
-DLLVM_INCLUDE_UTILS:BOOL=ON \
-DLLVM_INSTALL_UTILS:BOOL=ON \
-DLLVM_INCLUDE_DOCS:BOOL=ON \
-DLLVM_BUILD_DOCS:BOOL=ON \
-DLLVM_ENABLE_SPHINX:BOOL=ON \
-DLLVM_ENABLE_DOXYGEN:BOOL=OFF \
-DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_BUILD_EXTERNAL_COMPILER_RT:BOOL=ON \
-DLLVM_INSTALL_TOOLCHAIN_ONLY:BOOL=OFF \
-DLLVM_DEFAULT_TARGET_TRIPLE=%{llvm_triple} \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
-DLLVM_INSTALL_SPHINX_HTML_DIR=%{install_docdir}/html \
-DSPHINX_EXECUTABLE=%{_bindir}/sphinx-build-3 \
%if 0%{?__isa_bits} == 64
-DLLVM_LIBDIR_SUFFIX=64 \
%else
-DLLVM_LIBDIR_SUFFIX= \
%endif
-DLLVM_INCLUDE_BENCHMARKS=OFF
%ninja_build LLVM
%ninja_build
%install
%ninja_install -C _build
mkdir -p %{buildroot}/%{_bindir}
# Install binaries needed for lit tests
for f in llvm-isel-fuzzer llvm-opt-fuzzer
do
install -m 0755 %{_builddir}/llvm-%{version}.src/_build/bin/$f %{buildroot}%{install_bindir}
done
%if 0%{?__isa_bits} == 64
install %{_builddir}/llvm-%{version}.src/_build/lib64/libLLVMTestingSupport.a %{buildroot}%{install_libdir}
%else
install %{_builddir}/llvm-%{version}.src/_build/lib/libLLVMTestingSupport.a %{buildroot}%{install_libdir}
%endif
# Install gtest sources so clang can use them for gtest
install -d %{buildroot}%{install_srcdir}
install -d %{buildroot}%{install_srcdir}/utils/
cp -R %{_builddir}/llvm-%{version}.src/utils/unittest %{buildroot}%{install_srcdir}/utils/
# Clang needs these for running lit tests.
cp %{_builddir}/llvm-%{version}.src/utils/update_cc_test_checks.py %{buildroot}%{install_srcdir}/utils/
cp -R %{_builddir}/llvm-%{version}.src/utils/UpdateTestChecks %{buildroot}%{install_srcdir}/utils/
# Move header files
mkdir -p %{buildroot}/%{install_includedir}
ln -s ../../../%{install_includedir}/llvm %{buildroot}/%{install_includedir}/llvm
ln -s ../../../%{install_includedir}/llvm-c %{buildroot}/%{install_includedir}/llvm-c
# Fix multi-lib
%multilib_fix_c_header --file %{install_includedir}/llvm/Config/llvm-config.h
# Create ld.so.conf.d entry
mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d
cat >> %{buildroot}%{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf << EOF
%{install_libdir}
EOF
# Remove opt-viewer, since this is just a compatibility package.
rm -Rf %{build_install_prefix}/share/opt-viewer
cp -Rv ../cmake/Modules/* %{buildroot}%{install_libdir}/cmake/llvm
%check
%if %{with check}
LD_LIBRARY_PATH=%{buildroot}/%{install_libdir} %{__ninja} check-all -C ./_build/
%endif
%ldconfig_scriptlets libs
%files
%license LICENSE.TXT
%{install_prefix}/share/man/man1/*
%{install_bindir}/*
%exclude %{install_bindir}/not
%exclude %{install_bindir}/count
%exclude %{install_bindir}/yaml-bench
%exclude %{install_bindir}/lli-child-target
%exclude %{install_bindir}/llvm-isel-fuzzer
%exclude %{install_bindir}/llvm-opt-fuzzer
%files libs
%license LICENSE.TXT
%{install_libdir}/libLLVM-%{maj_ver}.so
%config(noreplace) %{_sysconfdir}/ld.so.conf.d/%{name}-%{_arch}.conf
%{install_libdir}/LLVMgold.so
%{install_libdir}/libLLVM-%{maj_ver}.%{min_ver}*.so
%{install_libdir}/libLTO.so*
%exclude %{install_libdir}/libLTO.so
%{install_libdir}/libRemarks.so*
%files devel
%license LICENSE.TXT
%{install_includedir}/llvm
%{install_includedir}/llvm-c
%{install_libdir}/libLTO.so
%{install_libdir}/libLLVM.so
%{install_libdir}/cmake/llvm
%files doc
%license LICENSE.TXT
%doc %{install_docdir}/html
%files static
%license LICENSE.TXT
%{install_libdir}/*.a
%exclude %{install_libdir}/libLLVMTestingSupport.a
%files test
%license LICENSE.TXT
%{install_bindir}/not
%{install_bindir}/count
%{install_bindir}/yaml-bench
%{install_bindir}/lli-child-target
%{install_bindir}/llvm-isel-fuzzer
%{install_bindir}/llvm-opt-fuzzer
%files googletest
%license LICENSE.TXT
%{install_srcdir}/utils
%{install_libdir}/libLLVMTestingSupport.a
%changelog
* Wed Jan 3 2024 liyunfei <liyunfei33@huawei.com> - 15.0.7-7
- Remove sys_llvm for clang-15 toolchain.
* Tue Sep 19 2023 liyunfei <liyunfei33@huawei.com> - 15.0.7-6
- Prevent environment variables from exceeding NAME_MAX.
* Wed Aug 9 2023 liyunfei <liyunfei33@huawei.com> - 15.0.7-5
- Solve opaque pointer issue in Backport testcase.
* Wed Jul 19 2023 liyunfei <liyunfei33@huawei.com> - 15.0.7-4
- [RISCV] Handle "o" inline asm memory constraint.
* Fri May 19 2023 cf-zhao <zhaochuanfeng@huawei.com> - 15.0.7-3
- Make this spec file support both system-version and multi-version.
* Wed Jun 7 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.7-2
- Disable LTO as this causes crash if gcc lto enabled.
* Mon Feb 20 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.7-1
- Upgrade to 15.0.7.
* Wed Feb 8 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.6-3
- Create llvm-test/googletest to support clang/lld unit test.
* Fri Feb 3 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.6-2
- Enable llvm utils tools.
* Mon Jan 2 2023 Chenxi Mao <chenxi.mao@suse.com> - 15.0.6-1
- Package init
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化