Blob Blame Raw
%bcond_without vtk
%bcond_without python
%bcond_without hdf5
%bcond_without matio
%bcond_with cgal

%bcond_without doc
%bcond_without check

#%%global commit ee565c437650f11786f336a1f620474d31e64018
#%%global date 20180323
#%%global shortcommit %%(c=%%{commit}; echo ${c:0:7})

%global relsuf rc4

Name:    openmeeg
Version: 2.4
Release: 0.3.%{relsuf}%{?dist}
Summary: Low-frequency bio-electromagnetism solving forward problems in the field of EEG and MEG
License: CeCILL-B

# Do not require lapacke library
Patch0: openmeeg-openblas_libraries.patch

# Set private directory for Python files
Patch1: openmeeg-python_install_destination.patch

%if 0%{?rhel}
BuildRequires: cmake3, epel-rpm-macros
BuildRequires: cmake
%global cmake3 %cmake
BuildRequires: gcc-c++, git, chrpath
BuildRequires: gnuplot, wget, graphviz
BuildRequires: expat-devel
BuildRequires: openblas-devel
%{?fedora:BuildRequires: gifticlib-devel}
%{?fedora:BuildRequires: nifticlib-devel}
BuildRequires: zlib-devel
%if %{with hdf5}
BuildRequires: hdf5-devel
%if %{with matio}
BuildRequires: matio-devel
%if %{with vtk}
BuildRequires: vtk-devel
%if %{with cgal}
BuildRequires: CGAL-devel

# CGAL causes 'memory exhausted' error
%global openmeeg_cmake_options \\\
        -DCMAKE_BUILD_TYPE=Release \\\
        -DBUILD_SHARED_LIBS_matio:BOOL=ON \\\
        -DBUILD_SHARED_LIBS_zlib:BOOL=ON \\\
        -DCMAKE_INSTALL_LIBDIR:PATH=%{_lib} \\\
        -DCMAKE_INSTALL_INCLUDEDIR:PATH=include/%{name} \\\
        -DBLA_VENDOR=OpenBLAS \\\
        -DBLAS_openblas_LIBRARY:FILEPATH=%{_libdir}/ \\\
%if %{with python} \
        -DPYTHON_EXECUTABLE:FILEPATH=%{__python2} \\\
%endif \
%if %{with doc} \
%endif \
%if %{with check} \
%endif \
%if %{with cgal} \
        -DUSE_CGAL:BOOL=ON \\\
%endif \
        %{?fedora:-DUSE_GIFTI:BOOL=ON} \\\
        -DUSE_OMP:BOOL=ON \\\
%if %{with hdf5} \
        -DUSE_SYSTEM_hdf5:BOOL=ON \\\
%endif \
%if %{with matio} \
        -DUSE_SYSTEM_matio:BOOL=ON \\\
%endif \
%if %{with vtk} \
        -DUSE_VTK:BOOL=ON \\\
%endif \
        -DUSE_SYSTEM_zlib:BOOL=ON \\\

The OpenMEEG software is a C++ package for solving the forward
problems of electroencephalography (EEG) and magnetoencephalography (MEG).

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use OpenMEEG.

%if %{with python}
%package        -n python2-openmeeg
Summary:        OpenMEEG binding for Python2
%{?python_provide:%python_provide python2-%{name}}
BuildRequires:  python2-devel
%{?fedora:BuildRequires: python2-numpy}
%{?rhel:BuildRequires: numpy}
BuildRequires:  swig
Requires:       %{name}%{?_isa} = %{version}-%{release}
%{?fedora:Requires: python2-numpy}
%{?rhel:Requires: numpy}
Requires:       swig
%description    -n python2-openmeeg
OpenMEEG binding for Python2.

%if %{with doc}
%package        doc
Summary:        Documentation files for OpenMEEG
BuildRequires:  doxygen
BuildArch:      noarch
%description    doc

%autosetup -n %{name}-%{version}-%{relsuf} -p1

mkdir -p build && pushd build
export LDFLAGS="%{__global_ldflags} -Wl,--as-needed"
%{cmake3} %{openmeeg_cmake_options} ..

# If built including the documentation, Make's parallel jobs are damaging
%if %{with doc}
make -j1 VERBOSE=1
%make_build VERBOSE=1

%make_install -C build

%if %{with check}
pushd build
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}/%{name}:%{_libdir}
ctest --force-new-ctest-process --parallel %{?_smp_mflags}


%license LICENSE.txt

%files devel
%doc coding_guidelines.txt

%if %{with python}
%files -n python2-openmeeg

%if %{with doc}
%files doc
%license LICENSE.txt
%exclude %{_docdir}/OpenMEEG/LICENSE.txt
%exclude %{_docdir}/OpenMEEG/README.rst

* Thu Jun 28 2018 Antonio Trande <> - 2.4-0.3.rc4
- Update to 2.4-rc4

* Fri Apr 06 2018 Antonio Trande <> - 2.4-0.2.rc1
- Update to 2.4-rc1
- Modified for epel7

* Fri Mar 23 2018 Antonio Trande <> - 2.4-0.1.20180323gitee565c4
- Initial rpm