#Packager: George Vlahavas # # adapted from the SlackBuild by Kyle Guinn: # https://slackbuilds.org/slackbuilds/14.1/libraries/lapack/lapack.SlackBuild pkgname=lapack pkgver=3.6.0 pkgrel=1gv source=("http://www.netlib.org/lapack/lapack-$pkgver.tgz" "cmake-piecewise.diff" "generate-pkgconfig.diff" "link-dependencies.diff" "target-cleanup.diff") docs=("readme" "install" "copying" "changelog" "authors" "news" "todo" "license") url=http://www.netlib.org/blas slackdesc=\ ( #|-----handy-ruler------------------------------------------------------| "lapack (Linear Algebra PACKage)" "LAPACK provides routines for solving systems of simultaneous linear" "equations, least-squares solutions of linear systems of equations," "eigenvalue problems, and singular value problems. The associated" "matrix factorizations (LU, Cholesky, QR, SVD, Schur, generalized" "Schur) are also provided, as are related computations such as" "reordering of the Schur factorizations and estimating condition" "numbers. Dense and banded matrices are handled, but not general sparse" "matrices. In all areas, similar functionality is provided for real and" "complex matrices, in both single and double precision." ) build() { cd $startdir/src/lapack-$pkgver # Fix lots of bugs with the cmake build system and .pc files. # More importantly, allow building only the LAPACK component. patch -p1 < $startdir/src/generate-pkgconfig.diff patch -p1 < $startdir/src/link-dependencies.diff patch -p1 < $startdir/src/target-cleanup.diff patch -p1 < $startdir/src/cmake-piecewise.diff # Avoid adding an RPATH entry to the shared lib. It's unnecessary (except for # running the test suite), and it's broken on 64-bit (needs LIBDIRSUFFIX). mkdir -p shared cd shared cmake \ -DCMAKE_Fortran_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_TYPE=None \ -DCMAKE_RULE_MESSAGES=OFF \ -DCMAKE_VERBOSE_MAKEFILE=TRUE \ -DUSE_OPTIMIZED_BLAS=ON \ -DBUILD_LAPACK=ON \ -DBUILD_TESTING=OFF \ -DBUILD_SHARED_LIBS=ON \ -DCMAKE_SKIP_RPATH=YES \ .. make -j $numjobs make install/strip DESTDIR=$startdir/pkg cd .. # cmake doesn't appear to let us build both shared and static libs # at the same time, so build it twice. This may build a non-PIC library # on some architectures, which should be faster. mkdir -p static cd static cmake \ -DCMAKE_Fortran_FLAGS:STRING="$SLKCFLAGS" \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_TYPE=None \ -DCMAKE_RULE_MESSAGES=OFF \ -DCMAKE_VERBOSE_MAKEFILE=TRUE \ -DUSE_OPTIMIZED_BLAS=ON \ -DBUILD_LAPACK=ON \ -DBUILD_TESTING=OFF \ .. make -j $numjobs make install/strip DESTDIR=$startdir/pkg cd .. # Generate man pages. Also requires some fix-ups: # 0. Join all escaped newlines so the entire value is replaced. # 1. Only generate on the LAPACK sources. # 2. Turn off recursion. Only operate on directories in INPUT. # 3. Turn off some repetitive comments. # 4. Turn off HAVE_DOT. Graphs are unnecessary for this purpose. # 5. Turn off MAN_LINKS. See below. sed -i \ -e ':a;/\\$/N;s/\\\n//;ta' \ -e 's/^\(INPUT *=\).*/\1 SRC/' \ -e 's/^\(RECURSIVE *=\).*/\1 NO/' \ -e 's/^\(REPEAT_BRIEF *=\).*/\1 NO/' \ -e 's/^\(HAVE_DOT *=\).*/\1 NO/' \ -e 's/^\(MAN_LINKS *=\).*/\1 NO/' \ DOCS/Doxyfile_man doxygen DOCS/Doxyfile_man # Doxygen generates manpages on a file-by-file basis (note the .f extensions). # We want a page for each function, not each file. MAN_LINKS creates a page # for each function that just sources the page for the corresponding file. # This adds a lot of bloat. Luckily, functions map 1:1 with files, so we can # rename .f.3 -> .3 to have the page named after the function. mkdir -p $startdir/pkg/usr/man/man3 for i in DOCS/man/man3/*.f.3; do gzip -9c $i > $startdir/pkg/usr/man/man3/$(basename $i .f.3).3.gz done # Fix up some special cases where the mapping isn't 1:1. ln -s sladiv.3.gz $startdir/pkg/usr/man/man3/sladiv1.3.gz ln -s sladiv.3.gz $startdir/pkg/usr/man/man3/sladiv2.3.gz ln -s dladiv.3.gz $startdir/pkg/usr/man/man3/dladiv1.3.gz ln -s dladiv.3.gz $startdir/pkg/usr/man/man3/dladiv2.3.gz # Generate a few more man pages from the INSTALL directory, but copy only a # select few. Some are duplicated by BLAS (lsame.f), by LAPACK (ilaver.f), # are unused (slamchf77.f, dlamchf77.f), or are test programs. rm -rf DOCS/man sed -i 's/^\(INPUT *=\).*/\1 INSTALL/' DOCS/Doxyfile_man doxygen DOCS/Doxyfile_man gzip -9c DOCS/man/man3/slamch.f.3 > $startdir/pkg/usr/man/man3/slamch.3.gz gzip -9c DOCS/man/man3/dlamch.f.3 > $startdir/pkg/usr/man/man3/dlamch.3.gz ln -s slamch.3.gz $startdir/pkg/usr/man/man3/slamc3.3.gz ln -s dlamch.3.gz $startdir/pkg/usr/man/man3/dlamc3.3.gz # The timer implementation is chosen at configure time. Install the pages for # all implementations and create a link for the chosen one. for i in DOCS/man/man3/second_*.f.3 DOCS/man/man3/dsecnd_*.f.3; do gzip -9c $i > $startdir/pkg/usr/man/man3/$(basename $i .f.3).3.gz done TIME_FUNC=$(grep '^TIME_FUNC' shared/CMakeCache.txt | cut -f2 -d=) if [ -n "${TIME_FUNC}" ]; then ln -s second_${TIME_FUNC}.3.gz $startdir/pkg/usr/man/man3/second.3.gz ln -s dsecnd_${TIME_FUNC}.3.gz $startdir/pkg/usr/man/man3/dsecnd.3.gz fi }