File root.spec of Package root
%define debug_package %{nil}
%global __builder ninja
%global __builddir %{name}_build
%define inst_dir /opt/%{name}
%define rolling_version %(grep version %{_sourcedir}/root.obsinfo | cut -f2 -d':' | sed "s| ||g")
%define gcc_version 9
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse}
%define pythons python3
%define fixed_version 6.30.08
%else
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
%{?sle15_python_module_pythons}
%else
%define pythons %{primary_python}
%define _lto_cflags %{nil}
%endif
%endif
Name: root
Version: %{?fixed_version:%{fixed_version}}%{!?fixed_version:%{rolling_version}}
Release: 0
Summary: Numerical data analysis framework (OO)
License: LGPL-2.1+
Group: Productivity/Scientific/Physics
Url: https://root.cern.ch/download
Source0: %{name}%{?fixed_version:-fixed}.tar.gz
Source1: %{name}-rpmlintrc
Source2: root_build_options
BuildRequires: cmake
BuildRequires: ninja
BuildRequires: ( gcc-c++ >= %{gcc_version} or gcc%{gcc_version}-c++ )
BuildRequires: ( gcc-fortran >= %{gcc_version} or gcc%{gcc_version}-fortran )
BuildRequires: fdupes
BuildRequires: freetype2-devel
BuildRequires: libX11-devel
BuildRequires: libXpm-devel
BuildRequires: libXft-devel
BuildRequires: libXext-devel
BuildRequires: giflib-devel
BuildRequires: libtiff-devel
BuildRequires: libpng16-devel
BuildRequires: libjpeg62-devel
BuildRequires: gsl-devel
BuildRequires: glu-devel
BuildRequires: graphviz-devel
BuildRequires: libxml++-devel
BuildRequires: fftw3-devel
BuildRequires: cfitsio-devel
BuildRequires: liburing2-devel
BuildRequires: nlohmann_json-devel
BuildRequires: zlib-devel
BuildRequires: freetype2-devel
BuildRequires: pcre2-devel
BuildRequires: liblz4-devel
BuildRequires: glew-devel
BuildRequires: gl2ps-devel
BuildRequires: ftgl-devel
BuildRequires: mpich-devel
BuildRequires: ( tbb-devel >= %{?fixed_version:2018}%{!?fixed_version:2020} )
BuildRequires: python-rpm-macros
BuildRequires: %{pythons}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module devel}
BuildRequires: %{python_module numpy-devel}
%if 0%{?sle_version} != 150500 && 0%{?is_opensuse}
BuildRequires: xxhash-devel
%endif
Requires: %{pythons}
Requires: %{python_module numpy}
%description
The ROOT system provides a set of OO frameworks with all the functionality needed to handle and analyze large amounts of data efficiently.
With the data defined as a set of objects, specialized storage methods can give direct access to the separate attributes of the selected objects, without having to touch the bulk of the data. Included are histogramming methods in 1, 2 and 3 dimensions, curve fitting, function evaluation, minimization, graphics and visualization classes to allow the easy creation of an analysis system that can query and process the data interactively or in batch mode.
The command language, the scripting (or macro) language, and the programming language are all C++, thanks to the built-in CINT C++ interpreter. This interpreter removes the time consuming compile/link cycle, allowing for fast prototyping of the macros, and providing a good environment to learn C++. If more performance is needed, the interactively developed macros can be compiled using a C++ compiler.
The system has been designed in such a way that it can query its databases in parallel on MPP machines or on clusters of workstations or high-end PCs. ROOT is an open system that can be dynamically extended by linking external libraries. This makes ROOT a premier platform on which to build data acquisition, simulation and data analysis systems.
%prep
%setup -q -n %{name}%{?fixed_version:-fixed}
find . -name "*~" -exec rm -rf {} \;
find . -size 0 -exec rm -rf {} \;
%build
%python_expand export PYTHON_INSTALL_DIR="%{$python_sitearch}"
[ -d _build.tmp ] && mv _build.tmp build
%cmake $(cat %{SOURCE2}) \
-DCMAKE_C_COMPILER="$([ `command -v gcc-%{gcc_version}` ] && echo gcc-%{gcc_version} || echo gcc )" \
-DCMAKE_CXX_COMPILER="$([ `command -v g++-%{gcc_version}` ] && echo g++-%{gcc_version} || echo g++ )" \
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse}
-Dbuiltin_xxhash=ON \
-Dbuiltin_zstd=ON \
-DCMAKE_INSTALL_DOCDIR=%{_datadir}/%{name} \
-Dbuiltin_afterimage=ON \
%endif
-DCMAKE_INSTALL_SYSCONFDIR=%{_prefix}%{_sysconfdir}/%{name} \
-DCMAKE_INSTALL_PYTHONDIR=${PYTHON_INSTALL_DIR} \
%{nil}
%cmake_build
%install
%cmake_install
mv %{buildroot}/%{_bindir} ./tmp_bin
%fdupes -s %{buildroot}/usr
mv ./tmp_bin %{buildroot}/%{_bindir}
sed -i "s|#!%{_bindir}/env bash|#!/bin/bash|" %{buildroot}/%{_bindir}/{root-config,rootssh}
sed -i "1s|#\\!.*python\\S*|#\\!%{_bindir}/python%{python_version}|" %{buildroot}/%{_bindir}/{rootbrowse,rootcp,rootdrawtree,rooteventselector,rootls,rootmkdir,rootmv,rootprint,rootrm,rootslimtree}
find %{buildroot}/usr -iname parallelMergeTest.sh -exec chmod 755 {} \;
for changeFile in `find %{buildroot}/usr -iname *.py -exec grep -l usr.*python {} \;` ; do chmod 755 ${changeFile} && sed -i "s|#!.*%{_bindir}/python.*|#!%{_bindir}/python%{python_version}|" ${changeFile} ; done
for changeFile in `find %{buildroot}/usr -iname *.py -exec grep -l env.*python {} \;` ; do chmod 755 ${changeFile} && sed -i "s|#!.*%{_bindir}/env.*python.*|#!%{_bindir}/python%{python_version}|" ${changeFile} ; done
%post
if [[ $(ls %{_bindir}/this%{name}.sh 2>/dev/null) && ! $(grep source /etc/bash.bashrc.local | grep this%{name}.sh) ]] ; then echo 'source %{_bindir}/this%{name}.sh' >> /etc/bash.bashrc.local ; fi
%postun
if [[ ! $(ls %{_bindir}/this%{name}.sh 2>/dev/null) && $(grep source /etc/bash.bashrc.local | grep this%{name}.sh) ]] ; then sed -i '\_source %{_bindir}/this%{name}.sh_d' /etc/bash.bashrc.local ; fi
%files
%{_bindir}/*
%{_libdir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/man/man1/*
%dir %{_prefix}%{_sysconfdir}
%dir %{_prefix}%{_sysconfdir}/%{name}
%{_prefix}%{_sysconfdir}/%{name}/*
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse}
%dir %{_includedir}/%{name}
%{_includedir}/%{name}/*
%else
%{_includedir}/*
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/*
/usr/lib/*
%endif
%changelog