Blob Blame History Raw
%global with_python3 1

%global commit 0e12e41b52deb8ea746bc760cddd6e100ca5cfd8
%global shortcommit %(c=%{commit}; echo ${c:0:7})

%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.16%{?dist}%{?prerelease:.%{prerelease}}%{?commit:.git%{shortcommit}}
Summary:        Multiscale Neuroscience and Systems Biology Simulator
License:        GPLv3
URL:            http://moose.ncbs.res.in/
%if %{defined commit}
Source0:        https://github.com/BhallaLab/moose-core/archive/%{?commit}.tar.gz#/%{name}-%{shortcommit}.tar.gz
%else
Source0:        https://github.com/BhallaLab/moose-core/archive/%{fullversion}.tar.gz
%endif

Patch1:         0001-Tell-setup.py-about-the-.so-suffix-too.patch
Patch2:         0002-Make-libmoose-static-for-now.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:  python2-numpy
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: python2-numpy
Requires: python2-matplotlib
Requires: python2-matplotlib-qt4
Requires: python2-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-%{!commit:%{fullversion}} -p1

%build
%global cmake_opts -DWITH_CURSES:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_SKIP_RPATH:BOOL=ON -DCMAKE_EXE_LINKER_FLAGS="$LDFLAGS -Wl,--build-id" -DCMAKE_MODULE_LINKER_FLAGS="$LDFLAGS -Wl,--build-id"

mkdir -p build2
pushd build2
%cmake .. %{cmake_opts} \
       -DPYTHON_EXECUTABLE=%{__python2}
%make_build
cd python
%py2_build
popd

%if 0%{?with_python3}
mkdir -p build3
pushd build3
%cmake .. %{cmake_opts} \
       -DPYTHON_EXECUTABLE=%{__python3}
%make_build
cd python
%py3_build
popd
%endif

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

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

%if 0%{?with_python3}
pushd build3/python
%py3_install \--install-lib=%{python3_sitearch}
# this is necessary for the dependency generator to work
chmod +x %{buildroot}%{python3_sitearch}/moose/_moose.*.so
popd
%endif

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

PYTHONPATH=%{buildroot}%{python2_sitearch} %{__python2} -c \
    'import moose; element = moose.Neutral("/yyy"); print(element.path)'

PYTHONPATH=%{buildroot}%{python3_sitearch} %{__python3} -c \
    'import moose; element = moose.Neutral("/yyy"); print(element.path)'

%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}
%{python3_sitearch}/rdesigneur
%{python3_sitearch}/libmumbl
%{python3_sitearch}/moose
%{python3_sitearch}/moose-*egg-info
%license LICENSE
%doc README.md
%endif

%changelog
* Tue Jan 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.0.2-0.16.beta.2.git0e12e41
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-0.15.beta.2.git0e12e41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.0.2-0.14.beta.2.git0e12e41
- Rebuild for gsl-2.4

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.0.2-0.13.beta.2.git0e12e41
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 3.0.2-0.12.beta.2.git0e12e41
- Rebuild for Python 3.6

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 3.0.2-0.11.beta.2.git0e12e41
- rebuilt for matplotlib-2.0.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-0.10.beta.2.git0e12e41
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Mon Mar  7 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@bupkis> - 3.0.2-0.9.beta.2.git0e12e41
- Restore patch that removes broken shared linking

* Mon Mar  7 2016 Zbigniew Jędrzejewski-Szmek <zbyszek@bupkis> - 3.0.2-0.8.beta.2.git0e12e41
- Update to git snapshot
- Add python3 subpackage

* Tue Feb 23 2016 Orion Poplawski <orion@cora.nwra.com> - 3.0.2-0.7.beta.2
- Rebuild for gsl 2.1

* 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