Some SlackBuild scripts for Slackware.
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.

120 lines
3.1 KiB

  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2012,2013,2018,2019,2020 Damien Goutte-Gattat
  4. #
  5. # Redistribution and use of this script, with or without modifications,
  6. # is permitted provided that the following conditions are met:
  7. #
  8. # 1. Redistributions of this script must retain the above copyright
  9. # notice, this list of conditions and the following disclaimer.
  10. #
  11. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR AS IS'' AND ANY EXPRESS OR
  12. # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  13. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  14. # DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
  15. # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  16. # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  17. # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  18. # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  19. # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
  20. # IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  21. # POSSIBILITY OF SUCH DAMAGE.
  22. #
  23. # Contact: Damien Goutte-Gattat <dgouttegattat@incenp.org>
  24. #
  25. # Latest pyzmq sourcecode is available at:
  26. # <http://www.zeromq.org/bindings:python>.
  27. #
  28. # Depends: l/zeromq, l/python-cffi
  29. # Source package infos
  30. NAMESRC=${NAMESRC:-pyzmq}
  31. VERSION=${VERSION:-19.0.1}
  32. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
  33. # Build infos
  34. NAMEPKG=${NAMEPKG:-pyzmq}
  35. BUILD=${BUILD:-1GGD}
  36. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  37. EXT=${EXT:-txz}
  38. # Directories
  39. TMP=${TMP:-/tmp}
  40. OUT=${OUT:-$TMP/build}
  41. PKG=${PKG:-$OUT/$NAMEPKG}
  42. CWD=$(pwd)
  43. set -e # Quit if a command returns non-zero
  44. # Sanity checks
  45. if [ $UID -eq 0 ]; then
  46. echo "You should NOT run this script as ROOT!"
  47. exit 1
  48. fi
  49. if [ ! -d $TMP ]; then
  50. echo "$TMP does not exists or is not a directory!"
  51. exit 1
  52. fi
  53. # Compilation flags
  54. case "$ARCH" in
  55. i?86)
  56. CPUOPT="-O2 -march=$ARCH -mtune=i686"
  57. ;;
  58. x86_64)
  59. CPUOPT="-O2 -fPIC"
  60. ;;
  61. *)
  62. CPUOPT="-O2"
  63. ;;
  64. esac
  65. # Get and verify the source archive
  66. if [ ! -r $ARCHIVE ]; then
  67. pip3 download --no-binary :all: --no-deps $NAMESRC==$VERSION
  68. fi
  69. sha256sum -c $ARCHIVE.sha256
  70. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  71. # Compile
  72. cd $TMP
  73. echo "Building $ARCHIVE..."
  74. tar xf $CWD/$ARCHIVE
  75. cd $NAME
  76. CFLAGS=$CPUOPT \
  77. CXXFLAGS=$CPUOPT \
  78. python3 setup.py build
  79. python3 setup.py install --root=$PKG
  80. # Strip binaries
  81. find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
  82. xargs strip --strip-unneeded 2> /dev/null
  83. # Install the documentation
  84. mkdir -p $PKG/usr/doc/$NAME
  85. install -m 644 AUTHORS.md CONTRIBUTING.md COPYING.{BSD,LESSER} \
  86. README.md $PKG/usr/doc/$NAME
  87. # Copy slack-desc file
  88. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  89. # Add dependency infos
  90. cat > $PKG/install/slack-required <<EOF
  91. l/zeromq
  92. l/python-cffi
  93. EOF
  94. # Package the tree
  95. cd $PKG
  96. mkdir -p $OUT
  97. PACKAGING="
  98. chown root:root . -R
  99. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  100. rm -rf $PKG
  101. rm -rf $TMP/$NAME
  102. "
  103. if type -p fakeroot ; then
  104. echo "$PACKAGING" | fakeroot
  105. else
  106. su -c "$PACKAGING"
  107. fi