Пакет dakota: Specfile

%define mpiimpl openmpi
%define mpidir %_libexecdir/%mpiimpl

%define teuver 10
Name: dakota
Version: 5.1
%define somver 0
%define sover %somver.0.0
Release: alt1
Epoch: 1
Summary: Design Analysis Kit for Optimization and Terascale Applications
License: LGPL v2.1
Group: Sciences/Mathematics
Url: http://www.cs.sandia.gov/dakota/software.html
Packager: Eugeny A. Rostovtsev (REAL) <real at altlinux.org>

Source: Dakota_stable.src.tar

Requires: lib%name = %epoch:%version-%release

BuildPreReq: gcc-fortran gcc-c++ libnumpy-devel python-devel cmake
BuildPreReq: liblapack-goto-devel doxygen libXtst-devel librandom-devel
BuildPreReq: libteuchos%teuver-devel libnewmat-devel libfftw3-mpi-devel
BuildPreReq: libICE-devel libSM-devel libX11-devel libXau-devel
BuildPreReq: libXext-devel libXt-devel zlib-devel libplplot-devel
BuildPreReq: boost-devel cppunit-devel flex imake libXmu-devel libXp-devel
BuildPreReq: libXpm-devel libarprec-devel libexpat-devel libfreetype-devel
BuildPreReq: libgd2-devel libjpeg-devel libltdl-devel libcurl-devel
BuildPreReq: libopenmotif-devel libpng-devel libtrilinos%teuver-devel
BuildPreReq: libxml2-devel openmpi-devel svgalib-devel plplot-tk
BuildPreReq: texlive-fonts-recommended texlive-generic-recommended
BuildPreReq: texlive-xetex chrpath
BuildPreReq: libplplot-fortran-devel libstdc++-devel
BuildPreReq: boost-program_options-devel libgsl-devel
Requires: plplot-tk libnewmat

%description
A Multilevel Parallel Object-Oriented Framework for Design Optimization,
Parameter Estimation, Uncertainty Quantification, and Sensitivity
Analysis.

%package doc
Summary: Documentation for DAKOTA
Group: Documentation
BuildArch: noarch

%description doc
A Multilevel Parallel Object-Oriented Framework for Design Optimization,
Parameter Estimation, Uncertainty Quantification, and Sensitivity
Analysis.

This package contains documentation for DAKOTA.


%package -n lib%name
Summary: Shared libraries of DAKOTA
Group: System/Libraries
Requires: libteuchos%teuver
Requires: libplplot libnewmat

%description -n lib%name
A Multilevel Parallel Object-Oriented Framework for Design Optimization,
Parameter Estimation, Uncertainty Quantification, and Sensitivity
Analysis.

This package contains shared libraries of DAKOTA.

%package -n lib%name-devel
Summary: Development files of DAKOTA
Group: Development/C++
Requires: lib%name = %epoch:%version-%release
#Requires: libteuchos%teuver-devel
#Requires: libplplot-devel libplplot-fortran-devel libnewmat-devel
#Requires: boost-devel

%description -n lib%name-devel
A Multilevel Parallel Object-Oriented Framework for Design Optimization,
Parameter Estimation, Uncertainty Quantification, and Sensitivity
Analysis.

This package contains development files of DAKOTA.

%prep
%setup

cp packages/pecos/packages/LHS/mods/Cparam.f90 \
	packages/pecos/packages/LHS/mods/cparam.mod
cp packages/OPTPP/include/Constraint.h \
	packages/OPTPP/include/DConstraint.h
rm -fR methods/OPTPP/newmat11 \
	packages/plplot packages/boost packages/teuchos \
	packages/pecos/packages/fftw packages/OPTPP/newmat11

sed -i 's|@SOVERSION@|%somver|g' src/CMakeLists.txt \
	packages/pecos/packages/VPISparseGrid/src/CMakeLists.txt
sed -i 's|@VERSION@|%sover|g' src/CMakeLists.txt \
	packages/pecos/packages/VPISparseGrid/src/CMakeLists.txt

%build
mpi-selector --set %mpiimpl
source %mpidir/bin/mpivars.sh
export OMPI_LDFLAGS="-Wl,--as-needed,-Rpath=%mpidir/lib -L%mpidir/lib"

DEFS="-DOPT_COMPATIBLE -DArith_Kind_ASL=1 -DIEEE_8087=1 -DUSING_DOUBLE"
DEFS="$DEFS -Duse_namespace -DHAVE_TEUCHOS_BLASFLOAT -DOMPI_SKIP_MPICXX"
INCS="-I%_includedir/X11 -I%mpidir/include -I%_includedir/arprec"
INCS="$INCS -I%_includedir/numpy -I%_includedir/newmat"
INCS="$INCS -I%_includedir/plplot -I%_includedir/fftw3-mpi"
INCS="$INCS -I%_includedir/plplot"
DEFS="-DOPT_COMPATIBLE -DArith_Kind_ASL=1 -DIEEE_8087=1 -DUSING_DOUBLE"
%add_optflags $INCS -fno-strict-aliasing $DEFS %optflags_shared
LIBS="-larprec -lexpat -lxml2 -ldl -lXmu -lXm -lXt -lpthread -lm"
LIBS="$LIBS -lteuchos -llapack -lgoto2 -lgfortran"
LIBS="$LIBS -L%mpidir/lib -lmpi_cxx -lmpi -Wl,-R%mpidir/lib -lstdc++"
export MPIDIR=%mpidir
export LIBTOOLDIR=$PWD
%configure \
       --includedir=%_includedir/%name \
       --enable-shared \
       --disable-static \
       --enable-docs \
       --without-acro \
       --with-teuchos-include=%_includedir \
       --with-teuchos-lib=%_libdir \
       --with-incdirs="$INCS" \
       --with-blas=goto2 \
       --with-lapack=lapack \
       --enable-f77 \
       --with-boost=%_includedir \
       --with-x \
       --with-gsl=%prefix \
       --enable-teuchos-arprec \
       --with-libs="$LIBS" \
       --enable-teuchos-expat \
       --enable-teuchos-libxml2 \
       --enable-teuchos-boost \
       --enable-mpi \
       --with-mpi=%mpidir \
       --with-python \
       --with-graphics \
       --with-plugin \
			 --without-ampl

%make_build

pushd docs
%make pdf
%make -C latex-user pdf-local
doxygen
popd

%install
source %mpidir/bin/mpivars.sh
export OMPI_LDFLAGS="-Wl,--as-needed,-Rpath=%mpidir/lib -L%mpidir/lib"

export MPIDIR=%mpidir
export LIBTOOLDIR=$PWD

%makeinstall_std

install -d %buildroot%_datadir/%name
mv %buildroot%_bindir/%name.input.* %buildroot%_datadir/%name/
install -d %buildroot%_docdir/%name
install -m644 docs/latex-user/*.pdf %buildroot%_docdir/%name

# make all static as shared libraries
pushd %buildroot%_libdir
for i in libncsuopt libnidr
do
	mpic++ -shared -Wl,--whole-archive $i.a -Wl,--no-whole-archive \
		-o $i.so.%sover -Wl,-soname,$i.so.%somver  -L. -ldakota \
		-llapack -lgoto2 -lm \
		-L%mpidir/lib -Wl,-R%mpidir/lib -lgfortran -Wl,-z,defs
	ln -s $i.so.%sover $i.so.%somver
	ln -s $i.so.%somver $i.so
done
popd

for i in %buildroot%_bindir/* %buildroot%_libdir/*.so
do
	chrpath -r %mpidir/lib $i ||:
done

install -d %buildroot%_man3dir
install -m644 docs/man-dev/man3/* %buildroot%_man3dir

%files
%doc COPYRIGHT LICENSE README
%_bindir/*
%_datadir/%name

%files doc
%doc docs/latex-user/*.pdf
%doc docs/html-dev
%_docdir/%name
%_man3dir/*

%files -n lib%name
%_libdir/*.so.*

%files -n lib%name-devel
%_libdir/*.so
%_includedir/*

%changelog
* Fri Apr 22 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 1:5.1-alt1
- Version 5.1

* Thu Apr 14 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 20101304-alt4
- Rebuilt

* Fri Apr 08 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 20101304-alt3
- Built with GotoBLAS instead of ATLAS
- Disabled build static libraries

* Mon Mar 14 2011 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 20101304-alt2
- Rebuilt for debuginfo

* Sat Nov 06 2010 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 20101304-alt1
- Initial build for Sisyphus