File libtbcinumlib2_8.spec of Package tbci_numlib

#
# spec file for package tbci_numlib (Version 2.8.0)
# 
# Copyright  (c)  2001  Kurt Garloff
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
# 
# please send bugfixes or comments to garloff@suse.de.
#
# $Id: libtbcinumlib2_8.spec,v 1.1.2.19 2019/06/15 20:07:26 garloff Exp $
# 

# norootforbuild

%ifarch i386 i486 i586 i686
%define arch i686
%else
%ifarch %arm
%define arch armv7l
%else
%define arch %{_arch}
%endif
%endif
%define build_avx2 0
%ifarch x86_64
%if 0%{?suse_version} >= 1500
%define build_avx2 1
%endif
%endif

%define tex tetex-latex

%if 0%{?suse_version} > 0
%if 0%{?suse_version} > 1020
%if 0%{?suse_version} >= 1310
%if 0%{?sle_version} >= 150300 || 0%{?suse_version} > 1500
%define tex texlive-latex texlive-cjk xmlto texlive-ae texlive-german texlive-germbib texlive-bibtex-bin texlive-thumbpdf-bin texlive-thumbpdf
%else # >= 13.1 <  15 
%define tex texlive-latex texlive-cjk xmlto texlive-ae texlive-german texlive-germbib
%endif
%else # >10.2 < 13.1
%define tex LaTeX
%endif
%define gviz graphviz graphviz-gd
BuildRequires: fdupes
%else # <= 10.2
%define tex te_latex te_pdf
%define gviz graphviz
%endif
%else # not openSUSE
%define gviz graphviz
%endif

%define lname libtbcinumlib

Vendor:       SuSE GmbH, Nuernberg, Germany
#Distribution: openSuSE 11.0
Name:         libtbcinumlib2_8
Provides:	tbci_numlib
Obsoletes:	tbci_numlib
Packager:     garloff@suse.de
BuildRequires: gcc gcc-c++ libstdc++-devel doxygen %{gviz} %{tex} autoconf automake libtool ghostscript libsuperlu-devel
%if 0%{?suse_version} > 1500 || 0%{?sle_version} >= 150000
BuildRequires: hostname -net-tools
%endif
%ifnarch %arm
%if 0%{?suse_version} == 0 || 0%{?suse_version} > 1120
BuildRequires:	libnuma-devel
%endif
%endif
# Fedora pulls in gnome-mount which needs a PolicyKit-authentication-agent bug can't
# decide whether to use PolicyKit-kde or PolicyKit-gnome -- ouch!
%if 0%{?fedora_version} == 11
BuildRequires: PolicyKit-gnome
%endif
#Copyright:    Kurt Garloff
License:      LGPL-2.1-or-later
Group:        Development/Libraries
Autoreqprov:  on
Version:      2.8.2
Release:      0
Summary:      TBCI templated numerical C++ library
Source:	      http://plasimo.phys.tue.nl/TBCI/numlib/numlib/numlib-%{version}.tar.bz2
#Patch: 
BuildRoot:    %{_tmppath}/%{name}-buildroot
Prefix:	      /usr
%description
This package contains a templated numerics library in written in C++.
To avoid performance problems, the Temporary Base Class Idiom (TBCI)
has been used. Basically, it means that temporaries are the base class
of the real objects. However, their copying behaviour differs, thus
elimintating lots of unecessary copying when writing expressions like
Vector a = b + c;

 Authors:
 Kurt Garloff <kurt@garloff.de>
 Attila Bilgic, Andreas Ahland, Jens Lenge, JL Tinoco, and other
 colleagues from HFT, E-Technik, Univ. Dortmund.
 Jan v Dijk, Bart Hartgers, Harm vd Heijden and various colleagues
 from ETP/EPG, TU Eindhoven.


%if 0%{?suse_version} > 0
%debug_package
%endif

%if 0%{?__debug_package} == 0
%define mystrip -s
%endif


%package -n libtbcisuperlu2_8
Requires: libtbcinumlib2_8 = %version
Summary: SuperLU interface for TBCI
Group:        Development/Libraries

%description -n libtbcisuperlu2_8
SuperLU is a very good direct solver for linear systems.
The TBCI::CSCMatrix<> class uses a storage layout copmatible with the
SuperLU solver. This package provides a shared library that allows you
to use the superlu solver. 


%package -n libtbcinumlib-devel
Requires: libtbcinumlib2_8 = %version
Summary: Headers and other files needed for development with TBCI
Group:        Development/Libraries
%if 0%{?suse_version} > 1000
Recommends: libtbcinumlib-doc
Recommends: libtbcisuperlu2_8 = %version
Recommends: libsuperlu-devel
%endif

%description -n libtbcinumlib-devel
libtbcinumlib is a numerical library in C++ that uses the Temporary
Base Class Idiom to avoid unnecessary copying of (temporary) data.
It also features delayed evaluation for some expressions .
The library comes with containers like vectors and various
sparse matrix containers as well as a collection of linear solvers.

The -devel subpackage contains the files needed for development with
TBCI, i.e. headers, and the .so files to link against.

%package -n libtbcinumlib-doc
Summary: Documentation for the TBCI numerical library
Group:        Development/Libraries
%if 0%{?suse_version} > 1000
Supplements: libtbcinumlib-devel
%endif

%description -n libtbcinumlib-doc
libtbcinumlib is a numerical library in C++ that uses the Temporary
Base Class Idiom to avoid unnecessary copying of (temporary) data.
It also features delayed evaluation for some expressions .
The library comes with containers like vectors and various
sparse matrix containers as well as a collection of linear solvers.

The -doc subpackage contains the documentation for the library;
it consists of a whitepaper describing the concept and the automatically
generated library documentation (created by doxygen).

%prep
%setup -n numerix-2.0
# Nothing to do ...

%build
export CC=gcc
%if 0%{?suse_version} >= 1000
%define optgen OPT_GENERIC=1
%else
%define optgen NOOPTGEN=1
%endif
%ifarch i386 i486 i586 i686
echo "*** ix86: Build standard and SSE2 variants ***"
%endif
%ifarch x86_64
RPM_OPT_FLAGS="$RPM_OPT_FLAGS -msse3"
%endif
# make -f Makefile.dist
#./configure --mandir=%{_mandir} --infodir=%{_infodir} --enable-optimize --with-isoc99 --enable-smp
cd lina
./autogen.sh
#autoreconf --force
SYSDEP=$(make output-sysdep)
RPM_OPT_FLAGS="`echo $RPM_OPT_FLAGS | sed -e 's/\-O2//' -e 's/\-fstack\-protector[^ ]*//'`"
# configure will be called by make
#./configure --mandir=%{_mandir} --infodir=%{_infodir} --enable-optimize --enable-isoc99 --enable-smp
make %{?jobs:-j%jobs} OPT=1 %optgen SMP=1 EXTRA_CFLAGS="$RPM_OPT_FLAGS"
make -i -f Makefile.dox
cd ../bench
make %{?jobs:-j%jobs} OPT=1 %optgen SMP=1 EXTRA_CFLAGS="$RPM_OPT_FLAGS"
cd ../doc
make -i doc.pdf
cd ../lina
%ifarch i386 i486 i586 i686
#make include/basics_gd.h SYSDEP=ix86-sse2 OPT=1 OPT_ARCH=1 %optgen SMP=1 EXTRA_CFLAGS="-msse2"
make %{?jobs:-j%jobs} SYSDEP=ix86-linux-sse2 OPT=1 OPT_ARCH=1 %optgen SMP=1 EXTRA_CFLAGS="-msse2 $RPM_OPT_FLAGS"
cd ../bench
make %{?jobs:-j%jobs} SYSDEP=ix86-linux-sse2 OPT=1 OPT_ARCH=1 %optgen SMP=1 EXTRA_CFLAGS="-msse2 -DTBCI_SIMD_SUM -DBDMATVEC_DIAGWISE -DBICGSTAB_RESTART $RPM_OPT_FLAGS"
%endif
%if %{build_avx2} >= 1
make %{?jobs:-j%jobs} SYSDEP=x86_64-linux-avx2 OPT=1 OPT_ARCH=1 %optgen SMP=1 EXTRA_CFLAGS="-mavx2 $RPM_OPT_FLAGS"
cd ../bench
make %{?jobs:-j%jobs} SYSDEP=x86_64-linux-avx2 OPT=1 OPT_ARCH=1 %optgen SMP=1 EXTRA_CFLAGS="-mavx2 -DTBCI_SIMD_SUM -DBDMATVEC_DIAGWISE -DBICGSTAB_RESTART $RPM_OPT_FLAGS"
%endif
cd ..

#%check
# Regression test
cd lina/%{arch}-linux-gcc*/test
#make tbci
make %{?jobs:-j%jobs} OPT=1 %optgen SMP=1 EXTRA_CFLAGS="$RPM_OPT_FLAGS"
./correctness
./correctness_double
./correctness_float
%ifarch x86_64
make %{?jobs:-j%jobs} OPT=1 %optgen SMP=1 simd EXTRA_CFLAGS="$RPM_OPT_FLAGS"
./correctness_double_simd
./correctness_float_simd
%endif
./test_malloc_smp
./test_matrix2
./test_smp
./test_smp_std_complex
./test_transpose
./test_tsmat
./test_tsfabs
make clean SMP=1
cd ../../..

%install
rm -rf "$RPM_BUILD_ROOT"
mkdir %buildroot
#mkdir -p "$RPM_BUILD_ROOT"{/etc,%{_mandir}/man{1,8},/bin,/sbin,/usr/bin,/usr/sbin}
# Header installation
mkdir -p $RPM_BUILD_ROOT%{prefix}/include/tbci
#make DESTDIR=$RPM_BUILD_ROOT install
cp -ax lina/include/* $RPM_BUILD_ROOT%{prefix}/include/tbci/
#cp -ax lina/interface $RPM_BUILD_ROOT%{prefix}/include/tbci/
for name in tbci_version basics config_manual constants lapack lapack_stdcplx list LM_fit except bool builtin_cplx cost mathplus matrix_sig my_nr smp specfun specfun_stdcplx stopwatch vector_sig plain_def unroll_prefetch_def unroll_prefetch_def2 perf_opt malloc_cache cplx_memalloc matrix_kernels tbci_traits vector_extra unroll_prefetch_simd_def vec_kern_special vec_kern_unr_pref unroll_prefetch_simd_def; do \
	rm -f $RPM_BUILD_ROOT%{prefix}/include/tbci/${name}_gd.h; done
#cp -p lina/tbciconfig.h $RPM_BUILD_ROOT%{prefix}/include/tbci/
# TBCI library install
mkdir -p $RPM_BUILD_ROOT%{prefix}/%{_lib}
for name in lina/%{arch}-linux-gcc*/libtbci*.{a,so.%{version}}; do \
	test -e $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/%{_lib}/; done
for name in $RPM_BUILD_ROOT%{prefix}/%{_lib}/libtbci*.so.%{version}; do \
	NM=${name##*/}; ln -sf $NM ${name%.?}; ln -sf ${NM%.?} ${name%.?.?};
	ln -sf ${NM%.?.?} ${name%.?.?.?}; done
# Bench & auto_decl binary install
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin
for name in bench/%{arch}-linux-gcc*/{solver_,lib}bench_*; do \
	test -x $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/bin/; done
#/usr/bin/install %{?mystrip} utils/%{arch}-linux-*/auto_decl $RPM_BUILD_ROOT%{prefix}/bin/
/usr/bin/install %{?mystrip} lina/%{arch}-linux-gcc*/auto_decl $RPM_BUILD_ROOT%{prefix}/bin/
# Docu install
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{lname}
cp -ax lina/doxygen/html $RPM_BUILD_ROOT%{_docdir}/%{lname}/
for name in README README.* TODO COPYING.LIB ANNOUNCE-* lina/Version lina/source/smp.cc; do \
	cp -p $name $RPM_BUILD_ROOT%{_docdir}/%{lname}/ ; done
%if 0%{?suse_version} > 0
	cp -p doc/doc.pdf $RPM_BUILD_ROOT%{_docdir}/%{lname}/
%endif
# Test sources
#make -C lina/test clean
rm -rf lina/test/.deps
rm -f lina/test/tbci
#mkdir $RPM_BUILD_ROOT%{_docdir}/%{lname}/test
cp -ax lina/test $RPM_BUILD_ROOT%{_docdir}/%{lname}/
# sse2 on i686
%ifarch i386 i486 i586 i686
mkdir -p $RPM_BUILD_ROOT%{prefix}/%{_lib}/sse2
for name in lina/ix86-linux-sse2/libtbci*.{a,so.%{version}}; do \
	test -e $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/%{_lib}/sse2/; done
for name in $RPM_BUILD_ROOT%{prefix}/%{_lib}/sse2/libtbci*.so.%{version}; do \
	NM=${name##*/}; ln -sf $NM ${name%.?}; ln -sf ${NM%.?} ${name%.?.?};
	ln -sf ${NM%.?.?} ${name%.?.?.?}; done
# Bench & auto_decl binary install
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin
for name in bench/ix86-linux-sse2/{solver_,lib}bench_*; do \
	NM=${name##*/}
	test -x $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/bin/${NM}_sse2; done
%endif
# avx2 on x86_64
%if %{build_avx2} >= 1
mkdir -p $RPM_BUILD_ROOT%{prefix}/%{_lib}/avx2
for name in lina/x86_64-linux-avx2/libtbci*.{a,so.%{version}}; do \
	test -e $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/%{_lib}/avx2/; done
for name in $RPM_BUILD_ROOT%{prefix}/%{_lib}/avx2/libtbci*.so.%{version}; do \
	NM=${name##*/}; ln -sf $NM ${name%.?}; ln -sf ${NM%.?} ${name%.?.?};
	ln -sf ${NM%.?.?} ${name%.?.?.?}; done
# Bench & auto_decl binary install
mkdir -p $RPM_BUILD_ROOT%{prefix}/bin
for name in bench/x86_64-linux-avx2/{solver_,lib}bench_*; do \
	NM=${name##*/}
	test -x $name && /usr/bin/install %{?mystrip} $name $RPM_BUILD_ROOT%{prefix}/bin/${NM}_avx2; done
%endif
%if 0%{?suse_version} > 1020
%fdupes $RPM_BUILD_ROOT%{_docdir}/%{lname}
%endif
%{?suse_check}
# %{?__debug_install_post} 

%files
%defattr(-,root,root)
%{prefix}/bin/*bench*
%{prefix}/%{_lib}/libtbci[cdl]*.so.2*
%{prefix}/%{_lib}/libtbcis[ptm]*.so.2*
%ifarch i386 i486 i586 i686
%dir %{prefix}/%{_lib}/sse2
%{prefix}/%{_lib}/sse2/libtbci[cdl]*.so.2*
%{prefix}/%{_lib}/sse2/libtbcis[ptm]*.so.2*
%endif
%if %{build_avx2} >= 1
%dir %{prefix}/%{_lib}/avx2
%{prefix}/%{_lib}/avx2/libtbci[cdl]*.so.2*
%{prefix}/%{_lib}/avx2/libtbcis[ptm]*.so.2*
%endif


%files -n libtbcisuperlu2_8
%defattr(-,root,root)
%{prefix}/%{_lib}/libtbcisuperlu*.so.2*
%ifarch i386 i486 i586 i686
%{prefix}/%{_lib}/sse2/libtbcisuperlu*.so.2*
%endif
%if %{build_avx2} >= 1
%{prefix}/%{_lib}/avx2/libtbcisuperlu*.so.2*
%endif

%files -n libtbcinumlib-devel
%defattr(-,root,root)
%{prefix}/bin/auto_decl
%{prefix}/include/tbci
%{prefix}/%{_lib}/libtbci*.so
%ifarch i386 i486 i586 i686
%{prefix}/%{_lib}/sse2/libtbci*.so
%endif
%if %{build_avx2} >= 1
%{prefix}/%{_lib}/avx2/libtbci*.so
%endif

%files -n libtbcinumlib-doc
%defattr(-,root,root)
%doc %{_docdir}/%{lname}
#%doc README README.* TODO COPYING.LIB ANNOUNCE-*
#%doc doc/doc.pdf lina/Version
#%docdir % {_docdir}/% {lname}


%clean
if [ -n "$RPM_BUILD_ROOT" ] ; then
   [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
fi

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n libtbcisuperlu2_8 -p /sbin/ldconfig

%postun -n libtbcisuperlu2_8 -p /sbin/ldconfig

%changelog
* Mon Aug 16 2010 - garloff@suse.de
- Update to version 2.6.2
  . Compile fix for gcc 4.5
  . Optional use of hot/cold gcc attributes
* Tue May 26 2009 - garloff@suse.de
- Update to version 2.6.1
  . Package split
* Tue May 26 2009 - garloff@suse.de
- Update to version 2.6.0
* Fri Nov 21 2008 - garloff@suse.de
- Update to version 2.5.6
- Install tbciconfig.h
- Remove more unused *_gd.h files
* Wed Jul 09 2008 - garloff@suse.de  
- Update to version 2.5.5.  
* Wed Jun 20 2001 - garloff@suse.de
- Creation of spec file.
openSUSE Build Service is sponsored by