lapacke.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/bash
  2. # Slackware build script for LAPACKE
  3. # Copyright 2016-2022 Kyle Guinn <elyk03@gmail.com>
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. cd $(dirname $0) ; CWD=$(pwd)
  23. PRGNAM=lapacke
  24. SRCNAM=lapack
  25. VERSION=${VERSION:-3.11.0}
  26. BUILD=${BUILD:-1}
  27. TAG=${TAG:-_SBo}
  28. PKGTYPE=${PKGTYPE:-tgz}
  29. if [ -z "$ARCH" ]; then
  30. case "$(uname -m)" in
  31. i?86) ARCH=i586 ;;
  32. arm*) ARCH=arm ;;
  33. *) ARCH=$(uname -m) ;;
  34. esac
  35. fi
  36. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  37. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  38. exit 0
  39. fi
  40. TMP=${TMP:-/tmp/SBo}
  41. PKG=$TMP/package-$PRGNAM-$VERSION
  42. OUTPUT=${OUTPUT:-/tmp}
  43. DOCS="LAPACKE/LICENSE LAPACKE/README DOCS/lapacke.pdf"
  44. if [ "$ARCH" = "i586" ]; then
  45. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  46. elif [ "$ARCH" = "i586" ]; then
  47. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  48. elif [ "$ARCH" = "i686" ]; then
  49. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  50. elif [ "$ARCH" = "x86_64" ]; then
  51. SLKCFLAGS="-O2 -fPIC"
  52. else
  53. SLKCFLAGS="-O2"
  54. fi
  55. set -e
  56. rm -rf $PKG
  57. mkdir -p $TMP $PKG $OUTPUT
  58. cd $TMP
  59. rm -rf $SRCNAM-$VERSION
  60. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  61. cd $SRCNAM-$VERSION
  62. chown -R root:root .
  63. chmod -R u+w,go-w,a+rX-st .
  64. # Allow building only the LAPACKE component.
  65. patch -p1 < $CWD/patches/cmake-piecewise.diff
  66. if pkg-config --exists xblas; then
  67. use_xblas='-DUSE_XBLAS=ON'
  68. fi
  69. # Avoid adding an RPATH entry to the shared lib. It's unnecessary (except for
  70. # running the test suite), and it's broken on 64-bit (needs LIBDIRSUFFIX).
  71. mkdir -p shared
  72. cd shared
  73. cmake \
  74. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  75. -DCMAKE_INSTALL_PREFIX=/usr \
  76. -DCMAKE_BUILD_TYPE=None \
  77. -DCMAKE_RULE_MESSAGES=OFF \
  78. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  79. -DUSE_OPTIMIZED_LAPACK=ON \
  80. -DBUILD_LAPACKE=ON \
  81. -DBUILD_DEPRECATED=ON \
  82. $use_xblas \
  83. -DBUILD_SHARED_LIBS=ON \
  84. -DCMAKE_SKIP_RPATH=YES \
  85. ..
  86. make
  87. make install/strip DESTDIR=$PKG
  88. cd ..
  89. # cmake doesn't appear to let us build both shared and static libs
  90. # at the same time, so build it twice. This may build a non-PIC library
  91. # on some architectures, which should be faster.
  92. if [ "${STATIC:-no}" != "no" ]; then
  93. mkdir -p static
  94. cd static
  95. cmake \
  96. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  97. -DCMAKE_INSTALL_PREFIX=/usr \
  98. -DCMAKE_BUILD_TYPE=None \
  99. -DCMAKE_RULE_MESSAGES=OFF \
  100. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  101. -DUSE_OPTIMIZED_LAPACK=ON \
  102. -DBUILD_LAPACKE=ON \
  103. -DBUILD_DEPRECATED=ON \
  104. $use_xblas \
  105. ..
  106. make
  107. make install/strip DESTDIR=$PKG
  108. cd ..
  109. fi
  110. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  111. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  112. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  113. mkdir -p $PKG/install
  114. cat $CWD/slack-desc > $PKG/install/slack-desc
  115. cd $PKG
  116. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE