LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File talys.spec of Package talys10 (Project home:maxiotis:talys)

#
# spec file for package talys-1.0
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# See also http://en.opensuse.org/openSUSE:Specfile_guidelines

%define mname talys

Name:           talys10
Version:        1.0
Release:        0
Summary:        TALYS is software for the simulation of nuclear reactions
License:        GPL-3.0
Group:          Productivity/Science/Physics
Url:            ftp://ftp.nrg.eu/pub/www/talys/
Source0:        %{mname}.tar.gz
Source1:        %{mname}-rpmlint
BuildRequires:  gcc-fortran, bc
Requires:       %{name}-data

%description
TALYS is software for the simulation of nuclear reactions. Many state-of-the-art nuclear models are included to cover all main reaction mechanisms encountered in light particle-induced nuclear reactions. TALYS provides a complete description of all reaction channels and observables, and is user-friendly. 

%define mversion $(echo %{version} | sed "s/\\.//g")
#%define prevversion 10
%define my_bin_dir /usr/local/bin
%define my_data_dir /opt/%{mname}/%{name}
%define structure_data_path %{my_data_dir}/structure/
%define inst_bin_path %{buildroot}%{my_bin_dir}
%define inst_data_path %{buildroot}%{my_data_dir}

%ifnarch %ix86
%package        data
Summary:        TALYS is software for the simulation of nuclear reactions
Group:          Productivity/Science/Physics
BuildArch:      noarch
BuildRequires:  fdupes
%description    data
TALYS is software for the simulation of nuclear reactions. Many state-of-the-art nuclear models are included to cover all main reaction mechanisms encountered in light particle-induced nuclear reactions. TALYS provides a complete description of all reaction channels and observables, and is user-friendly. 
%endif

%prep
%setup -q -n %{mname}

%build
cd source
sed -i "s|path='.*'|path='%{structure_data_path}'|g" machine.f
gfortran -c *.f
gfortran *.o -o %{name}

%install
mkdir -p %{inst_bin_path}
mv source/%{name} %{inst_bin_path}

%ifnarch %ix86
mkdir -p %{inst_data_path}
#cp -r /opt/%{mname}/* %{inst_data_path}/..
#work_dir=$(pwd) ; for dir in `ls %{inst_data_path}/..` ; do cd %{inst_data_path}/../$dir ; rm -rf `ls | grep -v structure` ; done ; cd $work_dir
mv structure %{inst_data_path}
target="" ; declare -a sources ; fdupes -q -p -n -r %{inst_data_path}/.. | while read line ; do if [ "$line" == "" ] ; then if [ ! "$target" == "" ] || [ ! ${sources[0]} == "" ] ; then if [ "$target" == "" ] ; then target="${sources[0]}" ; unset sources[0] ; fi ; for sourc in ${sources[@]} ; do rm -rf $sourc ; ln -s -r $target $sourc ; done ; target="" ; unset sources ; fi ; else if echo "$line" | grep -v "%{name}.structure" ; then target="$line" ; else sources+=("$line") ; fi  ; fi ; done
work_dir=$(pwd) ; cd %{inst_data_path}/.. ; for dir in `ls | grep -v %{name}` ; do rm -rf $dir ; done ; cd $work_dir
mv * %{inst_data_path}/
rm -rf %{inst_data_path}/source/*.o
%endif

%files
%{my_bin_dir}/*

%ifnarch %ix86
%files data
%dir %{my_data_dir}/../
%{my_data_dir}/../*
%endif

%changelog
* Mon Sep 21 2015 Axiotis Michail
-