numpy-legacy3.SlackBuild 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. #!/bin/sh
  2. # Slackware build script for the latest version of NumPy to include
  3. # the compatibility layer with numeric and numarray. This is supposed
  4. # to be build with python 3. Tested up to python 3.5.2
  5. # Copyright 2016 Serban Udrea <s.udrea@gsi.de>
  6. # All rights reserved.
  7. #
  8. # Redistribution and use of this script, with or without modification,
  9. # is permitted provided that the following conditions are met:
  10. #
  11. # 1. Redistributions of this script must retain the above copyright
  12. # notice, this list of conditions and the following disclaimer.
  13. #
  14. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR
  15. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  18. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  20. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  21. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  22. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  23. # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  24. # POSSIBILITY OF SUCH DAMAGE.
  25. # Written by Aleksandar Samardzic <asamardzic@gmail.com>
  26. # Updated up to 1.11.1 by Serban Udrea <S.Udrea@gsi.de>
  27. #
  28. # Added support for building with debugging symbols (S. Udrea)
  29. #
  30. # LIBDIRSUFFIX is now needed to set the proper path for
  31. # UMFPACK (S. Udrea)
  32. #
  33. # Since UMFPACK is not used anymore by scipy but by the optional package
  34. # scikit-umfpack, the configuration of this and the corresponding AMD library
  35. # is now optional. One has to set NO_UMFPACK to "no" to create the apropriate
  36. # configuration file before building numpy. (S. Udrea)
  37. #
  38. # Added support for newer versions of ATLAS (3.10.x) (S. Udrea)
  39. #
  40. # Added the possibility to force numpy to link to different kinds of the
  41. # ATLAS library (S. Udrea)
  42. PRGNAM="numpy-legacy3"
  43. VERSION=${VERSION:-1.8.2}
  44. BUILD=${BUILD:-1}
  45. TAG=${TAG:-_SBo}
  46. TARBALL_NAME="numpy" # This is actually what we are going to install
  47. if [ -z "$ARCH" ]; then
  48. case "$( uname -m )" in
  49. i?86) ARCH=i586 ;;
  50. arm*) ARCH=arm ;;
  51. *) ARCH=$( uname -m ) ;;
  52. esac
  53. fi
  54. if [ "$ARCH" = "i586" ]; then
  55. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  56. LIBDIRSUFFIX=""
  57. elif [ "$ARCH" = "i686" ]; then
  58. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  59. LIBDIRSUFFIX=""
  60. elif [ "$ARCH" = "x86_64" ]; then
  61. SLKCFLAGS="-O2 -fPIC"
  62. LIBDIRSUFFIX="64"
  63. else
  64. SLKCFLAGS="-O2"
  65. LIBDIRSUFFIX=""
  66. fi
  67. CWD=$(pwd)
  68. TMP=${TMP:-/tmp/SBo}
  69. PKG=${PKG:-$TMP/package-$PRGNAM}
  70. OUTPUT=${OUTPUT:-/tmp}
  71. set -e
  72. rm -rf $PKG
  73. mkdir -p $TMP $PKG $OUTPUT
  74. cd $TMP
  75. rm -rf $TARBALL_NAME-$VERSION
  76. tar xvf $CWD/$TARBALL_NAME-$VERSION.tar.gz
  77. cd $TARBALL_NAME-$VERSION
  78. chown -R root:root .
  79. find -L . \
  80. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 -o -perm 511 \) \
  81. -exec chmod 755 {} \; -o \
  82. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  83. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  84. # Tell numpy about the new names of the ATLAS shared libraries. This doesn't
  85. # force compilation against ATLAS, just makes sure that numpy does not link
  86. # against the static libraries, in case ATLAS is chosen.
  87. #
  88. ATLAS_SHARED="${ATLAS_SHARED:-yes}"
  89. ATLAS_SHARED=$(echo "$ATLAS_SHARED"|cut -b 1|tr a-z A-Z)
  90. ATLAS_THREADS="${ATLAS_THREADS:-yes}"
  91. ATLAS_THREADS=$(echo "$ATLAS_THREADS"|cut -b 1|tr a-z A-Z)
  92. if [ "$ATLAS_SHARED" = "Y" ]; then
  93. if [ "$ATLAS_THREADS" = "Y" ]; then
  94. echo -e "[atlas]\natlas_libs = tatlas" >> site.cfg
  95. echo -e "lapack_libs = tatlas\nlapack_atlas = tatlas\n" >> site.cfg
  96. else
  97. echo -e "[atlas]\natlas_libs = satlas" >> site.cfg
  98. echo -e "lapack_libs = satlas\nlapack_atlas = satlas\n" >> site.cfg
  99. fi
  100. else
  101. if [ "$ATLAS_THREADS" = "Y" ]; then
  102. echo -e "[atlas]\natlas_libs = ptf77blas,ptcblas,atlas" >> site.cfg
  103. echo -e "lapack_libs = ptlapack\nlapack_atlas = ptlapack\n" >> site.cfg
  104. else
  105. echo -e "[atlas]\natlas_libs = f77blas,cblas,atlas" >> site.cfg
  106. echo -e "lapack_libs = lapack\nlapack_atlas = lapack\n" >> site.cfg
  107. fi
  108. fi
  109. NO_UMFPACK=${NO_UMFPACK:-yes}
  110. case "$NO_UMFPACK" in
  111. [yY]|[yY][eE][sS]) NO_UMFPACK="y" ;;
  112. *) NO_UMFPACK="" ;;
  113. esac
  114. if [ ! "$NO_UMFPACK" ]; then
  115. echo -e "[amd]\nlibrary_dirs = /usr/lib${LIBDIRSUFFIX}" >> site.cfg
  116. echo -e "include_dirs = /usr/include/amd\namd_libs = amd\n" >> site.cfg
  117. echo -e "[umfpack]\nlibrary_dirs = /usr/lib${LIBDIRSUFFIX}" >> site.cfg
  118. echo -e "include_dirs = /usr/include/umfpack\numfpack_libs = umfpack\n" \
  119. >> site.cfg
  120. fi
  121. DEBUG=${DEBUG:-no}
  122. case "$DEBUG" in
  123. [yY]|[yY][eE][sS]) DEBUG="y" ;;
  124. *) DEBUG="" ;;
  125. esac
  126. if [ ! "$DEBUG" ]; then
  127. NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python3 setup.py install --root $PKG
  128. find $PKG | xargs file | grep -e "executable" -e "shared object" | grep ELF \
  129. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  130. else
  131. NPY_RELAXED_STRIDES_CHECKING=${NPY_RSC:-1} python3 setup.py build --debug
  132. python3 setup.py install --root $PKG
  133. fi
  134. mkdir -p $PKG/usr/doc/$TARBALL_NAME-$VERSION
  135. cp -a COMPATIBILITY DEV_README.txt LICENSE.txt README.txt THANKS.txt\
  136. $PKG/usr/doc/$TARBALL_NAME-$VERSION
  137. cat $CWD/${PRGNAM}.SlackBuild > \
  138. $PKG/usr/doc/$TARBALL_NAME-$VERSION/${PRGNAM}.SlackBuild
  139. find $PKG/usr/doc -type f -exec chmod 0644 {} \;
  140. mkdir -p $PKG/install
  141. cat $CWD/slack-desc > $PKG/install/slack-desc
  142. cd $PKG
  143. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}