File talys-1.97.spec of Package talys-1.97
%define debug_package %{nil}
%define mname talys
Version: 1.0
Name: %{mname}-%{version}
%define dataVersion 2.0
%define dname %{mname}-%{dataVersion}
Release: 0
Summary: TALYS is software for the simulation of nuclear reactions
License: MIT
Group: Productivity/Scientific/Physics
Url: https://nds.iaea.org/talys/
Source0: %{mname}-%{version}.tar.gz
#Source1: %{mname}-samples-%{version}.tar.gz
Source2: %{mname}.patch
BuildRequires: gcc-fortran
Requires: (%{dname}-data-multi-version or %{dname}-data)
%description
TALYS is a software package for the simulation of nuclear reactions below 200 MeV. TALYS is based on state-of-art nuclear structure and reaction models.
%package doc
Summary: Documentation of TALYS
Group: Documentation/Other
BuildArch: noarch
%description doc
Documentation of TALYS software package for the simulation of nuclear reactions below 200 MeV.
%package devel
Summary: Sources of TALYS
Group: Development/Tools/Other
BuildArch: noarch
%description devel
Source files of TALYS software package for the simulation of nuclear reactions below 200 MeV.
#%package samples
#Summary: Samples of TALYS
#Group: Development/Tools/Other
#BuildArch: noarch
#%description samples
#Sample files of TALYS software package for the simulation of nuclear reactions below 200 MeV.
%package as-default
Summary: Set TALYS %{version} as default
Group: Productivity/Scientific/Physics
Requires: %{name}
Conflicts: talys-1.9-as-default
Conflicts: talys-1.95-as-default
Conflicts: talys-1.96-as-default
Conflicts: talys-2.0-as-default
BuildArch: noarch
%description as-default
Set TALYS version %{version} as default creating a symlink called talys.
%prep
%setup -q -n %{name}
sed -i "s| codedir.*| codedir = '%{_datadir}/%{dname}/'|" source/machine.f
%build
cd source
ls *.o > /dev/null 2>&1 && rm -rf *.o
ls *.mod > /dev/null 2>&1 && rm -rf *.mod
ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f*
gfortran *.o -o %{name}
ls *.o > /dev/null 2>&1 && rm -rf *.o
ls *.mod > /dev/null 2>&1 && rm -rf *.mod
sed -i "s|\(beta2(.[^)]*)\)|abs(\1)|" foldalpha.f*
grep beta2 foldalpha.f*
ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f*
gfortran *.o -o %{name}a
ls *.o > /dev/null 2>&1 && rm -rf *.o
ls *.mod > /dev/null 2>&1 && rm -rf *.mod
patch -p2 -b < %{SOURCE2}
ls *.f* > /dev/null 2>&1 && gfortran -w -c *.f*
gfortran *.o -o %{name}pa
ls *.o > /dev/null 2>&1 && rm -rf *.o
ls *.mod > /dev/null 2>&1 && rm -rf *.mod
exit 0
%install
install -d %{buildroot}%{_bindir}
install -m755 source/%{name} %{buildroot}%{_bindir}/
install -m755 source/%{name}a %{buildroot}%{_bindir}/
install -m755 source/%{name}pa %{buildroot}%{_bindir}/
rm -rf source/%{name}
rm -rf source/%{name}a
rm -rf source/%{name}pa
install -m755 misc/tplot %{buildroot}%{_bindir}/tplot-%{version}
# Installation of doc subpackage
install -d %{buildroot}%{_docdir}/%{name}
install -m644 README.md %{buildroot}%{_docdir}/%{name}/
install -m644 doc/* %{buildroot}%{_docdir}/%{name}/
# Installation of devel subpackage
install -d %{buildroot}%{_datadir}/%{name}/source
install -m644 source/* %{buildroot}%{_datadir}/%{name}/source/
install -m755 code_build path_change %{buildroot}%{_datadir}/%{name}/
# Installation of samples subpackage
#install -d %{buildroot}%{_datadir}/%{name}/samples
#tar -zxf %{SOURCE1} --strip-components=1 --exclude=".git*" -C %{buildroot}%{_datadir}/%{name}/samples/
#for file in `find %{buildroot}%{_datadir}/%{name}/samples/ -executable -type f -iname plot -exec grep -vHl '#!' {} \;` ; do sed -i '1s|^|#!/bin/bash -f \n|' $file ; done
# Installation of as-default subpackage
cd %{buildroot}%{_bindir}
ln -s %{name} ./%{mname}
%files
%{_bindir}/%{name}*
%{_bindir}/tplot-%{version}
%files doc
%dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*
%files devel
%dir %{_datadir}/%{name}
%dir %{_datadir}/%{name}/source
%{_datadir}/%{name}/source/*.f*
%{_datadir}/%{name}/source/*.h
%{_datadir}/%{name}/source/*.cmb
%{_datadir}/%{name}/source/Makefile
%{_datadir}/%{name}/code_build
%{_datadir}/%{name}/path_change
#%files samples
#%dir %{_datadir}/%{name}
#%dir %{_datadir}/%{name}/samples
#%{_datadir}/%{name}/samples/*
%files as-default
%{_bindir}/%{mname}
%changelog
* Mon Sep 21 2015 Axiotis Michail
-