lapacke.SlackBuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #!/bin/bash
  2. # Slackware build script for LAPACKE
  3. # Copyright 2016-2021 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.10.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 the variable PRINT_PACKAGE_NAME is set, then this script will report what
  37. # the name of the created package would be, and then exit. This information
  38. # could be useful to other scripts.
  39. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  40. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  41. exit 0
  42. fi
  43. TMP=${TMP:-/tmp/SBo}
  44. PKG=$TMP/package-$PRGNAM-$VERSION
  45. OUTPUT=${OUTPUT:-/tmp}
  46. DOCS="LAPACKE/LICENSE LAPACKE/README DOCS/lapacke.pdf"
  47. if [ "$ARCH" = "i486" ]; then
  48. SLKCFLAGS="-O2 -march=i486 -mtune=i686"
  49. elif [ "$ARCH" = "i586" ]; then
  50. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  51. elif [ "$ARCH" = "i686" ]; then
  52. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  53. elif [ "$ARCH" = "x86_64" ]; then
  54. SLKCFLAGS="-O2 -fPIC"
  55. else
  56. SLKCFLAGS="-O2"
  57. fi
  58. set -e
  59. rm -rf $PKG
  60. mkdir -p $TMP $PKG $OUTPUT
  61. cd $TMP
  62. rm -rf $SRCNAM-$VERSION
  63. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  64. cd $SRCNAM-$VERSION
  65. chown -R root:root .
  66. chmod -R u+w,go-w,a+rX-st .
  67. # Allow building only the LAPACKE component.
  68. patch -p1 < $CWD/patches/cmake-piecewise.diff
  69. if pkg-config --exists xblas; then
  70. use_xblas='-DUSE_XBLAS=ON'
  71. fi
  72. # Avoid adding an RPATH entry to the shared lib. It's unnecessary (except for
  73. # running the test suite), and it's broken on 64-bit (needs LIBDIRSUFFIX).
  74. mkdir -p shared
  75. cd shared
  76. cmake \
  77. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  78. -DCMAKE_INSTALL_PREFIX=/usr \
  79. -DCMAKE_BUILD_TYPE=None \
  80. -DCMAKE_RULE_MESSAGES=OFF \
  81. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  82. -DUSE_OPTIMIZED_LAPACK=ON \
  83. -DBUILD_LAPACKE=ON \
  84. -DBUILD_DEPRECATED=ON \
  85. $use_xblas \
  86. -DBUILD_SHARED_LIBS=ON \
  87. -DCMAKE_SKIP_RPATH=YES \
  88. ..
  89. make
  90. make install/strip DESTDIR=$PKG
  91. cd ..
  92. # cmake doesn't appear to let us build both shared and static libs
  93. # at the same time, so build it twice. This may build a non-PIC library
  94. # on some architectures, which should be faster.
  95. if [ "${STATIC:-no}" != "no" ]; then
  96. mkdir -p static
  97. cd static
  98. cmake \
  99. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  100. -DCMAKE_INSTALL_PREFIX=/usr \
  101. -DCMAKE_BUILD_TYPE=None \
  102. -DCMAKE_RULE_MESSAGES=OFF \
  103. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  104. -DUSE_OPTIMIZED_LAPACK=ON \
  105. -DBUILD_LAPACKE=ON \
  106. -DBUILD_DEPRECATED=ON \
  107. $use_xblas \
  108. ..
  109. make
  110. make install/strip DESTDIR=$PKG
  111. cd ..
  112. fi
  113. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  114. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  115. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  116. mkdir -p $PKG/install
  117. cat $CWD/slack-desc > $PKG/install/slack-desc
  118. cd $PKG
  119. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE