2023-07-07 12:10:06 +08:00
|
|
|
%global maj_ver 12
|
|
|
|
|
%global min_ver 0
|
|
|
|
|
%global patch_ver 1
|
|
|
|
|
%global mlir_version %{maj_ver}.%{min_ver}.%{patch_ver}
|
|
|
|
|
|
|
|
|
|
%global pkg_name llvm-mlir%{maj_ver}
|
|
|
|
|
%global install_prefix %{_libdir}/llvm%{maj_ver}
|
|
|
|
|
|
|
|
|
|
%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}
|
|
|
|
|
Release: 1
|
2022-11-16 17:30:52 +08:00
|
|
|
Summary: The MLIR project is a novel approach to building reusable and extensible compiler infrastructure.
|
|
|
|
|
License: Apache 2.0
|
|
|
|
|
URL: https://mlir.llvm.org/
|
|
|
|
|
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}/llvm-project-%{version}.src.tar.xz
|
|
|
|
|
Patch0: 0001-PATCH-mlir-Support-building-MLIR-standalone.patch
|
|
|
|
|
Patch1: 0002-PATCH-mlir-Fix-building-unittests-in-in-tree-build.patch
|
|
|
|
|
|
2023-07-07 12:10:06 +08:00
|
|
|
BuildRequires: gcc gcc-c++ cmake ninja-build zlib-devel python3-lit
|
|
|
|
|
BuildRequires: llvm%{maj_ver}-devel = %{version}
|
|
|
|
|
BuildRequires: llvm%{maj_ver}-test = %{version}
|
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
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
%prep
|
|
|
|
|
%autosetup -n llvm-project-%{version}.src/mlir -p2
|
|
|
|
|
# remove all but keep mlir
|
|
|
|
|
find ../* -maxdepth 0 ! -name "mlir" -exec rm -rf {} +
|
|
|
|
|
|
|
|
|
|
%build
|
|
|
|
|
%cmake -G Ninja \
|
|
|
|
|
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
|
|
|
|
-DCMAKE_SKIP_RPATH=ON \
|
2023-07-07 12:10:06 +08:00
|
|
|
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \
|
2022-11-16 17:30:52 +08:00
|
|
|
-DLLVM_LINK_LLVM_DYLIB:BOOL=ON \
|
2023-07-07 12:10:06 +08:00
|
|
|
-DCMAKE_PREFIX_PATH=%{install_libdir}/cmake/llvm/ \
|
2022-11-16 17:30:52 +08:00
|
|
|
-DLLVM_BUILD_UTILS:BOOL=ON \
|
|
|
|
|
-DMLIR_INCLUDE_DOCS:BOOL=ON \
|
|
|
|
|
-DMLIR_INCLUDE_TESTS:BOOL=OFF \
|
|
|
|
|
-DMLIR_INCLUDE_INTEGRATION_TESTS:BOOL=OFF \
|
|
|
|
|
-DBUILD_SHARED_LIBS=OFF \
|
|
|
|
|
-DLLVM_LIBDIR_SUFFIX=64 \
|
|
|
|
|
%ifarch %ix86 x86_64
|
|
|
|
|
-DLLVM_TARGETS_TO_BUILD="X86"
|
|
|
|
|
%endif
|
|
|
|
|
%ifarch aarch64
|
|
|
|
|
-DLLVM_TARGETS_TO_BUILD="AArch64"
|
|
|
|
|
%endif
|
|
|
|
|
|
|
|
|
|
%ninja_build
|
|
|
|
|
|
|
|
|
|
%install
|
|
|
|
|
%ninja_install
|
|
|
|
|
|
|
|
|
|
%check
|
|
|
|
|
# build process .exe tools normally use rpath or static linkage
|
|
|
|
|
%cmake_build --target check-mlir || true
|
|
|
|
|
|
|
|
|
|
%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_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
|
|
|
|
|
%{install_libdir}/libmlir_c_runner_utils_static.a
|
2022-11-16 17:30:52 +08:00
|
|
|
|
|
|
|
|
%files devel
|
2023-07-07 12:10:06 +08:00
|
|
|
%{install_bindir}/mlir-tblgen
|
|
|
|
|
%{install_libdir}/libMLIR*.so
|
|
|
|
|
%{install_libdir}/libmlir_runner_utils.so
|
|
|
|
|
%{install_libdir}/libmlir_c_runner_utils.so
|
|
|
|
|
%{install_libdir}//libmlir_async_runtime.so
|
|
|
|
|
%{install_includedir}/mlir
|
|
|
|
|
%{install_includedir}/mlir-c
|
|
|
|
|
%{install_libdir}/cmake/mlir
|
2022-11-16 17:30:52 +08:00
|
|
|
|
|
|
|
|
%changelog
|
2023-07-07 12:10:06 +08:00
|
|
|
* Fri Jul 7 2023 cf-zhao <zhaochuanfeng@huawei.com> - 12.0.1-1
|
|
|
|
|
- Change the install folder
|
|
|
|
|
|
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
|