cblas.SlackBuild 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. #!/bin/bash
  2. # Slackware build script for CBLAS
  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=cblas
  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="LICENSE CBLAS/README"
  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 CBLAS component.
  65. patch -p1 < $CWD/patches/cmake-piecewise.diff
  66. # Avoid adding an RPATH entry to the shared lib. It's unnecessary (except for
  67. # running the test suite), and it's broken on 64-bit (needs LIBDIRSUFFIX).
  68. mkdir -p shared
  69. cd shared
  70. cmake \
  71. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  72. -DCMAKE_Fortran_FLAGS:STRING="$SLKCFLAGS" \
  73. -DCMAKE_INSTALL_PREFIX=/usr \
  74. -DCMAKE_BUILD_TYPE=None \
  75. -DCMAKE_RULE_MESSAGES=OFF \
  76. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  77. -DUSE_OPTIMIZED_BLAS=ON \
  78. -DBUILD_CBLAS=ON \
  79. -DBUILD_SHARED_LIBS=ON \
  80. -DCMAKE_SKIP_RPATH=YES \
  81. ..
  82. make
  83. make install/strip DESTDIR=$PKG
  84. cd ..
  85. # cmake doesn't appear to let us build both shared and static libs
  86. # at the same time, so build it twice. This may build a non-PIC library
  87. # on some architectures, which should be faster.
  88. if [ "${STATIC:-no}" != "no" ]; then
  89. mkdir -p static
  90. cd static
  91. cmake \
  92. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  93. -DCMAKE_Fortran_FLAGS:STRING="$SLKCFLAGS" \
  94. -DCMAKE_INSTALL_PREFIX=/usr \
  95. -DCMAKE_BUILD_TYPE=None \
  96. -DCMAKE_RULE_MESSAGES=OFF \
  97. -DCMAKE_VERBOSE_MAKEFILE=TRUE \
  98. -DUSE_OPTIMIZED_BLAS=ON \
  99. -DBUILD_CBLAS=ON \
  100. ..
  101. make
  102. make install/strip DESTDIR=$PKG
  103. cd ..
  104. fi
  105. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  106. cp -a $DOCS $PKG/usr/doc/$PRGNAM-$VERSION
  107. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  108. mkdir -p $PKG/install
  109. cat $CWD/slack-desc > $PKG/install/slack-desc
  110. cd $PKG
  111. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE