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.

93 lines
2.7 KiB

  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2017,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 sabyenc sourcecode is available at: <https://sabnzbd.org/>.
  26. # Source package infos
  27. NAMESRC=${NAMESRC:-sabyenc3}
  28. VERSION=${VERSION:-4.0.2}
  29. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
  30. # Build infos
  31. NAMEPKG=${NAMEPKG:-sabyenc}
  32. BUILD=${BUILD:-1GGD}
  33. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  34. JOBS=${JOBS:-1}
  35. EXT=${EXT:-txz}
  36. # Directories
  37. TMP=${TMP:-/tmp}
  38. OUT=${OUT:-$TMP/build}
  39. PKG=${PKG:-$OUT/$NAMEPKG}
  40. CWD=$(pwd)
  41. set -e # Quit if a command returns non-zero
  42. # Sanity checks
  43. if [ $UID -eq 0 ]; then
  44. echo "You should NOT run this script as ROOT!"
  45. exit 1
  46. fi
  47. if [ ! -d $TMP ]; then
  48. echo "$TMP does not exists or is not a directory!"
  49. exit 1
  50. fi
  51. # Get and verify the source archive
  52. if [ ! -r $ARCHIVE ]; then
  53. pip3 download --no-binary :all: --no-deps $NAMESRC==$VERSION
  54. fi
  55. sha256sum -c $ARCHIVE.sha256
  56. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  57. # Compile
  58. cd $TMP
  59. echo "Building $ARCHIVE..."
  60. tar xf $CWD/$ARCHIVE
  61. cd $NAME
  62. python3 setup.py build
  63. python3 setup.py install --root=$PKG
  64. install -D -m 644 README.md $PKG/usr/doc/$NAME/README.md
  65. # Strip binaries
  66. find $PKG | xargs file | grep "ELF \(32\|64\)-bit LSB" | cut -d : -f 1 | \
  67. xargs strip --strip-unneeded 2> /dev/null
  68. # Copy slack-desc file
  69. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  70. # Package the tree
  71. cd $PKG
  72. mkdir -p $OUT
  73. PACKAGING="
  74. chown root:root . -R
  75. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  76. rm -rf $PKG
  77. rm -rf $TMP/$NAME
  78. "
  79. if type -p fakeroot ; then
  80. echo "$PACKAGING" | fakeroot
  81. else
  82. su -c "$PACKAGING"
  83. fi