llvm-mlir18/llvm-mlir.spec

232 lines
6.9 KiB
RPMSpec
Raw Permalink Normal View History

%bcond_without sys_llvm
%bcond_without check
%bcond_without toolchain_clang
%bcond_without bisheng_autotuner
%if %{with toolchain_clang}
%global toolchain clang
%endif
%global maj_ver 17
2023-07-07 12:10:06 +08:00
%global min_ver 0
%global patch_ver 6
2023-07-07 12:10:06 +08:00
%global mlir_version %{maj_ver}.%{min_ver}.%{patch_ver}
%global mlir_srcdir mlir-%{mlir_version}%{?rc_ver:rc%{rc_ver}}.src
2023-07-07 12:10:06 +08:00
%if %{with sys_llvm}
%global pkg_name mlir
%global install_prefix %{_prefix}
%global install_datadir %{_datadir}
%else
%global pkg_name mlir%{maj_ver}
2023-07-07 12:10:06 +08:00
%global install_prefix %{_libdir}/llvm%{maj_ver}
%global install_datadir %{install_prefix}/share
%endif
2023-07-07 12:10:06 +08:00
%global install_bindir %{install_prefix}/bin
%if 0%{?__isa_bits} == 64
%global install_libdir %{install_prefix}/lib64
%else
%global install_libdir %{install_prefix}/lib
%endif
%global install_includedir %{install_prefix}/include
Name: %{pkg_name}
Version: %{mlir_version}
2024-11-11 00:03:19 +08:00
Release: 4
2022-11-16 17:30:52 +08:00
Summary: The MLIR project is a novel approach to building reusable and extensible compiler infrastructure.
2024-11-11 00:03:19 +08:00
License: Apache-2.0
2022-11-16 17:30:52 +08:00
URL: https://mlir.llvm.org/
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{mlir_version}/%{mlir_srcdir}.tar.xz
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{mlir_version}/%{mlir_srcdir}.tar.xz.sig
Patch0: fedora-0001-mlir-python-Reuse-the-library-directory.patch
BuildRequires: clang
2023-07-07 12:10:06 +08:00
BuildRequires: gcc gcc-c++ cmake ninja-build zlib-devel python3-lit
%if %{with sys_llvm}
BuildRequires: llvm-devel = %{version}
BuildRequires: llvm-googletest = %{version}
BuildRequires: llvm-test = %{version}
BuildRequires: llvm-cmake-utils = %{version}
%else
BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-googletest = %{version}
BuildRequires: llvm%{maj_ver}-test = %{version}
BuildRequires: llvm%{maj_ver}-cmake-utils = %{version}
%endif
BuildRequires: python3-devel
BuildRequires: python3-numpy
BuildRequires: python3-pybind11
BuildRequires: python3-pyyaml
2022-11-16 17:30:52 +08:00
%description
2023-07-07 12:10:06 +08:00
The MLIR project is a novel approach to building reusable and extensible compiler infrastructure.
MLIR aims to address software fragmentation, improve compilation for heterogeneous hardware,
significantly reduce the cost of building domain specific compilers, and aid in connecting
2023-07-07 12:10:06 +08:00
existing compilers together.
2022-11-16 17:30:52 +08:00
%package static
Summary: MLIR static files
Requires: %{name} = %{version}
%description static
MLIR static files.
%package devel
Summary: MLIR development files
Requires: %{name} = %{version}-%{release}
Requires: %{name}-static = %{version}-%{release}
%description devel
MLIR development files.
%package -n python3-%{name}
Summary: MLIR python bindings
Requires: python3
Requires: python3-numpy
%description -n python3-%{name}
%{summary}
2022-11-16 17:30:52 +08:00
%prep
%autosetup -n %{mlir_srcdir} -p2
2022-11-16 17:30:52 +08:00
%build
%cmake -G Ninja \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_SKIP_RPATH=ON \
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
-DLLVM_BUILD_LLVM_DYLIB=ON \
2023-07-07 12:10:06 +08:00
-DCMAKE_PREFIX_PATH=%{install_libdir}/cmake/llvm/ \
-DLLVM_EXTERNAL_LIT=%{install_bindir}/lit \
-DLLVM_THIRD_PARTY_DIR=%{install_datadir}/llvm/src/utils \
-DLLVM_COMMON_CMAKE_UTILS=%{install_datadir}/llvm/cmake \
2022-11-16 17:30:52 +08:00
-DLLVM_BUILD_UTILS:BOOL=ON \
-DLLVM_LIBRARY_OUTPUT_INTDIR="." \
-DLLVM_SHLIB_OUTPUT_INTDIR="%{_builddir}/%{mlir_srcdir}/lib/ExecutionEngine/" \
2022-11-16 17:30:52 +08:00
-DMLIR_INCLUDE_DOCS:BOOL=ON \
-DMLIR_INCLUDE_TESTS:BOOL=ON \
2022-11-16 17:30:52 +08:00
-DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \
-DBUILD_SHARED_LIBS=OFF \
-DMLIR_INSTALL_AGGREGATE_OBJECTS=OFF \
-DMLIR_BUILD_MLIR_C_DYLIB=ON \
%if "%{toolchain}" == "clang"
-DCMAKE_C_COMPILER=clang \
-DCMAKE_CXX_COMPILER=clang++ \
%endif
%if %{with bisheng_autotuner}
-DLLVM_ENABLE_AUTOTUNER=ON \
%endif
%ifarch aarch64 %ix86 ppc64le x86_64
-DLLVM_PARALLEL_LINK_JOBS=1 \
%endif
%ifarch %ix86
-DMLIR_RUN_X86VECTOR_TESTS:BOOL=OFF \
%endif
-DMLIR_ENABLE_BINDINGS_PYTHON:BOOL=ON \
%if 0%{?__isa_bits} == 64
2022-11-16 17:30:52 +08:00
-DLLVM_LIBDIR_SUFFIX=64 \
%else
-DLLVM_LIBDIR_SUFFIX=
%endif
2022-11-16 17:30:52 +08:00
%ifarch %ix86 x86_64
-DLLVM_TARGETS_TO_BUILD="X86"
%endif
%ifarch aarch64
-DLLVM_TARGETS_TO_BUILD="AArch64"
%endif
2024-11-11 00:03:19 +08:00
%cmake_build
2022-11-16 17:30:52 +08:00
%install
2024-11-11 00:03:19 +08:00
%cmake_install
2022-11-16 17:30:52 +08:00
mkdir -p %{buildroot}/%{python3_sitearch}
mv %{buildroot}/usr/python_packages/mlir_core/mlir %{buildroot}/%{python3_sitearch}
# These directories should be empty now.
rmdir %{buildroot}/usr/python_packages/mlir_core %{buildroot}/usr/python_packages
# Unneeded files.
rm -rf %{buildroot}/usr/src/python
%if %{with check}
2024-11-11 00:03:19 +08:00
%check
# TODO: Investigate the following issues.
rm -rf test/mlir-pdll-lsp-server/compilation_database.test
rm -rf test/mlir-pdll-lsp-server/completion.test
rm -rf test/mlir-pdll-lsp-server/definition-split-file.test
rm -rf test/mlir-pdll-lsp-server/definition.test
rm -rf test/mlir-pdll-lsp-server/document-links.test
rm -rf test/mlir-pdll-lsp-server/document-symbols.test
rm -rf test/mlir-pdll-lsp-server/exit-eof.test
rm -rf test/mlir-pdll-lsp-server/exit-with-shutdown.test
rm -rf test/mlir-pdll-lsp-server/exit-without-shutdown.test
rm -rf test/mlir-pdll-lsp-server/hover.test
rm -rf test/mlir-pdll-lsp-server/initialize-params-invalid.test
rm -rf test/mlir-pdll-lsp-server/initialize-params.test
rm -rf test/mlir-pdll-lsp-server/inlay-hints.test
rm -rf test/mlir-pdll-lsp-server/references.test
rm -rf test/mlir-pdll-lsp-server/signature-help.test
rm -rf test/mlir-pdll-lsp-server/textdocument-didchange.test
rm -rf test/mlir-pdll-lsp-server/view-output.test
rm -rf test/mlir-tblgen/directive-common.td
rm -rf test/mlir-tblgen/llvm-intrinsics.td
rm -rf test/tblgen-lsp-server/document-links.test
rm -rf test/tblgen-lsp-server/hover.test
2022-11-16 17:30:52 +08:00
# build process .exe tools normally use rpath or static linkage
export LD_LIBRARY_PATH=%{buildroot}/%{_libdir}:%{buildroot}/%{python3_sitearch}/mlir/_mlir_libs
export PYTHONPATH=%{buildroot}/%{python3_sitearch}
2024-11-11 00:03:19 +08:00
%cmake_build --target check-mlir
%endif
2022-11-16 17:30:52 +08:00
%files
%license LICENSE.TXT
2023-07-07 12:10:06 +08:00
%{install_libdir}/libMLIR*.so.*
%{install_libdir}/libmlir_runner_utils.so.*
%{install_libdir}/libmlir_c_runner_utils.so.*
%{install_libdir}/libmlir_float16_utils.so.%{maj_ver}*
2023-07-07 12:10:06 +08:00
%{install_libdir}/libmlir_async_runtime.so.*
2022-11-16 17:30:52 +08:00
%files static
2023-07-07 12:10:06 +08:00
%{install_libdir}/libMLIR*.a
2022-11-16 17:30:52 +08:00
%files devel
2023-07-07 12:10:06 +08:00
%{install_bindir}/mlir-tblgen
%{install_bindir}/mlir-pdll
2023-07-07 12:10:06 +08:00
%{install_libdir}/libMLIR*.so
%{install_libdir}/libmlir_runner_utils.so
%{install_libdir}/libmlir_c_runner_utils.so
%{install_libdir}/libmlir_float16_utils.so
%{install_libdir}/libmlir_async_runtime.so
2023-07-07 12:10:06 +08:00
%{install_includedir}/mlir
%{install_includedir}/mlir-c
%{install_libdir}/cmake/mlir
2022-11-16 17:30:52 +08:00
%files -n python3-%{name}
%{python3_sitearch}/mlir/
2022-11-16 17:30:52 +08:00
%changelog
2024-11-11 00:03:19 +08:00
* Mon Nov 11 2024 Funda Wang <fundawang@yeah.net> - 17.0.6-4
- adopt to new cmake macro
* Tue Aug 20 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-3
- Add BiSheng Autotuner support.
* Fri Jul 5 2024 liyunfei <liyunfei33@huawei.com> - 17.0.6-2
- Add toolchain_clang build support
* Sun Jun 25 2023 zhoujing <zhoujing106@huawei.com> - 17.0.6-1
- Update to 17.0.6
* Sun Jun 25 2023 cf-zhao <zhaochuanfeng@huawei.com> - 15.0.7-1
- Update to 15.0.7
2023-07-07 12:10:06 +08:00
2022-11-16 17:30:52 +08:00
* Wed Nov 16 2022 liyancheng <412998149@qq.com> - 12.0.1-0
- Type:Init
- ID:NA
- SUG:NA
- DESC:Init llvm-mlir repository