Blob Blame History Raw
%global with_python3 0
# fails to build with python3

%global _hardened_build 1

Name:           moose
Version:        3.0.2
%global codename ghevar
%global prerelease beta.2
%global fullversion %{codename}_%{version}%{?prerelease:-%{prerelease}}
Release:        0.6%{?dist}%{?prerelease:.%{prerelease}}
Summary:        Multiscale Neuroscience and Systems Biology Simulator
License:        GPLv3
URL:            http://moose.ncbs.res.in/
Source0:        https://github.com/BhallaLab/moose-core/archive/%{fullversion}.tar.gz
Source1:        https://raw.githubusercontent.com/BhallaLab/moose-core/master/LICENSE

# Disable bundled libraries. This should be replaced with a proper
# patch which allows selection of bundled/system library like it
# is already done with gsl.
Patch0:         0001-Use-system-muparser-and-tinyxml.patch
Patch1:         0002-Make-libmoose-static-for-now.patch
Patch2:         0003-Crudely-link-to-system-sbml.patch
# This should be replaced with a proper fix to the build system which
# removes the crazy approach of creating a temporary sdist tarball and
# simply builds python module in the proper build directory.
Patch3:         0004-Do-not-use-tmp-in-python-build.patch
# https://github.com/BhallaLab/moose-core/pull/51
Patch4:         0005-Remove-executable-permissions-from-source-files.patch

BuildRequires:  gcc-c++
BuildRequires:  make
BuildRequires:  cmake
BuildRequires:  rsync
BuildRequires:  readline-devel
BuildRequires:  ncurses-devel
BuildRequires:  zlib-devel
BuildRequires:  gsl-devel
BuildRequires:  hdf5-devel
BuildRequires:  tinyxml-devel
BuildRequires:  muParser-devel
BuildRequires:  libsbml-devel
BuildRequires:  python2-devel
BuildRequires:  numpy
BuildRequires:  chrpath
BuildRequires:  checksec

%if 0%{?with_python3}
BuildRequires:  python3-devel
BuildRequires:  python3-numpy
%endif

%description
MOOSE is the base and numerical core for large, detailed simulations
including Computational Neuroscience and Systems Biology. MOOSE spans
the range from single molecules to subcellular networks, from single
cells to neuronal networks, and to still larger systems. It is
backwards-compatible with GENESIS, and forward compatible with Python
and XML-based model definition standards like SBML and NeuroML.

MOOSE uses Python as its primary scripting language. For backward
compatibility we have a GENESIS scripting module, but this is
deprecated. MOOSE numerical code is written in C++.

%package -n python2-%{name}
Summary:  Python interface for %{name}
%{?python_provide:%python_provide python2-moose}
# Those two modules are part of moose...
Provides: python2-rdesigneur = %{version}-%{release}
Provides: python2-libmumbl = %{version}-%{release}

Requires: numpy
Requires: python-matplotlib
Requires: python-matplotlib-qt4
Requires: python-lxml

%description -n python2-%{name}
This package contains the %{summary}.

%if 0%{?with_python3}
%package -n python3-%{name}
Summary:  %{summary}
%{?python_provide:%python_provide python3-moose}
# Those two modules are part of moose...
Provides: python3-rdesigneur = %{version}-%{release}
Provides: python3-libmumbl = %{version}-%{release}

Requires: python3-numpy
Requires: python3-matplotlib
Requires: python3-matplotlib-qt4
Requires: python3-lxml

%description -n python3-%{name}
This package contains the %{summary}.
%endif

%prep
%autosetup -n moose-core-%{fullversion} -p1

cp %{SOURCE1} .

%build
mkdir build
pushd build
%cmake .. \
       -DWITH_CURSES:BOOL=ON \
       -DBUILD_SHARED_LIBS:BOOL=OFF \
       -DPYTHON_EXECUTABLE=%{__python2}
%make_build
chrpath --delete moose.bin

# build python module
tar -xvf moose-%{version}.tar.gz
pushd moose-%{version}
%py2_build

%install
install -D build/moose.bin %{buildroot}%{_bindir}/moose

pushd build/moose-%{version}
%py2_install \--install-lib=%{python2_sitearch}
# this is necessary for the dependency generator to work
chmod +x %{buildroot}%{python2_sitearch}/moose/_moose.so

%check
checksec --file %{buildroot}%{_bindir}/moose

PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -c \
    'import moose; neuron = moose.Neuron("/neuron"); print(neuron.getPath)'

%global _docdir_fmt %{name}

%files
%{_bindir}/moose
%license LICENSE
%doc README.md

%files -n python2-%{name}
%{python2_sitearch}/rdesigneur
%{python2_sitearch}/libmumbl
%{python2_sitearch}/moose
%{python2_sitearch}/moose-*egg-info
%license LICENSE
%doc README.md

%if 0%{?with_python3}
%files -n python3-%{name}
%{python2_sitearch}/rdesigneur
%{python2_sitearch}/libmumbl
%{python2_sitearch}/moose
%{python2_sitearch}/moose-*egg-info
%license LICENSE
%doc README.md
%endif

%changelog
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-0.6.beta.2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jan 21 2016 Orion Poplawski <orion@cora.nwra.com> - 3.0.2-0.5.beta.2
- Rebuild for hdf5 1.8.16

* Sun Dec 13 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.2-0.4.beta.2
- Fix permissions on files in debuginfo subpackage
- Tweak python package generation

* Sun Dec 13 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.2-0.3.beta.2
- Fix build on i686

* Sat Dec 12 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.2-0.2.beta.2
- Remove obsolete cxx11 fix
- Use chrpath --delete

* Wed Dec  9 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.2-0.1.beta.2
- Initial packaging