File symengine.spec of Package symengine

#
# spec file for package symengine
#
# Copyright (c) 2017 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/
#

%if 0%{?suse_version} > 1320 
%bcond_without  llvm
%else
%bcond_with     llvm
%endif

%define major   0_3
%define majver  0.3
%define libname lib%{name}%{major}
%bcond_with     test
Name:           symengine
Version:        0.3.0
Release:        0
Summary:        Symbolic manipulation library
License:        MIT and BSD-3-Clause
Group:          System/Libraries
Url:            http://www.blosc.org/
Source:         https://github.com/symengine/symengine/archive/v%{version}.tar.gz
Patch0:         use_cmake_lib_dir.patch
BuildRequires:  binutils-devel
BuildRequires:  boost-devel
BuildRequires:  c++_compiler
BuildRequires:  cmake
BuildRequires:  gmp-devel
BuildRequires:  gmp-ecm-devel
BuildRequires:  gperftools-devel
BuildRequires:  mpc-devel
BuildRequires:  mpfr-devel
BuildRequires:  openmpi-devel
%if %{with llvm}
BuildRequires:  llvm-devel
%endif
ExclusiveArch:  %{ix86} x86_64

%description
SymEngine is a standalone C++ symbolic manipulation library.

%package -n %{libname}
Summary:        A blocking, shuffling and lossless compression library
Group:          System/Libraries

%description -n %{libname}
SymEngine is a standalone C++ symbolic manipulation library.

%package devel
Summary:        Development libraries for %{libname}
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}
Requires:       binutils-devel
Requires:       boost-devel
Requires:       c++_compiler
Requires:       cmake
Requires:       gmp-devel
Requires:       gmp-ecm-devel
Requires:       gperftools-devel
Requires:       mpc-devel
Requires:       mpfr-devel
Requires:       openmpi-devel
%if %{with llvm}
Requires:       llvm-devel
%endif

%description devel
This package provides development libraries and headers
for %{libname}

%prep
%setup -q
%patch0 -p1

%build
%cmake \
    -DINSTALL_CMAKE_DIR=%{_libdir}/cmake/symengine \
    -DCMAKE_BUILD_TYPE=Release \
    -DWITH_BFD=ON \
    -DWITH_ECM=ON \
    -DWITH_MPFR=ON \
%if %{with llvm}
    -DWITH_LLVM=ON \
%endif
    -DWITH_BOOST=ON \
    -DWITH_PTHREAD=ON \
    -DWITH_MPC=ON \
    -DWITH_TCMALLOC=ON \
    -DWITH_OPENMP=ON
    
%make_jobs

%install
%cmake_install
rm %{buildroot}/%{_prefix}/lib*/libteuchos.a

%if %{with test}
%check
pushd build
export LD_PRELOAD="$LD_PRELOAD  %{buildroot}%{_libdir}/libsymengine.so %{buildroot}%{_libdir}/libsymengine.so.%{majver} %{buildroot}%{_libdir}/libsymengine.so.%{version}"
ctest -V -j1
popd
%endif

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files -n %{libname}
%defattr(-,root,root,-)
%doc AUTHORS LICENSE README.md
%{_libdir}/libsymengine.so.%{majver}
%{_libdir}/libsymengine.so.%{version}

%files devel
%defattr(-,root,root,-)
%doc AUTHORS LICENSE README.md
%{_includedir}/symengine/
%{_libdir}/libsymengine.so
%{_libdir}/cmake/symengine/

%changelog
openSUSE Build Service is sponsored by