You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.1 KiB

  1. #!/bin/bash
  2. # Build script for the Python SciPy package to be used with python 3
  3. # Copyright 2016-2019 Serban Udrea <s.udrea@gsi.de>
  4. # Copyright 2022 Isaac Yu <isaacyu@protonmail.com>
  5. # Copyright 2023-2024 Jeremy Hansen <jebrhansen+SBo@gmail.com>
  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 Eugene Suter <easuter@gmail.com>
  26. # Updated to 0.7.2 by João Felipe Santos <joao.eel@gmail.com>
  27. # Updated up to 1.1.0 by Serban Udrea <S.Udrea@gsi.de>
  28. # Added support for building with debugging symbols (S. Udrea)
  29. cd $(dirname $0) ; CWD=$(pwd)
  30. PRGNAM="python3-scipy"
  31. SRCNAM="scipy"
  32. VERSION=${VERSION:-1.15.3}
  33. BUILD=${BUILD:-1}
  34. TAG=${TAG:-_SBo}
  35. PKGTYPE=${PKGTYPE:-tgz}
  36. if [ -z "$ARCH" ]; then
  37. case "$( uname -m )" in
  38. i?86) ARCH=i586 ;;
  39. arm*) ARCH=arm ;;
  40. *) ARCH=$( uname -m ) ;;
  41. esac
  42. fi
  43. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  44. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  45. exit 0
  46. fi
  47. TMP=${TMP:-/tmp/SBo}
  48. PKG=$TMP/package-$PRGNAM
  49. OUTPUT=${OUTPUT:-/tmp}
  50. set -e
  51. rm -rf $PKG
  52. mkdir -p $TMP $PKG $OUTPUT
  53. cd $TMP
  54. rm -rf "$SRCNAM-$VERSION"
  55. tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
  56. cd "$SRCNAM-$VERSION"
  57. chown -R root:root .
  58. find -L . \
  59. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  60. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  61. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  62. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  63. # Cython in current is too new
  64. sed -i "s|3\.1\.0\"|3.2.0\"|" pyproject.toml
  65. python3 -m build --wheel --no-isolation
  66. python3 -m installer --destdir "$PKG" dist/*.whl
  67. # Skip stripping symbols if DEBUG is YES
  68. if [ "${DEBUG:-NO}" == "NO" ]; then
  69. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  70. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  71. fi
  72. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  73. cp -a CONTRIBUTING.rst LICENSE.txt LICENSES_bundled.txt README.rst PKG-INFO \
  74. $PKG/usr/doc/$PRGNAM-$VERSION
  75. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  76. mkdir -p $PKG/install
  77. cat $CWD/slack-desc > $PKG/install/slack-desc
  78. cd $PKG
  79. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE