00ff2c8
# Smoldyn provides the SFMT-1.3.3 (SIMD-oriented Fast Mersenne Twister) source code;
00ff2c8
# currently unavailable on Fedora.
00ff2c8
# http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html
00ff2c8
00ff2c8
# VTK support?
00ff2c8
# See https://github.com/ssandrews/Smoldyn-official/issues/3
00ff2c8
%global with_vtk 0
00ff2c8
00ff2c8
Name:  smoldyn
00ff2c8
Summary: A particle-based spatial stochastic simulator
783892b
Version: 2.65
792687b
Release: 5%{?dist}
00ff2c8
00ff2c8
# The rxnparam.c and SurfaceParam.c source code files are in the public domain.
00ff2c8
#
00ff2c8
# The Next Subvolume module is Copyright 2012 by Martin Robinson and is distributed
00ff2c8
# under the Gnu LGPL license.
00ff2c8
#
00ff2c8
# The rest of the code is Copyright 2003-2018 by Steven Andrews and also
00ff2c8
# distributed under the Gnu LGPL.
00ff2c8
#
3135055
# source/libSteve/SFMT is licensed under the 'BSD 3-clause "New" or "Revised" License'
00ff2c8
License: LGPLv3+ and Public Domain and BSD
00ff2c8
URL:   http://www.smoldyn.org
7c0dc02
Source0: %{url}/%{name}-%{version}.zip
00ff2c8
00ff2c8
# Fix library paths according to the Fedora Project guidelines
00ff2c8
Patch0: %{name}-fix_libpaths.patch
783892b
ed9e774
Patch1: %{name}-freeglut.patch
783892b
Patch2: %{name}-create_soname.patch
783892b
Patch3: %{name}-avoid_automatic_wheel.patch
00ff2c8
783892b
%if 0%{?fedora} || 0%{?rhel} > 7
783892b
BuildRequires: cmake
783892b
%else
00ff2c8
BuildRequires: cmake3
783892b
%endif
00ff2c8
BuildRequires: gcc
3135055
BuildRequires: gcc-c++
3341dd7
BuildRequires: boost-devel
00ff2c8
BuildRequires: freeglut-devel
00ff2c8
BuildRequires: libXmu-devel
00ff2c8
BuildRequires: libXi-devel
00ff2c8
BuildRequires: libtiff-devel
00ff2c8
BuildRequires: libglvnd-devel
783892b
BuildRequires: make
4f8d76a
BuildRequires: perl-macros
3135055
BuildRequires: python3-devel
783892b
BuildRequires: python3-setuptools
783892b
BuildRequires: python3-wheel
783892b
BuildRequires: pybind11-devel
00ff2c8
%if %{?with_vtk}
00ff2c8
BuildRequires: vtk-devel
00ff2c8
%endif
00ff2c8
BuildRequires: zlib-devel
783892b
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
00ff2c8
00ff2c8
Requires: bionetgen-perl
00ff2c8
Provides: bundled(SFMT) = 1.3.3 
00ff2c8
00ff2c8
%description
00ff2c8
Smoldyn is a computer program for cell-scale biochemical simulations.
00ff2c8
It simulates each molecule of interest individually to capture natural
00ff2c8
stochasticity and to yield nanometer-scale spatial resolution.
00ff2c8
It treats other molecules implicitly, enabling it to simulate hundreds
00ff2c8
of thousands of molecules over several minutes of real time.
00ff2c8
00ff2c8
Simulated molecules diffuse, react, are confined by surfaces,
00ff2c8
and bind to membranes much as they would in a real biological system.
00ff2c8
00ff2c8
It is more accurate and faster than other particle-based simulators.
3135055
Smoldyn unique features include: a "virtual experimenter" who can
00ff2c8
manipulate or measure the simulated system, support for spatial compartments,
00ff2c8
molecules with excluded volume, and simulations in 1, 2, or 3 dimensions. 
00ff2c8
00ff2c8
%package doc
783892b
Summary: %{name} documentation
00ff2c8
Requires: %{name} = %{version}-%{release}
00ff2c8
BuildArch: noarch
00ff2c8
%description doc
783892b
%{name} documentation.
783892b
783892b
%package libs
783892b
Summary: %{name} libraries
783892b
%description libs
783892b
%{name} shared libraries.
783892b
783892b
%package libs-devel
783892b
Summary: %{name} libraries for development
783892b
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
e450660
Provides: %{name}libs-static = 0:%{version}-%{release}
783892b
%description libs-devel
783892b
%{name} shared and static libraries for development.
783892b
783892b
%package -n python3-smoldyn
783892b
Summary: %{name} libraries for Python
783892b
Requires: python3-numpy
783892b
%{?python_provide:%python_provide python3-%{name}}
783892b
%description -n python3-smoldyn
783892b
%{name} libraries for Python.
00ff2c8
00ff2c8
%prep
ed9e774
%autosetup -n %{name}-%{version} -N
00ff2c8
%patch0 -p0 -b .fix_libpaths
ed9e774
%patch1 -p0 -b .freeglut
783892b
%patch2 -p0 -b .create_soname
783892b
%patch3 -p0 -b .avoid_automatic_wheel
00ff2c8
3135055
# Remove bundled archives
783892b
rm -rf source/MSVClibs
783892b
rm -rf source/pybind11
00ff2c8
00ff2c8
# Remove bundled libraries
00ff2c8
rm -rf source/BioNetGen source/MinGWlibs Toolchain-mingw32.cmake
00ff2c8
rm -rf source/vcell/* source/NextSubVolume/Eigen
00ff2c8
rm -rf source/NextSubVolume/boost_include
00ff2c8
%if !%{?with_vtk}
00ff2c8
rm -f source/vtk/*
00ff2c8
%endif
00ff2c8
00ff2c8
#Fix permissions
00ff2c8
find . -type f -name "*.h" -exec chmod 0644 '{}' \;
00ff2c8
find . -type f -name "*.c" -exec chmod 0644 '{}' \;
00ff2c8
find . -type f -name "*.pdf" -exec chmod 0644 '{}' \;
00ff2c8
find . -type f -name "*.txt" -exec chmod 0644 '{}' \;
00ff2c8
find . -type f -name "*.txt" -exec sed -i 's/\r$//' '{}' \;
00ff2c8
00ff2c8
# Set system path to BNG2.pl
00ff2c8
sed -e 's|../../../source/BioNetGen/BNG2.pl|%{perl_vendorlib}/BioNetGen/BNG2.pl|g' -i examples/S95_regression/lrmsim.txt \
00ff2c8
 examples/S12_bionetgen/lrm/lrmsim.txt \
00ff2c8
 examples/S12_bionetgen/abba/abbasim.txt \
00ff2c8
 examples/S94_archive/Andrews_2016/BioNetGen/lrm/lrmsim.txt \
00ff2c8
 examples/S94_archive/Andrews_2016/BioNetGen/abba/abbasim.txt
3135055
 
3135055
# Copy license file
3135055
cp -p source/libSteve/SFMT/LICENSE.txt source/libSteve/SFMT/SFMT-LICENSE.txt
3135055
cp -p source/libSteve/SFMT/README.txt source/libSteve/SFMT/SFMT-README.txt
3135055
792687b
# Remove Python byte cache from previous Python versions shipped in upstream tarball
792687b
find -name '*.pyc' -delete
792687b
792687b
00ff2c8
%build
3135055
# Python binding needs shared libraries
783892b
%cmake -Wno-dev -B build \
00ff2c8
 -DCPACK_BINARY_STGZ:BOOL=OFF \
00ff2c8
 -DCPACK_BINARY_TGZ:BOOL=OFF \
00ff2c8
 -DCPACK_BINARY_TZ:BOOL=OFF \
00ff2c8
 -DCPACK_SOURCE_TBZ2:BOOL=OFF \
00ff2c8
 -DCPACK_SOURCE_TGZ:BOOL=OFF \
00ff2c8
 -DCPACK_SOURCE_TXZ:BOOL=OFF \
00ff2c8
 -DCPACK_SOURCE_TZ:BOOL=OFF \
00ff2c8
 -DOPTION_VCELL:BOOL=OFF \
00ff2c8
%if %{?with_vtk}
00ff2c8
 -DOPTION_VTK:BOOL=ON \
00ff2c8
%else
00ff2c8
 -DOPTION_VTK:BOOL=OFF \
00ff2c8
%endif
783892b
 -DBUILD_SHARED_LIBS:BOOL=ON \
3135055
 -DSMOLDYN_VERSION:STRING=%{version} \
783892b
 -DSMOLDYN_VERSION_MAJOR:STRING=2 \
783892b
 -DOPTION_TARGET_LIBSMOLDYN:BOOL=ON \
3135055
 -DOPTION_STATIC:BOOL=OFF \
783892b
 -DOPTION_PYTHON:BOOL=ON -DPYBIND11_FINDPYTHON:BOOL=ON -Dpybind11_DIR:PATH=%{_datadir}/cmake/pybind11 \
00ff2c8
 -DOPTION_USE_ZLIB:BOOL=ON \
00ff2c8
 -DOPTION_PDE:BOOL=ON \
00ff2c8
 -DPERL_VENDORLIB:PATH=%{perl_vendorlib} \
00ff2c8
 -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_LIBDIR:PATH=%{_libdir} \
00ff2c8
 -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
00ff2c8
 -DCMAKE_VERBOSE_MAKEFILE:BOOL=TRUE -DCMAKE_COLOR_MAKEFILE:BOOL=ON \
a17a6ee
 -DCMAKE_SKIP_RPATH:BOOL=YES \
3135055
 -DHAVE_GL_FREEGLUT_H=TRUE
783892b
%make_build -C build
00ff2c8
00ff2c8
%install
783892b
%make_install -C build
783892b
pushd build/py
783892b
mkdir -p %{buildroot}%{python3_sitearch}
783892b
cp -a smoldyn *.egg-info %{buildroot}%{python3_sitearch}/
783892b
popd
00ff2c8
00ff2c8
%files
00ff2c8
%{_bindir}/%{name}
00ff2c8
783892b
%files libs
783892b
%license License.txt source/libSteve/SFMT/SFMT-LICENSE.txt
783892b
%{_libdir}/lib%{name}_shared.so.%{version}
783892b
%{_libdir}/lib%{name}_shared.so.2
783892b
%{_includedir}/%{name}/
783892b
783892b
%files libs-devel
783892b
%{_libdir}/lib%{name}_shared.so
783892b
%{_libdir}/lib%{name}_static.a
783892b
783892b
%files -n python3-smoldyn
783892b
%license License.txt source/libSteve/SFMT/SFMT-LICENSE.txt
783892b
%{python3_sitearch}/%{name}/
783892b
%{python3_sitearch}/*.egg-info
783892b
00ff2c8
%files doc
783892b
%doc docs/*
00ff2c8
00ff2c8
%changelog
792687b
* Fri Sep 10 2021 Miro HronĨok <mhroncok@redhat.com> - 2.65-5
792687b
- Remove unused Python 3.9 byte cache
792687b
fa13d08
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.65-4
fa13d08
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
fa13d08
32dee49
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 2.65-3
32dee49
- Rebuilt for Python 3.10
32dee49
e450660
* Fri Jun 04 2021 Antonio Trande <sagitter@fedoraproject.org> - 2.65-2
e450660
- Add Provides for static libraries
e450660
783892b
* Wed Jun 02 2021 Antonio Trande <sagitter@fedoraproject.org> - 2.65-1
783892b
- Release 2.65
783892b
- Create Python binding
783892b
- Create libraries
783892b
4195571
* Sat Jan 30 2021 Antonio Trande <sagitter@fedoraproject.org> - 2.63-2
4195571
- Exclude example files (strange permissions)
4195571
3135055
* Fri Jan 29 2021 Antonio Trande <sagitter@fedoraproject.org> - 2.63-1
3135055
- Release 2.63
3135055
582d57a
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 2.61-6
582d57a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
582d57a
8a30d60
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.61-5
8a30d60
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
8a30d60
e8000a2
* Fri Jul 24 2020 Jeff Law <law@redhat.com> - 2.61-4
e8000a2
- Use  __cmake_in_source_build
e8000a2
e42aee6
* Mon May 25 2020 Antonio Trande <sagitter@fedoraproject.org> - 2.61-3
e42aee6
- Fix patch for EPEL7
e42aee6
3341dd7
* Mon May 25 2020 Antonio Trande <sagitter@fedoraproject.org> - 2.61-2
3341dd7
- Patched for using Boost169 on EPEL7
3341dd7
ed9e774
* Sun May 24 2020 Antonio Trande <sagitter@fedoraproject.org> - 2.61-1
ed9e774
- Release 2.61
ed9e774
f519290
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.58-4
f519290
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
f519290
a17a6ee
* Tue Sep 17 2019 Gwyn Ciesla <gwync@protonmail.com> - 2.58-3
a17a6ee
- Rebuilt for new freeglut
a17a6ee
23898f8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.58-2
23898f8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
23898f8
00ff2c8
* Fri Mar 29 2019 Antonio Trande <sagitter@fedoraproject.org> - 2.58-1
00ff2c8
- Release 2.58
00ff2c8
00ff2c8
* Sun Feb 03 2019 Antonio Trande <sagitter@fedoraproject.org> - 2.56-1
00ff2c8
- First package
00ff2c8
- Unbundle zlib, boost and BioNetGen
00ff2c8
- Remove unused header files
00ff2c8
- Fix file permissions
00ff2c8
- Add License file provided by upstream