%global lockver 1 %global pkgvers 0 %global scdate0 20221210 %global schash0 27a6ea008c3ccc915698df88b735c59309a382f2 %global branch0 master %global source0 https://github.com/trilinos/Trilinos.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %define use_py3 1 %define targets native;openmpi;mpich Name: trilinos Version: 13.4.1 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: Trilinos Project is an effort to develop algorithms License: LGPL and BSD Patch0: trilionos-fix.patch URL: http://trilinos.org BuildRequires: git cmake perl-interpreter python3 gcc-c++ gcc-gfortran BuildRequires: doxygen pkgconfig libX11-devel zlib-devel glibc-devel netcdf-devel BuildRequires: glm-devel hdf5-devel blas-devel lapack-devel eigen3-devel boost-devel BuildRequires: suitesparse-devel SuperLU-devel hwloc-devel yaml-cpp-devel BuildRequires: environment-modules %if ! (0%{?rhel} == 9) BuildRequires: SuperLUMT-devel matio-devel scotch-devel MUMPS-devel %endif %if %{use_py3} BuildRequires: python3-devel python3-numpy swig %endif %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("BuildRequires: "..target.."-devel\n") print("BuildRequires: hdf5-"..target.."-devel\n") print("BuildRequires: scalapack-"..target.."-devel\n") end end} %if ! (0%{?rhel} == 9) %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("BuildRequires: MUMPS-"..target.."-devel\n") print("BuildRequires: hypre-"..target.."-devel\n") print("BuildRequires: ptscotch-"..target.."-devel\n") end end} %endif Requires: environment-modules %ifarch ppc64le %if 0%{?rhel} == 9 %global _lto_cflags %{nil} %endif %endif %global debug_package %{nil} %undefine _hardened_build %undefine _annotated_build %global __cmake_in_source_build 1 # bug: missing exports from openmpu %global __requires_exclude ^libopen-rte\\.so.*$ %description The Trilinos Project is an effort to develop algorithms and enabling technologies within an object-oriented software framework for the solution of large-scale, complex multi-physics engineering and scientific problems. A unique design feature of Trilinos is its focus on packages. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package static Summary: Static libs for %{name} Requires: %{name}-devel = %{version}-%{release} %description static This package contains static libraries for %{name}. %if %{use_py3} %package python3 Summary: Python extension for %{name} Requires: %{name} = %{version}-%{release} %description python3 This package contains python extension for %{name}. %endif %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("%package "..target.."\n") print("Summary: Trilions package for "..target.."\n") print("Requires: environment-modules\n") print("Requires: "..target.."\n") print("%description "..target.."\n") print("Trilinos library for collection "..target.."\n") print("%package "..target.."-devel\n") print("Summary: Trilions package for "..target.."\n") print("Requires: "..target.."-devel\n") print("Requires: trilinos-"..target.." = "..rpm.expand("%{version}-%{release}").."\n") print("%description "..target.."-devel\n") print("Trilinos library for collection "..target.."\n") print("%package "..target.."-static\n") print("Summary: Trilions package for "..target.."\n") print("Requires: trilinos-"..target.."-devel = "..rpm.expand("%{version}-%{release}").."\n") print("%description "..target.."-static\n") print("Trilinos library for collection "..target.."\n") print("\n") end end } %prep %setup -T -c -n %{name} git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller %patch0 -p1 -b .fixes~ # fix python path sed -i 's|/lib/python|/%{_lib}/python|g' packages/PyTrilinos/src/CMakeLists.txt sed -i "s|sys.version\[\:3\]|'%{python3_version}'|g" packages/PyTrilinos/src/CMakeLists.txt # fix install paths sed -i 's|TRIBITS_USE_GNUINSTALLDIRS FALSE|TRIBITS_USE_GNUINSTALLDIRS TRUE|g' \ cmake/tribits/core/package_arch/TribitsGlobalMacros.cmake # fix SuperLUMT headers sed -i 's|pssp_defs.h|slu_mt_sdefs.h|' packages/amesos2/src/Amesos2_Superlumt_FunctionMap.hpp sed -i 's|pdsp_defs.h|slu_mt_ddefs.h|' packages/amesos2/src/Amesos2_Superlumt_FunctionMap.hpp sed -i 's|pcsp_defs.h|slu_mt_cdefs.h|' packages/amesos2/src/Amesos2_Superlumt_FunctionMap.hpp sed -i 's|pzsp_defs.h|slu_mt_zdefs.h|' packages/amesos2/src/Amesos2_Superlumt_FunctionMap.hpp # fix const %if 0%{?fedora} > 36 sed -i '/const int NC_SZIP_NN = 32/d' packages/seacas/libraries/exodus/src/ex_utils.c %endif %build # compiler flags %global optflags %(echo "%{optflags} -fPIC -w" | sed -e 's|-Werror=format-security||' -e 's|-g||') for target in $(echo "%{targets}" | sed 's|;| |g'); do echo "Building for [$target]" module -f purge cargs="" case $target in native) export CFLAGS="%{optflags}" export CXXFLAGS="%{optflags}" cargs+=" -DCMAKE_INSTALL_BINDIR=%{_bindir}" cargs+=" -DCMAKE_INSTALL_LIBDIR=%{_libdir}" cargs+=" -DCMAKE_INSTALL_INCLUDEDIR=include/%{name}" cargs+=" -DTPL_ENABLE_MPI=OFF" cargs+=" -DAmesos_ENABLE_MUMPS=OFF" %if %{use_py3} cargs+=" -DTrilinos_ENABLE_PyTrilinos=ON" %else cargs+=" -DTrilinos_ENABLE_PyTrilinos=OFF" %endif cargs+=" -DHDF5_INCLUDE_DIRS=%{_includedir}" cargs+=" -DHDF5_LIBRARY_DIRS=%{_libdir}" cargs+=" -DMUMPS_INCLUDE_DIRS=%{_includedir}/MUMPS" cargs+=" -DMUMPS_LIBRARY_DIRS=%{_libdir}" cargs+=" -DScotch_INCLUDE_DIRS=%{_includedir}/$target-%{_arch}" cargs+=" -DScotch_LIBRARY_DIRS=%{_libdir}" ;; openmpi | mpich) case $target in mpich) module load mpi/mpich-%{_arch} export LDFLAGS="$(pkgconf --libs mpich)" ;; openmpi) module load mpi/openmpi-%{_arch} export LDFLAGS="$(pkgconf --libs ompi ompi-cxx ompi-f77 ompi-f90 ompi-fort ompi orte)" ;; esac export CFLAGS="%{optflags} -I%{_includedir}/$target-%{_arch}" export CXXFLAGS="%{optflags} -I%{_includedir}/$target-%{_arch}" cargs+=" -DCMAKE_INSTALL_BINDIR=%{_libdir}/$target/bin" cargs+=" -DCMAKE_INSTALL_LIBDIR=%{_libdir}/$target/lib" cargs+=" -DCMAKE_INSTALL_INCLUDEDIR=include/$target-%{_arch}/%{name}" cargs+=" -DTPL_ENABLE_MPI=ON" %if ! (0%{?rhel} == 9) cargs+=" -DTPL_ENABLE_HYPRE=ON" %else cargs+=" -DTPL_ENABLE_HYPRE=OFF" %endif cargs+=" -DTPL_ENABLE_SCALAPACK=ON" cargs+=" -DTrilinos_ENABLE_PyTrilinos=OFF" cargs+=" -DTrilinos_ENABLE_ShyLU=ON" cargs+=" -DTrilinos_ENABLE_ShyLU_NodeBasker=ON" cargs+=" -DIfpack_ENABLE_HYPRE=OFF" cargs+=" -DEpetraExt_ENABLE_HYPRE=OFF" cargs+=" -DIfpack2_ENABLE_HYPRE=OFF" cargs+=" -DHDF5_INCLUDE_DIRS=%{_includedir}/$target-%{_arch}" cargs+=" -DHDF5_LIBRARY_DIRS=%{_libdir}/$target/lib" cargs+=" -DMUMPS_INCLUDE_DIRS=%{_includedir}/$target-%{_arch}" cargs+=" -DMUMPS_LIBRARY_DIRS=%{_libdir}/$target/lib" cargs+=" -DScotch_INCLUDE_DIRS=%{_includedir}/$target-%{_arch}" cargs+=" -DScotch_LIBRARY_DIRS=%{_libdir}/$target/lib" cargs+=" -DHYPRE_INCLUDE_DIRS=%{_includedir}/$target-%{_arch}/hypre" cargs+=" -DHYPRE_LIBRARY_DIRS=%{_libdir}/$target/lib" cargs+=" -DSCALAPACK_LIBRARY_NAMES=scalapack" cargs+=" -DSCALAPACK_LIBRARY_DIRS=%{_libdir}/$target/lib" ;; esac mkdir -p build-$target pushd build-$target %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_STANDARD=17 \ -DCMAKE_CXX_EXTENSIONS=ON \ -DPYTHON_EXECUTABLE=%{python3} \ -DTPL_ENABLE_HDF5=ON \ -DTPL_ENABLE_AMD=ON \ -DTPL_AMD_LIBRARY_DIRS=%{_libdir} \ -DTPL_AMD_INCLUDE_DIRS=%{_includedir}/suitesparse \ -DTPL_ENABLE_MKL=OFF \ -DTPL_ENABLE_Eigen=ON \ -DTPL_ENABLE_BLAS=ON \ -DTPL_ENABLE_LAPACK=ON \ -DTPL_ENABLE_Netcdf=ON \ -DTPL_ENABLE_UMFPACK=ON \ -DUMFPACK_INCLUDE_DIRS=%{_includedir}/suitesparse \ -DTPL_Eigen_INCLUDE_DIRS=%{_includedir}/eigen3 \ -DTPL_ENABLE_yaml-cpp=ON \ -DTPL_ENABLE_Boost=ON \ -DTPL_ENABLE_Pthread=ON \ -DTPL_ENABLE_CppUnit=OFF \ -DTPL_ENABLE_Zlib=ON \ -DTPL_ENABLE_QT=OFF \ %if ! (0%{?rhel} == 9) -DTPL_ENABLE_Matio=ON \ %else -DTPL_ENABLE_Matio=OFF \ %endif -DTPL_ENABLE_GLM=ON \ -DTPL_ENABLE_SuperLU=ON \ -DSuperLU_INCLUDE_DIRS=%{_includedir}/SuperLU \ -DAmesos2_ENABLE_SuperLU=OFF \ -DTPL_ENABLE_SuperLUMT=ON \ -DTPL_SuperLUMT_LIBRARIES="superlumt_s;superlumt_d;superlumt_c;superlumt_z" \ -DTPL_SuperLUMT_INCLUDE_DIRS=%{_includedir}/SuperLUMT \ -DAmesos2_ENABLE_SuperLUMT=OFF \ %if ! (0%{?rhel} == 9) -DTPL_ENABLE_MUMPS=ON \ -DTPL_ENABLE_Scotch=ON \ %else -DTPL_ENABLE_MUMPS=OFF \ -DTPL_ENABLE_Scotch=OFF \ %endif -DML_ENABLE_SuperLU=OFF \ -DTrilinos_ENABLE_Gtest=OFF \ -DTrilinos_ENABLE_OpenMP=ON \ -DTrilinos_ENABLE_TESTS=OFF \ -DTrilinos_ENABLE_FLOAT=ON \ -DTrilinos_ENABLE_COMPLEX=ON \ -DTrilinos_ENABLE_CXX11=ON \ -DTrilinos_ENABLE_ALL_PACKAGES=ON \ -DTrilinos_ENABLE_NOX=ON \ -DNOX_ENABLE_LOCA=ON \ -DTrilinos_ENABLE_EpetraExt=ON \ -DEpetraExt_BUILD_BTF=ON \ -DEpetraExt_BUILD_EXPERIMENTAL=ON \ -DEpetraExt_BUILD_GRAPH_REORDERINGS=ON \ -DTrilinos_ENABLE_TrilinosCouplings=ON \ -DTrilinos_ENABLE_Ifpack=ON \ -DTrilinos_ENABLE_AztecOO=ON \ -DTrilinos_ENABLE_Belos=ON \ -DTrilinos_ENABLE_Teuchos=ON \ -DTeuchos_ENABLE_COMPLEX=ON \ -DTrilinos_ENABLE_Tpetra=ON \ -DTpetra_INST_INT_INT=ON \ -DTrilinos_ENABLE_Amesos=ON \ -DAmesos_ENABLE_KLU=ON \ -DTrilinos_ENABLE_Amesos2=ON \ -DAmesos2_ENABLE_KLU2=ON \ -DAmesos2_ENABLE_Basker=ON \ -DAmesos2_ENABLE_MUMPS=OFF \ -DTrilinos_ENABLE_Sacado=ON \ -DTrilinos_ENABLE_Stokhos=ON \ -DTrilinos_ENABLE_Kokkos=ON \ $cargs make %{_smp_mflags} popd done # build docs #perl doc/build_docs.pl %install for target in $(echo "%{targets}" | sed 's|;| |g'); do echo "Installing for [$target]" pushd build-$target %cmake_install popd case $target in native) # proper cmake path mv -f %{buildroot}%{_libdir}/external_packages \ %{buildroot}%{_libdir}/cmake/Trilinos/ # install missings install -m644 packages/stokhos/src/sacado/kokkos/Stokhos_StorageHelpers.hpp \ %{buildroot}%{_includedir}/%{name} ;; openmpi | mpich) # proper cmake path mv -f %{buildroot}%{_libdir}/$target/lib/external_packages \ %{buildroot}%{_libdir}/$target/lib/cmake/Trilinos/ # install missings install -m644 packages/stokhos/src/sacado/kokkos/Stokhos_StorageHelpers.hpp \ %{buildroot}%{_includedir}/$target-%{_arch}/%{name} ;; esac done # prope cmake lookup find %{buildroot}%{_libdir} -name '*.cmake' \ -exec sed -i 's|/../../external_packages|/../Trilinos/external_packages|g' {} + # proper shebangs find %{buildroot} -name '*.py' -exec sed 's|.*env python.*|#!%{python3}|' -i {} + # exo wrappers mv -f %{buildroot}/usr/lib/exo* %{buildroot}/%{_bindir} # cleanup rm -rf %{buildroot}/usr/lib/tests find %{buildroot} -name "TrilinosRepoVersion.txt" -exec rm -rf {} + find %{buildroot}%{_includedir} -name "TrilinosConfig.cmake" -exec rm -rf {} + # strip elf set +x find %{buildroot} -type f -print | LC_ALL=C sort | file -N -f - | sed -n -e 's/^\(.*\):[ \t]*.*ELF.*, not stripped.*/\1/p' | xargs --no-run-if-empty stat -c '%h %D_%i %n' | while read nlinks inum f; do echo "Stripping: $f" strip -s $f done set -x %files %license LICENSE %license Copyright.txt %doc README %doc README.md %{_bindir}/* %{_libdir}/*.so.* %files devel %{_includedir}/* %{_libdir}/*.so %{_libdir}/cmake %files static %{_libdir}/*.a %if %{use_py3} %files python3 %{python3_sitearch}/* %endif %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("%files "..target.."\n") print("/%{_libdir}/"..target.."/bin/*\n") print("/%{_libdir}/"..target.."/lib/*.so.*\n") print("%files "..target.."-devel\n") print("/%{_libdir}/"..target.."/lib/*.so\n") print("/%{_libdir}/"..target.."/lib/cmake\n") print("/%{_includedir}/"..target.."-%{_arch}/*\n") print("%files "..target.."-static\n") print("/%{_libdir}/"..target.."/lib/*.a\n") print("\n") end end } %changelog * Fri May 06 2022 Cristian Balint - github update releases