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.

98 lines
2.7 KiB

  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2014-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 youtube-dl sourcecode is available at:
  26. # <https://github.com/rg3/youtube-dl/>.
  27. # Source package infos
  28. NAMESRC=${NAMESRC:-youtube-dl}
  29. VERSION=${VERSION:-2020.09.20}
  30. ARCHIVE=${ARCHIVE:-$NAMESRC-$VERSION.tar.gz}
  31. WGET=${WGET:-https://github.com/ytdl-org/youtube-dl/archive/$VERSION.tar.gz}
  32. # Build infos
  33. NAMEPKG=${NAMEPKG:-youtube-dl}
  34. BUILD=${BUILD:-1GGD}
  35. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  36. JOBS=${JOBS:-1}
  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. # Get and verify the source archive
  54. if [ ! -r $ARCHIVE ]; then
  55. wget -c -O $ARCHIVE.part "$WGET"
  56. mv $ARCHIVE.part $ARCHIVE
  57. fi
  58. sha256sum -c $ARCHIVE.sha256
  59. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  60. # Compile
  61. cd $TMP
  62. echo "Building $ARCHIVE..."
  63. tar xf $CWD/$ARCHIVE
  64. cd $NAME
  65. python3 setup.py build
  66. python3 setup.py install --root=$PKG
  67. # Remove empty directories
  68. rm -rf $PKG/usr/{etc,share}
  69. # Install the documentation
  70. mkdir -p $PKG/usr/doc/$NAME
  71. install -m 644 LICENSE README.md $PKG/usr/doc/$NAME
  72. # Copy slack-desc file
  73. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  74. # Package the tree
  75. cd $PKG
  76. mkdir -p $OUT
  77. PACKAGING="
  78. chown root:root . -R
  79. /sbin/makepkg -l y -c n $OUT/$NAMEPKG-$VERSION-$ARCH-$BUILD.$EXT
  80. rm -rf $PKG
  81. rm -rf $TMP/$NAME
  82. "
  83. if type -p fakeroot ; then
  84. echo "$PACKAGING" | fakeroot
  85. else
  86. su -c "$PACKAGING"
  87. fi