051cb92
%bcond_without vtk
051cb92
%bcond_without python
051cb92
%bcond_without hdf5
051cb92
%bcond_without matio
051cb92
%bcond_with cgal
051cb92
279fe24
%bcond_without doc
051cb92
%bcond_without check
051cb92
8d74894
#%%global commit ee565c437650f11786f336a1f620474d31e64018
8d74894
#%%global date 20180323
8d74894
#%%global shortcommit %%(c=%%{commit}; echo ${c:0:7})
051cb92
8d74894
%global relsuf rc4
051cb92
051cb92
Name:    openmeeg
051cb92
Version: 2.4
8d74894
Release: 0.3.%{relsuf}%{?dist}
051cb92
Summary: Low-frequency bio-electromagnetism solving forward problems in the field of EEG and MEG
051cb92
License: CeCILL-B
051cb92
URL:     http://openmeeg.github.io/
279fe24
Source0: https://github.com/openmeeg/openmeeg/archive/%{version}-%{relsuf}.tar.gz#/%{name}-%{version}-%{relsuf}.tar.gz
051cb92
051cb92
# Do not require lapacke library
051cb92
Patch0: openmeeg-openblas_libraries.patch
051cb92
051cb92
# Set private directory for Python files
051cb92
Patch1: openmeeg-python_install_destination.patch
051cb92
279fe24
%if 0%{?rhel}
279fe24
BuildRequires: cmake3, epel-rpm-macros
279fe24
%else
279fe24
BuildRequires: cmake
279fe24
%global cmake3 %cmake
279fe24
%endif
279fe24
BuildRequires: gcc-c++, git, chrpath
051cb92
BuildRequires: gnuplot, wget, graphviz
051cb92
BuildRequires: expat-devel
051cb92
BuildRequires: openblas-devel
279fe24
%{?fedora:BuildRequires: gifticlib-devel}
279fe24
%{?fedora:BuildRequires: nifticlib-devel}
051cb92
BuildRequires: zlib-devel
051cb92
%if %{with hdf5}
051cb92
BuildRequires: hdf5-devel
051cb92
%endif
051cb92
%if %{with matio}
051cb92
BuildRequires: matio-devel
051cb92
%endif
051cb92
%if %{with vtk}
051cb92
BuildRequires: vtk-devel
051cb92
%endif
051cb92
%if %{with cgal}
051cb92
BuildRequires: CGAL-devel
051cb92
%endif
051cb92
051cb92
# CGAL causes 'memory exhausted' error
051cb92
%global openmeeg_cmake_options \\\
051cb92
        -DCMAKE_BUILD_TYPE=Release \\\
051cb92
        -DUSE_PROGRESSBAR=ON \\\
051cb92
        -DBUILD_DOCUMENTATION:BOOL=ON \\\
051cb92
        -DBUILD_SHARED_LIBS:BOOL=ON \\\
051cb92
        -DBUILD_SHARED_LIBS_OpenMEEG:BOOL=ON \\\
051cb92
        -DBUILD_SHARED_LIBS_matio:BOOL=ON \\\
051cb92
        -DBUILD_SHARED_LIBS_zlib:BOOL=ON \\\
051cb92
        -DCMAKE_SKIP_INSTALL_RPATH:BOOL=YES \\\
051cb92
        -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} \\\
051cb92
        -DCMAKE_INSTALL_INCLUDEDIR:PATH=include/%{name} \\\
051cb92
        -DBLA_VENDOR=OpenBLAS \\\
051cb92
        -DBLAS_openblas_LIBRARY:FILEPATH=%{_libdir}/libopenblas.so \\\
051cb92
%if %{with python} \
051cb92
        -DENABLE_PYTHON:BOOL=ON \\\
051cb92
        -DPYTHON_EXECUTABLE:FILEPATH=%{__python2} \\\
279fe24
%endif \
279fe24
%if %{with doc} \
279fe24
        -DBUILD_DOCUMENTATION:BOOL=ON \\\
051cb92
%endif \
051cb92
%if %{with check} \
051cb92
        -DBUILD_TESTING:BOOL=ON \\\
051cb92
%endif \
051cb92
        -DBUILD_TOOLS:BOOL=ON \\\
051cb92
        -DENABLE_PACKAGING:BOOL=OFF \\\
051cb92
        -DSKIP_GITHUB_TESTS:BOOL=ON \\\
051cb92
%if %{with cgal} \
051cb92
        -DUSE_CGAL:BOOL=ON \\\
051cb92
%endif \
279fe24
        %{?fedora:-DUSE_GIFTI:BOOL=ON} \\\
051cb92
        -DUSE_OMP:BOOL=ON \\\
051cb92
%if %{with hdf5} \
051cb92
        -DUSE_SYSTEM_hdf5:BOOL=ON \\\
051cb92
%endif \
051cb92
%if %{with matio} \
051cb92
        -DUSE_SYSTEM_matio:BOOL=ON \\\
051cb92
%endif \
051cb92
%if %{with vtk} \
051cb92
        -DUSE_VTK:BOOL=ON \\\
051cb92
%endif \
051cb92
        -DUSE_SYSTEM_zlib:BOOL=ON \\\
051cb92
        -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
051cb92
051cb92
%description
051cb92
The OpenMEEG software is a C++ package for solving the forward
051cb92
problems of electroencephalography (EEG) and magnetoencephalography (MEG).
051cb92
051cb92
%package        devel
051cb92
Summary:        Development files for %{name}
051cb92
Requires:       %{name}%{?_isa} = %{version}-%{release}
051cb92
%description    devel
051cb92
The %{name}-devel package contains libraries and header files for
051cb92
developing applications that use OpenMEEG.
051cb92
051cb92
%if %{with python}
051cb92
%package        -n python2-openmeeg
051cb92
Summary:        OpenMEEG binding for Python2
051cb92
%{?python_provide:%python_provide python2-%{name}}
051cb92
BuildRequires:  python2-devel
279fe24
%{?fedora:BuildRequires: python2-numpy}
279fe24
%{?rhel:BuildRequires: numpy}
051cb92
BuildRequires:  swig
051cb92
Requires:       %{name}%{?_isa} = %{version}-%{release}
279fe24
%{?fedora:Requires: python2-numpy}
279fe24
%{?rhel:Requires: numpy}
051cb92
Requires:       swig
051cb92
%description    -n python2-openmeeg
051cb92
OpenMEEG binding for Python2.
051cb92
%endif
051cb92
051cb92
%if %{with doc}
051cb92
%package        doc
051cb92
Summary:        Documentation files for OpenMEEG
051cb92
BuildRequires:  doxygen
051cb92
BuildArch:      noarch
051cb92
%description    doc
051cb92
%{summary}.
051cb92
%endif
051cb92
051cb92
%prep
279fe24
%autosetup -n %{name}-%{version}-%{relsuf} -p1
051cb92
051cb92
%build
051cb92
mkdir -p build && pushd build
051cb92
export LDFLAGS="%{__global_ldflags} -Wl,--as-needed"
279fe24
%{cmake3} %{openmeeg_cmake_options} ..
279fe24
279fe24
# If built including the documentation, Make's parallel jobs are damaging
279fe24
%if %{with doc}
279fe24
make -j1 VERBOSE=1
279fe24
%else
051cb92
%make_build VERBOSE=1
279fe24
%endif
051cb92
051cb92
%install
051cb92
%make_install -C build
051cb92
051cb92
%if %{with check}
051cb92
%check
051cb92
pushd build
051cb92
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}/%{name}:%{_libdir}
051cb92
ctest --force-new-ctest-process --parallel %{?_smp_mflags}
051cb92
%endif
051cb92
051cb92
%ldconfig_scriptlets
051cb92
051cb92
%files
051cb92
%license LICENSE.txt
051cb92
%{_bindir}/*
051cb92
%{_libdir}/lib*.so.*
051cb92
051cb92
%files devel
8d74894
%doc coding_guidelines.txt
051cb92
#%%{_libdir}/cmake/%%{name}/
051cb92
%{_libdir}/lib*.so
051cb92
%{_includedir}/%{name}/
051cb92
051cb92
%if %{with python}
051cb92
%files -n python2-openmeeg
051cb92
%{python2_sitearch}/%{name}/
051cb92
%endif
051cb92
051cb92
%if %{with doc}
051cb92
%files doc
051cb92
%license LICENSE.txt
051cb92
%exclude %{_docdir}/OpenMEEG/LICENSE.txt
051cb92
%exclude %{_docdir}/OpenMEEG/README.rst
051cb92
%{_docdir}/OpenMEEG/
051cb92
%endif
051cb92
051cb92
%changelog
8d74894
* Thu Jun 28 2018 Antonio Trande <sagitter@fedoraproject.org> - 2.4-0.3.rc4
8d74894
- Update to 2.4-rc4
8d74894
279fe24
* Fri Apr 06 2018 Antonio Trande <sagitter@fedoraproject.org> - 2.4-0.2.rc1
279fe24
- Update to 2.4-rc1
8d74894
- Modified for epel7
279fe24
279fe24
* Fri Mar 23 2018 Antonio Trande <sagitter@fedoraproject.org> - 2.4-0.1.20180323gitee565c4
051cb92
- Initial rpm