%global pkgvers 0 %global scdate0 20230607 %global schash0 28d88037d5a6d77a793dfbc19b27d9cd5f8500e6 %global branch0 master %global source0 https://github.com/Xyce/Xyce.git %global sshort0 %{expand:%%{lua:print(('%{schash0}'):sub(1,8))}} %define targets native;openmpi;mpich # % define targets native Name: xyce Version: 7.6.0 Release: %{scdate0}.%{pkgvers}.git%{sshort0}%{?dist} Summary: The Xyce Parallel Electronic Simulator License: GPLv3 URL: https://github.com/Xyce/Xyce BuildRequires: gcc-c++ cmake git flex bison doxygen graphviz pkgconf-pkg-config BuildRequires: python3-devel pybind11-devel trilinos-devel fftw-devel mot-adms BuildRequires: netcdf-devel boost-devel glm-devel hdf5-devel blas-devel BuildRequires: lapack-devel eigen3-devel suitesparse-devel SuperLU-devel BuildRequires: environment-modules zlib-devel hwloc-devel yaml-cpp-devel %if ! (0%{?rhel} == 9) BuildRequires: matio-devel SuperLUMT-devel scotch-devel %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") print("BuildRequires: trilinos-"..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 Xyce is an open source, SPICE-compatible, high-performance analog circuit simulator, capable of solving extremely large circuit problems by supporting large-scale parallel computing platforms. %package devel Summary: Development files for %{name} Requires: %{name} = %{version}-%{release} %description devel This package contains development files for %{name}. %package python3 Summary: Python extension for %{name} Requires: %{name} = %{version}-%{release} %description python3 This package contains python extension for %{name}. %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("%package "..target.."\n") print("Summary: Xyce package for "..target.."\n") print("Requires: environment-modules\n") print("Requires: "..target.."\n") print("%description "..target.."\n") print("Xyce library for collection "..target.."\n") print("%package "..target.."-devel\n") print("Summary: Xyce package for "..target.."\n") print("Requires: "..target.."-devel\n") print("Requires: xyce-"..target.." = "..rpm.expand("%{version}-%{release}").."\n") print("%description "..target.."-devel\n") print("Xyce library for collection "..target.."\n") print("\n") end end } %prep %setup -T -c -n %{name} rm -rf %{_builddir}/%{name}/* git clone --depth 1 -n -b %{branch0} %{source0} . git fetch --depth 1 origin %{schash0} git reset --hard %{schash0} git log --format=fuller # no forced rebuilds sed -i '/add_dependencies(XyceLib TimeStampHeader)/d' src/UtilityPKG/CMakeLists.txt %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 purge cargs="" case $target in native) export CFLAGS="%{optflags} -I%{_includedir}/trilinos" export CXXFLAGS="%{optflags} -I%{_includedir}/trilinos" cargs+=" -DTrilinos_DIR=%{_libdir}/cmake/Trilinos" cargs+=" -DCMAKE_INSTALL_PREFIX=%{_prefix}" cargs+=" -DXyce_PYMI=ON" cargs+=" -DXyce_TEST_BINARIES=ON" ;; 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+=" -DTrilinos_DIR=%{_libdir}/$target/lib/cmake/Trilinos" cargs+=" -DCMAKE_INSTALL_PREFIX=%{_libdir}/$target" cargs+=" -DXyce_PYMI=OFF" cargs+=" -DXyce_TEST_BINARIES=OFF" cargs+=" -DXyce_PARALLEL_MPI=ON" ;; esac mkdir -p build-$target pushd build-$target %cmake .. -Wno-dev \ -DCMAKE_SKIP_RPATH=ON \ -DCMAKE_VERBOSE_MAKEFILE=OFF \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_PREFIX_PATH=%{_libdir}/cmake/Trilinos \ -DXyce_SHYLU=ON \ -DXyce_PLUGIN_SUPPORT=ON \ -DXyce_AMESOS2_SHYLUBASKER=ON \ $cargs if ! [ -f src/UtilityPKG/timestamp.h ] then make TimeStampHeader else echo "-- Header [timestamp.h] already generated." fi make %{?_smp_mflags} popd done %install for target in $(echo "%{targets}" | sed 's|;| |g'); do echo "Installing for [$target]" pushd build-$target case $target in native) %cmake_install # fix paths rename lib %{_lib} %{buildroot}/usr/lib mkdir -p %{buildroot}/%{python3_sitelib} mv -f %{buildroot}/%{_includedir}/pymi \ %{buildroot}/%{python3_sitelib}/ mkdir -p %{buildroot}/%{_includedir}/%{name} mv -f %{buildroot}/%{_includedir}/*.* \ %{buildroot}/%{_includedir}/%{name}/ # clean spurious rm -rf %{buildroot}/%{_bindir}/*.sh rm -rf %{buildroot}/usr/doc/README.TXT rm -rf %{buildroot}/%{_datadir}/examples ;; openmpi | mpich) %cmake_install # fix paths mkdir -p %{buildroot}%{_includedir}/$target-%{_arch} mv -f %{buildroot}%{_libdir}/$target/include \ %{buildroot}%{_includedir}/$target-%{_arch}/%{name} # clean spurious rm -rf %{buildroot}%{_libdir}/$target/doc rm -rf %{buildroot}%{_libdir}/$target/share ;; esac popd done # 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 COPYING %doc README.md %doc utils/ADMS/examples/toys %{_bindir}/Xyce %{_datadir}/* %{_libdir}/*.so %files devel %{_includedir}/* %{_libdir}/cmake/* %files python3 %{_bindir}/admsXml %{_bindir}/Xyce-PyMi %{python3_sitelib}/* %{lua: for target in string.gmatch(rpm.expand("%{targets}"), "[%w_-]+") do if not (target == "native") then print("%files "..target.."\n") print("/%{_libdir}/"..target.."/*\n") print("%files "..target.."-devel\n") print("/%{_includedir}/"..target.."-%{_arch}/*\n") print("\n") end end } %changelog * Fri May 06 2022 Cristian Balint - github update releases