diff --git a/libomp.spec b/libomp.spec new file mode 100644 index 0000000000000000000000000000000000000000..2f4bd8de722891166290a682c9dd25f4c1d9930b --- /dev/null +++ b/libomp.spec @@ -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 - 16.0.2-1 +- Init for openEuler + diff --git a/openmp-12.0.1.src.tar.xz b/openmp-12.0.1.src.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..e27e9ba111ed48a6271b12171d693ede722ad29f Binary files /dev/null and b/openmp-12.0.1.src.tar.xz differ