churchyard / rpms / smoldyn

Forked from rpms/smoldyn 9 months ago
Blob Blame History Raw
# Smoldyn provides the SFMT-1.3.3 (SIMD-oriented Fast Mersenne Twister) source code;
# currently unavailable on Fedora.

%global with_libs 0

# VTK support?
# See
%global with_vtk 0

Name:  smoldyn
Summary: A particle-based spatial stochastic simulator
Version: 2.58
Release: 1%{?dist}

# The rxnparam.c and SurfaceParam.c source code files are in the public domain.
# The Next Subvolume module is Copyright 2012 by Martin Robinson and is distributed
# under the Gnu LGPL license.
# The rest of the code is Copyright 2003-2018 by Steven Andrews and also
# distributed under the Gnu LGPL.
# source/lib/SFMT is licensed under the 'BSD 3-clause "New" or "Revised" License'
License: LGPLv3+ and Public Domain and BSD
Source0: %{url}/%{name}-%{version}.zip

# Fix library paths according to the Fedora Project guidelines
Patch0: %{name}-fix_libpaths.patch

BuildRequires: boost-devel
BuildRequires: cmake3
BuildRequires: gcc
BuildRequires: %{?dts}gcc-c++
%if 0%{?rhel} == 7
BuildRequires: devtoolset-7-toolchain, devtoolset-7-libatomic-devel
# Coming on epel7
#BuildRequires: boost169-devel
BuildRequires: freeglut-devel
BuildRequires: libXmu-devel
BuildRequires: libXi-devel
BuildRequires: libtiff-devel
BuildRequires: libglvnd-devel
BuildRequires: perl-macros
%if %{?with_vtk}
BuildRequires: vtk-devel
BuildRequires: zlib-devel

Requires: bionetgen-perl

Provides: bundled(SFMT) = 1.3.3 

Smoldyn is a computer program for cell-scale biochemical simulations.
It simulates each molecule of interest individually to capture natural
stochasticity and to yield nanometer-scale spatial resolution.
It treats other molecules implicitly, enabling it to simulate hundreds
of thousands of molecules over several minutes of real time.

Simulated molecules diffuse, react, are confined by surfaces,
and bind to membranes much as they would in a real biological system.

It is more accurate and faster than other particle-based simulators.
Smoldyn's unique features include: a "virtual experimenter" who can
manipulate or measure the simulated system, support for spatial compartments,
molecules with excluded volume, and simulations in 1, 2, or 3 dimensions. 

%if %{?with_libs}
%package devel
Summary: %{name} devel files 
Requires: %{name}%{?_isa} = %{version}-%{release}
Provides: %{name}-static = %{version}-%{release}
%description devel
This package provides the %{name} examples, header files and private libraries.

%package doc
Summary: %{name} PDF documentation
Requires: %{name} = %{version}-%{release}
BuildArch: noarch
%description doc
%{name} PDF documentation.

%setup -q -n %{name}-%{version}
%patch0 -p0 -b .fix_libpaths

# Copy license file
mv source/lib/SFMT/LICENSE.txt source/lib/SFMT/SFMT-LICENSE.txt
mv source/lib/SFMT/README.txt source/lib/SFMT/SFMT-README.txt

# Remove pre-built archives
rm -rf Linux

# Remove bundled libraries
rm -rf source/BioNetGen source/MinGWlibs Toolchain-mingw32.cmake
rm -rf source/vcell/* source/NextSubVolume/Eigen
rm -rf source/NextSubVolume/boost_include
%if !%{?with_vtk}
rm -f source/vtk/*

#Fix permissions
find . -type f -name "*.h" -exec chmod 0644 '{}' \;
find . -type f -name "*.c" -exec chmod 0644 '{}' \;
find . -type f -name "*.pdf" -exec chmod 0644 '{}' \;
find . -type f -name "*.txt" -exec chmod 0644 '{}' \;
find . -type f -name "*.txt" -exec sed -i 's/\r$//' '{}' \;

# Set system path to
sed -e 's|../../../source/BioNetGen/|%{perl_vendorlib}/BioNetGen/|g' -i examples/S95_regression/lrmsim.txt \
 examples/S12_bionetgen/lrm/lrmsim.txt \
 examples/S12_bionetgen/abba/abbasim.txt \
 examples/S94_archive/Andrews_2016/BioNetGen/lrm/lrmsim.txt \

mkdir -p build && pushd build
%if 0%{?rhel} == 7
. /opt/rh/devtoolset-7/enable
%cmake3 -Wno-dev \
%if %{?with_vtk}
%if %{?with_libs}
 -DPERL_VENDORLIB:PATH=%{perl_vendorlib} \
%make_build V=1

%make_install -C build

%doc source/lib/SFMT/SFMT-README.txt
%license License.txt source/lib/SFMT/SFMT-LICENSE.txt

%if %{?with_libs}
%files devel
%doc examples

%files doc
%doc documentation/*

* Fri Mar 29 2019 Antonio Trande <> - 2.58-1
- Release 2.58

* Sun Feb 03 2019 Antonio Trande <> - 2.56-1
- First package
- Unbundle zlib, boost and BioNetGen
- Remove unused header files
- Fix file permissions
- Add License file provided by upstream