增加libomp源码包

This commit is contained in:
s_c_c 2023-06-08 11:06:54 +08:00
parent 132a6dc9ba
commit 5fde5b7c03
2 changed files with 97 additions and 0 deletions

97
libomp.spec Normal file
View File

@ -0,0 +1,97 @@
%global toolchain clang
%global maj_ver 12
%global libomp_version %{maj_ver}.0.1
%global libomp_srcdir openmp-%{libomp_version}.src
%ifarch ppc64le
%global libomp_arch ppc64
%else
%global libomp_arch %{_arch}
%endif
Name: libomp
Version: %{libomp_version}
Release: 1
Summary: OpenMP runtime for clang
License: Apache-2.0 WITH LLVM-exception OR NCSA
URL: http://openmp.llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/%{libomp_srcdir}.tar.xz
BuildRequires: clang
# For clang-offload-packager
BuildRequires: clang-tools-extra
BuildRequires: cmake
BuildRequires: elfutils-libelf-devel
BuildRequires: perl
BuildRequires: perl-Data-Dumper
BuildRequires: perl-Encode
BuildRequires: libffi-devel
#BuildRequires: ninja-build
# libomptarget needs the llvm cmake files
BuildRequires: llvm-devel
Requires: elfutils-libelf%{?isa}
%description
OpenMP runtime for clang.
%package devel
Summary: OpenMP header files
Requires: %{name}%{?isa} = %{version}-%{release}
Requires: clang-resource-filesystem%{?isa} = %{version}
%description devel
OpenMP header files.
%prep
%autosetup -n %{libomp_srcdir} -p2
%build
mkdir build && cd build
# TODO: LIBOMP_HAVE_VERSION_SCRIPT_FLAG should be set automatically.
%cmake \
-DOPENMP_ENABLE_LIBOMPTARGET:BOOL=ON \
-DLIBOMP_INSTALL_ALIASES=OFF \
-DCMAKE_MODULE_PATH=%{_libdir}/cmake/llvm \
-DLLVM_DIR=%{_libdir}/cmake/llvm \
-DLIBOMPTARGET_LLVM_INCLUDE_DIRS=%{_includedir}/llvm \
-DCMAKE_INSTALL_PREFIX="/usr" \
-DCMAKE_INSTALL_DATADIR="%{_libdir}" \
%if 0%{?__isa_bits} == 64
-DOPENMP_LIBDIR_SUFFIX=64 \
%else
-DOPENMP_LIBDIR_SUFFIX= \
%endif
-DCMAKE_SKIP_RPATH:BOOL=ON \
-DLIBOMP_HAVE_VERSION_SCRIPT_FLAG:BOOL=ON \
..
%make_build
%install
%make_install -C build
mkdir -p %{buildroot}%{_datadir}/licenses/libomp/
cp LICENSE.txt %{buildroot}%{_datadir}/licenses/libomp/
%check
%make_build -C build check-openmp || echo "CHECK FAIL"
%files
%license LICENSE.txt
%{_libdir}/*.so
%files devel
%{_includedir}/omp.h
%{_includedir}/omp-tools.h
%{_includedir}/ompt.h
%{_includedir}/ompt-multiplex.h
%{_libdir}/*.a
%changelog
* Tue May 9 2023 will_niutao <niutao2@huawei.com> - 16.0.2-1
- Init for openEuler

BIN
openmp-12.0.1.src.tar.xz Normal file

Binary file not shown.