# On modern Fedora/RHEL, use Python 3 by default (and provide an IMP-python2 # subpackage; on RHEL 9 or later, use Python 3 only). # On older systems, the IMP package uses Python 2 only. %if 0%{?fedora} > 12 || 0%{?rhel} >= 8 %define with_python3 1 %define cmake_use_python2 off %define default_python python3 %else %define with_python3 0 %define cmake_use_python2 on %define default_python python2 %endif %if 0%{?rhel} >= 9 %define with_python2 0 %else %define with_python2 1 %endif # Old RHEL only has a python-devel package, but RHEL8 only has python2-devel %if 0%{?fedora} || 0%{?rhel} >= 8 %define PYTHON2 python2 %else %define PYTHON2 python %endif %define with_mpich 1 # Not yet functional %define with_openmpi 0 # Change '#' to '%' in the line below if you want to build to install # somewhere other than the default /usr #define _prefix /usr/local Name: IMP Version: 2.20.2 Release: 1%{?dist} License: LGPLv2+ and GPLv3 Summary: The Integrative Modeling Platform Group: Applications/Engineering Packager: Ben Webb URL: https://integrativemodeling.org/ Source0: imp-%{version}.tar.gz %if 0%{?with_python2} BuildRequires: %{PYTHON2}-devel >= 2.7 %endif %if 0%{?with_python3} BuildRequires: python3-devel, symlinks %endif BuildRequires: gcc-c++, hdf5-devel >= 1.8 %if 0%{?rhel} == 7 # The default SWIG package in RHEL7 is SWIG 2, but SWIG 3 is provided # (in the CentOS Extras repository) BuildRequires: swig3 >= 3.0 %else BuildRequires: swig >= 3.0 %endif BuildRequires: gsl-devel, fftw-devel BuildRequires: zlib-devel, perl, eigen3-devel, cereal-devel %if 0%{?fedora} || 0%{?rhel} <= 7 BuildRequires: ann-devel %endif # Needed to build the cnmultifit module; obtain # from https://integrativemodeling.org/libTAU.html # (Or, if you don't need cnmultifit, you can comment out this line) BuildRequires: libTAU-devel # Need for npctransport module BuildRequires: protobuf-devel # No Python protobuf package in RHEL8 %if 0%{?fedora} || 0%{?rhel} == 9 Requires: python3-protobuf %endif %if 0%{?rhel} == 7 Requires: protobuf-python %endif BuildRequires: cmake >= 2.8 BuildRequires: boost-devel >= 1.53 # RHEL doesn't have a CGAL package, so build without CGAL on RHEL. # RHEL 7 and 8 have OpenCV, but it was dropped in RHEL 9, so disable the em2d # module. %if 0%{?fedora} BuildRequires: CGAL-devel %endif %if 0%{?fedora} || (0%{?rhel} >= 7 && 0%{?rhel} <= 8) BuildRequires: opencv-devel %endif # If building in the Sali lab, pass '-D "RHEL_SALI_LAB 1"' to your rpmbuild # invocation. This will pull in our custom CGAL and OpenCV packages # and bundle the libraries with IMP. # If building outside of the lab and you still want these packages, get them # from https://integrativemodeling.org/build-extras/ %if 0%{?rhel} && 0%{?RHEL_SALI_LAB} %if 0%{?rhel} == 9 BuildRequires: opencv-nogui-devel %endif BuildRequires: CGAL-nogui-devel %if 0%{?rhel} == 9 %define bundled libcv\\.so\\|libcxcore\\.so\\|libhighgui.so\\|libTAU\\.so\\|libCGAL\\.so %else %define bundled libTAU\\.so\\|libCGAL\\.so %endif %else %define bundled libTAU\\.so %endif # The IMP kernel (both with Python 2 and Python3) links with numpy, so # pull that in if available (the Python 2 variant is no longer shipped # with modern Fedora). Many modules also use Python's scipy module, so # pull that in (at build time for tests; at install time for using the modules). %if 0%{?with_python3} BuildRequires: python3-numpy, python3-scipy Requires: python3-numpy, python3-scipy %if 0%{?with_python2} && (0%{?fedora} < 34 || 0%{?rhel}) BuildRequires: python2-numpy %endif %else BuildRequires: numpy, scipy Requires: numpy, scipy %endif %define cmake_opts -DCMAKE_INSTALL_RPATH=%{_libdir}/IMP # Use user-visible (not "platform") Python on RHEL8 %if 0%{?rhel} >= 8 %define __python3 /usr/bin/python3 %endif %define mpiprefix mpi/ # Don't build debug source packages; they cause the build to fail with # error: Empty %files file [...]/debugsourcefiles.list %if 0%{?fedora} > 26 || 0%{?rhel} >= 8 %undefine _debugsource_packages %endif %description IMP's broad goal is to contribute to a comprehensive structural characterization of biomolecules ranging in size and complexity from small peptides to large macromolecular assemblies. Detailed structural characterization of assemblies is generally impossible by any single existing experimental or computational method. This barrier can be overcome by hybrid approaches that integrate data from diverse biochemical and biophysical experiments (eg, x-ray crystallography, NMR spectroscopy, electron microscopy, immuno-electron microscopy, footprinting, chemical cross-linking, FRET spectroscopy, small angle X-ray scattering, immunoprecipitation, genetic interactions, etc...). We formulate the hybrid approach to structure determination as an optimization problem, the solution of which requires three main components: * the representation of the assembly, * the scoring function and * the optimization method. The ensemble of solutions to the optimization problem embodies the most accurate structural characterization given the available information. We created IMP, the Integrative Modeling Platform, to make it easier to implement such an integrative approach to structural and dynamics problems. IMP is designed to allow mixing and matching of existing modeling components as well as easy addition of new functionality. %package devel Group: Applications/Engineering Summary: Development package for IMP developers. Requires: %{name} = %{version}-%{release} Requires: gsl-devel, fftw-devel, zlib-devel, eigen3-devel, cereal-devel Requires: boost-devel, hdf5-devel, protobuf-devel %if 0%{?fedora} || 0%{?rhel} <= 7 Requires: ann-devel %endif %if 0%{?with_python3} Requires: python3-devel %else Requires: %{PYTHON2}-devel %endif %if 0%{?fedora} Requires: CGAL-devel %endif %if 0%{?fedora} || (0%{?rhel} >= 7 && 0%{?rhel} <= 8) Requires: opencv-devel %endif %description devel This package contains the include files for building applications that link against IMP. %if 0%{?with_python2} && 0%{?with_python3} %package python2 Group: Applications/Engineering Summary: Python wrappers for Python 2 Requires: %{name} = %{version}-%{release} Requires: python2 # No Python protobuf package in RHEL8 or Fedora 32 %if 0%{?fedora} > 0 && 0%{?fedora} < 32 Requires: python2-protobuf %endif %if 0%{?fedora} < 34 || 0%{?rhel} Requires: python2-numpy %endif %description python2 This package contains wrappers for Python 2 (the base package already includes Python 3 wrappers). %endif %define MPI_MODULES mpi spb %if 0%{?with_mpich} %package mpich Group: Applications/Engineering Summary: MPI module and dependents, for mpich Requires: %{name} = %{version}-%{release} Requires: mpich %if 0%{?fedora} || 0%{?rhel} >= 8 Requires: python3-mpich %endif BuildRequires: mpich-devel %description mpich This package contains an IMP.mpi module to add MPI support, using the mpich library. It also includes all IMP modules that depend on IMP.mpi (IMP.spb). %package mpich-devel Group: Applications/Engineering Summary: MPI module and dependents development files, for mpich Requires: %{name}-mpich = %{version}-%{release} Requires: mpich %description mpich-devel Development files for IMP.mpi module (and dependents) with mpich. %endif %if 0%{?with_openmpi} %package openmpi Group: Applications/Engineering Summary: MPI module and dependents, for openmpi Requires: %{name} = %{version}-%{release} Requires: openmpi %if 0%{?fedora} || 0%{?rhel} >= 8 Requires: python3-openmpi %endif BuildRequires: openmpi-devel %description openmpi This package contains an IMP.mpi module to add MPI support, using the openmpi library. It also includes all IMP modules that depend on IMP.mpi (IMP.spb). %package openmpi-devel Group: Applications/Engineering Summary: MPI module and dependents development files, for openmpi Requires: %{name}-openmpi = %{version}-%{release} Requires: openmpi %description openmpi-devel Development files for IMP.mpi module (and dependents) with openmpi. %endif %prep %setup -n imp-%{version} # Exclude bundled libraries from provides and requires %if 0%{?fedora} > 22 # In newer Fedora, the old script-based dependency generation doesn't play # nicely with the new mechanism for adding MPI dependencies # (rpm-mpi-hooks package) %if 0%{?with_mpich} || 0%{?with_openmpi} %global __provides_exclude ^libTAU\\.so.*|libimp_mpi\\.so.*|libimp_spb\\.so.*$ %global __requires_exclude ^libTAU\\.so.*|libmpi\\.so.*|libmpicxx\\.so.*|libimp_mpi\\.so.*|libimp_spb\\.so.*$ %else %global __provides_exclude ^libTAU\\.so.*$ %global __requires_exclude ^libTAU\\.so.*$ %endif %else %define reqprog %{_builddir}/find-requires-IMP %define proprog %{_builddir}/find-provides-IMP cat < %{reqprog} #!/bin/bash %if 0%{?rhel} >= 8 && (0%{?with_mpich} || 0%{?with_openmpi}) %{__find_requires} $@ | grep -v '%{bundled}\\|libmpi\\|libimp_mpi\\|libimp_spb' %else %{__find_requires} $@ | grep -v '%{bundled}' %endif exit $? EOF cat < %{proprog} #!/bin/bash %{__find_provides} $@ | grep -v '%{bundled}' exit $? EOF chmod a+x %{reqprog} chmod a+x %{proprog} %define _use_internal_dependency_generator 0 %define __find_requires %{reqprog} %define __find_provides %{proprog} %endif %build # For now, bundle RMF with IMP (long term, may be better to put in a separate # RPM) mkdir imp && mv * imp || : mkdir build && cd build %if 0%{?with_mpich} module load %{mpiprefix}mpich-%{_arch} %endif %if 0%{?fedora} >= 29 && 0%{?fedora} < 32 # Help cmake to find CGAL export CGAL_DIR=%{_libdir}/cmake/CGAL %endif %if 0%{?fedora} == 32 export CGAL_DIR=/usr/share/CGAL/cmake %endif %if 0%{?fedora} >= 33 export CGAL_DIR=/usr/share/cmake/CGAL %endif # Workaround gcc -frounding-math bug; see # https://bugzilla.redhat.com/show_bug.cgi?id=2085189 %if 0%{?fedora} >= 36 CXXFLAGS="$CXXFLAGS -std=c++20" %endif cmake ../imp -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_INSTALL_DOCDIR=%{_prefix}/share/doc/%{name}-%{version} \ -DIMP_TIMEOUT_FACTOR=4 -DUSE_PYTHON2=%{cmake_use_python2} \ -DIMP_DISABLED_MODULES=scratch %{cmake_opts} # Normally make will stop at the first error. Since an RPM cannot be built # if the build did not complete successfully, this is the default here too. # Pass '-D "keep_going 1"' to your rpmbuild invocation if you want it to # keep going; we use this in nightly builds to see every broken module, # not just the first one. %if 0%{?keep_going} mkdir logs %{default_python} ../imp/tools/nightly-tests/build_all.py --run-tests=fast --ctest="ctest --output-on-failure" --outdir=logs --summary=logs/summary.pck "make -k" %else make %endif %if 0%{?with_mpich} module purge %endif %install cd build make DESTDIR=${RPM_BUILD_ROOT} install %if 0%{?with_python2} && 0%{?with_python3} # Build Python 2 wrappers py2_ver=`python2 -c "import sys; print('%d.%d' % sys.version_info[:2])"` py3_ver=`python3 -c "import sys; print('%d.%d' % sys.version_info[:2])"` py2_lib=`echo %{_libdir}/libpython2.*.so` py2_inc=`echo /usr/include/python2.*` %if 0%{?with_mpich} module load %{mpiprefix}mpich-%{_arch} %endif cmake ../imp \ -DCMAKE_INSTALL_PREFIX=%{_prefix} \ -DCMAKE_INSTALL_PYTHONDIR=%{_libdir}/python${py2_ver}/site-packages \ -DSWIG_PYTHON_LIBRARIES=${py2_lib} \ -DPYTHON_INCLUDE_DIRS=${py2_inc} \ -DPYTHON_INCLUDE_PATH=${py2_inc} \ -DPYTHON_LIBRARIES=${py2_lib} -DUSE_PYTHON2=on make DESTDIR=${RPM_BUILD_ROOT} install %if 0%{?with_mpich} module purge %endif # Don't build Python 2 MPI for now for mod in %{MPI_MODULES}; do rm -rf ${RPM_BUILD_ROOT}%{_libdir}/python${py2_ver}/site-packages/IMP/${mod} rm -f ${RPM_BUILD_ROOT}%{_libdir}/python${py2_ver}/site-packages/_IMP_${mod}.so done # Replace .py files with symlinks to Python 3 files (since they are the same) # but not the SWIG-generated __init__.py files (since these contain config # information which might be different; e.g. on Fedora the Python 3 wrappers # include numpy support but the Python 2 wrappers do not) (cd ${RPM_BUILD_ROOT}%{_libdir}/python${py2_ver} \ && find site-packages -name '*.py' -a ! -name __init__.py \ -exec ln -sf ${RPM_BUILD_ROOT}%{_libdir}/python${py3_ver}/\{\} \{\} \; \ && symlinks -rc .) %endif # Put MPI-dependent libraries and binaries in mpich directories %if 0%{?with_mpich} (cd ${RPM_BUILD_ROOT}%{_libdir}/%{default_python}*/site-packages/ && mkdir mpich) (cd ${RPM_BUILD_ROOT}%{_libdir} && mkdir -p mpich/bin mpich/lib) (cd ${RPM_BUILD_ROOT}%{_bindir} && mv spb* ${RPM_BUILD_ROOT}%{_libdir}/mpich/bin) for mod in %{MPI_MODULES}; do (cd ${RPM_BUILD_ROOT}%{_libdir}/%{default_python}*/site-packages/ \ && mv _IMP_${mod}.so mpich/) (cd ${RPM_BUILD_ROOT}%{_libdir} && mv libimp_${mod}.so.* mpich/lib/) (cd ${RPM_BUILD_ROOT}%{_libdir} && rm libimp_${mod}.so \ && ln -sf mpich/lib/libimp_${mod}.so.* libimp_${mod}.so) done %endif # Note that we currently don't include the documentation in the RPM, since # a) it takes a long time to run doxygen # b) doxygen isn't installed on all of our build systems # c) it is really big # and d) only certain versions of doxygen work correctly # You can build the documentation by running "make IMP-doc" # on the IMP source code. README=${RPM_BUILD_ROOT}%{_prefix}/share/doc/%{name}-%{version}/README echo "For full IMP documentation, please go to" > ${README} # Direct nightly build users to most recent nightly build docs if echo ${version} | grep -q git; then echo "https://integrativemodeling.org/nightly/doc/manual/" >> ${README} else echo "https://integrativemodeling.org/%{version}/doc/manual/" >> ${README} fi # Bundle libTAU from build machine so users don't have to get it separately # (can't use %_libdir here since that is dependent on whatever we redefined # %_prefix to be, but dependent libraries are always in /usr) mkdir ${RPM_BUILD_ROOT}%{_libdir}/IMP cp /usr/%{_lib}/libTAU.so.1 ${RPM_BUILD_ROOT}%{_libdir}/IMP/ %if 0%{?rhel} && 0%{?RHEL_SALI_LAB} # Bundle CGAL (and potentially OpenCV) libraries %if 0%{?rhel} == 9 for cvlib in core imgproc highgui imgcodecs; do cp /usr/%{_lib}/libopencv_${cvlib}.so.4.5 ${RPM_BUILD_ROOT}%{_libdir}/IMP/ done %endif %if 0%{?rhel} >= 8 cp /usr/%{_lib}/libCGAL.so.13 ${RPM_BUILD_ROOT}%{_libdir}/IMP/ %else cp /usr/%{_lib}/libCGAL.so.10 ${RPM_BUILD_ROOT}%{_libdir}/IMP/ %endif %endif # Don't distribute example application or dependency rm -rf ${RPM_BUILD_ROOT}%{_prefix}/bin/imp_example_app \ ${RPM_BUILD_ROOT}%{_libdir}/libexample* \ ${RPM_BUILD_ROOT}%{_prefix}/include/example* # Make sure all Python applications and build tools use the same Python # we built with perl -pi -e 's@^#!.*python.*$@#!/usr/bin/%{default_python}@' ${RPM_BUILD_ROOT}%{_prefix}/bin/* find ${RPM_BUILD_ROOT}%{_prefix}/share/IMP/tools -name '*.py' -exec perl -pi -e 's#/usr/bin/env python\b#/usr/bin/env %{default_python}#' \{\} \; %files %defattr(-,root,root) %doc %{_prefix}/share/doc/%{name}-%{version} %{_prefix}/share/IMP %exclude %{_prefix}/share/IMP/tools %exclude %{_prefix}/share/IMP/swig %exclude %{_prefix}/share/IMP/build_info %{_prefix}/bin/* %{_libdir}/libimp*.so.* %{_libdir}/libRMF*.so.* %{_libdir}/IMP %{_libdir}/%{default_python}*/site-packages/IMP %{_libdir}/%{default_python}*/site-packages/_IMP*so %{_libdir}/%{default_python}*/site-packages/RMF* %{_libdir}/%{default_python}*/site-packages/_RMF*so %{_libdir}/%{default_python}*/site-packages/ihm %if 0%{?with_python3} %{_libdir}/python3*/site-packages/__pycache__ %endif %if 0%{?with_mpich} %exclude %{_prefix}/share/doc/%{name}-%{version}/examples/mpi %exclude %{_libdir}/%{default_python}*/site-packages/IMP/mpi %exclude %{_libdir}/%{default_python}*/site-packages/IMP/spb %endif %if 0%{?with_python2} && 0%{?with_python3} %files python2 %defattr(-,root,root) %{_libdir}/python2*/site-packages/IMP %{_libdir}/python2*/site-packages/_IMP*so %{_libdir}/python2*/site-packages/RMF* %{_libdir}/python2*/site-packages/_RMF*so %{_libdir}/python2*/site-packages/ihm %endif %if 0%{?with_mpich} %files mpich %defattr(-,root,root) %doc %{_prefix}/share/doc/%{name}-%{version}/examples/mpi %{_prefix}/share/IMP/swig/IMP_mpi.* %{_prefix}/share/IMP/swig/IMP_spb.* %{_prefix}/share/IMP/build_info/MPI %{_prefix}/share/IMP/build_info/IMP.mpi %{_prefix}/share/IMP/build_info/IMP_mpi.pck %{_prefix}/share/IMP/build_info/IMP.spb %{_prefix}/share/IMP/build_info/IMP_spb.pck %{_libdir}/%{default_python}*/site-packages/IMP/mpi %{_libdir}/%{default_python}*/site-packages/IMP/spb %{_libdir}/%{default_python}*/site-packages/mpich/_IMP_mpi.so %{_libdir}/%{default_python}*/site-packages/mpich/_IMP_spb.so %{_libdir}/mpich/lib/libimp_mpi.so.* %{_libdir}/mpich/lib/libimp_spb.so.* %{_libdir}/mpich/bin/spb* %files mpich-devel %defattr(-,root,root) %{_libdir}/libimp_mpi.so %{_libdir}/libimp_spb.so %{_prefix}/include/IMP/mpi %{_prefix}/include/IMP/spb %endif %files devel %defattr(-,root,root) %{_prefix}/share/IMP/tools %{_prefix}/share/IMP/swig %{_prefix}/share/IMP/build_info %if 0%{?with_mpich} %exclude %{_prefix}/share/IMP/swig/IMP_mpi.* %exclude %{_prefix}/share/IMP/swig/IMP_spb.* %exclude %{_prefix}/share/IMP/build_info/MPI %exclude %{_prefix}/share/IMP/build_info/IMP.mpi %exclude %{_prefix}/share/IMP/build_info/IMP_mpi.pck %exclude %{_prefix}/share/IMP/build_info/IMP.spb %exclude %{_prefix}/share/IMP/build_info/IMP_spb.pck %endif %{_prefix}/include/IMP %{_prefix}/include/IMP.h %{_prefix}/include/RMF %{_prefix}/include/RMF.h %{_libdir}/libimp*.so %{_libdir}/libRMF*.so %{_libdir}/cmake/IMP %if 0%{?with_mpich} %exclude %{_prefix}/include/IMP/mpi %exclude %{_prefix}/include/IMP/spb %exclude %{_libdir}/libimp_mpi.so %exclude %{_libdir}/libimp_spb.so %endif %changelog * Thu Apr 04 2024 Ben Webb 2.20.2-1 - 2.20.2 release. * Tue Jan 16 2024 Ben Webb 2.20.1-1 - 2.20.1 release. * Thu Dec 21 2023 Ben Webb 2.20.0-1 - 2.20.0 release. * Thu Jun 22 2023 Ben Webb 2.19.0-1 - 2.19.0 release. * Thu Dec 15 2022 Ben Webb 2.18.0-1 - 2.18.0 release. * Thu Jun 23 2022 Ben Webb 2.17.0-1 - 2.17.0 release. * Thu Dec 16 2021 Ben Webb 2.16.0-1 - 2.16.0 release. * Wed Jun 02 2021 Ben Webb 2.15.0-1 - 2.15.0 release. * Wed Dec 02 2020 Ben Webb 2.14.0-1 - 2.14.0 release. * Thu May 14 2020 Ben Webb 2.13.0-1 - 2.13.0 release. * Fri Dec 06 2019 Ben Webb 2.12.0-1 - 2.12.0 release. * Thu Jul 18 2019 Ben Webb 2.11.1-1 - 2.11.1 release. * Tue Jun 25 2019 Ben Webb 2.11.0-1 - 2.11.0 release. * Tue Feb 26 2019 Ben Webb 2.10.1-1 - 2.10.1 release. * Tue Jan 08 2019 Ben Webb 2.10.0-1 - 2.10.0 release. * Mon Jul 02 2018 Ben Webb 2.9.0-1 - 2.9.0 release. * Wed Aug 16 2017 Ben Webb 2.8.0-1 - 2.8.0 release. * Thu Apr 13 2017 Ben Webb 2.7.0-1 - 2.7.0 release. * Wed May 25 2016 Ben Webb 2.6.2-1 - 2.6.2 release. * Thu Apr 14 2016 Ben Webb 2.6.1-1 - 2.6.1 release. * Mon Mar 28 2016 Ben Webb 2.6.0-1 - 2.6.0 release. * Tue Jun 30 2015 Ben Webb 2.5.0-1 - 2.5.0 release. * Fri Feb 27 2015 Ben Webb 2.4.0-1 - 2.4.0 release. * Tue Dec 09 2014 Ben Webb 2.3.1-1 - 2.3.1 release. * Fri Oct 24 2014 Ben Webb 2.3.0-1 - 2.3.0 release. * Mon Aug 11 2014 Ben Webb 2.2.1-1 - 2.2.1 release. * Wed Apr 09 2014 Ben Webb 2.2.0-1 - 2.2.0 release. * Mon Nov 04 2013 Ben Webb 2.1.1-1 - 2.1.1 release. * Thu Oct 24 2013 Ben Webb 2.1.0-1 - 2.1.0 release. * Thu May 02 2013 Ben Webb 2.0.1-1 - 2.0.1 release. * Mon Apr 29 2013 Ben Webb 2.0.0-1 - 2.0.0 release. * Mon Mar 08 2010 Ben Webb 1.0-1 - 1.0 release. * Thu May 07 2009 Ben Webb - Initial build.