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.

118 lines
3.1 KiB

13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
13 years ago
  1. #!/bin/bash
  2. # Build script for Slackware
  3. # Copyright (C) 2008-2013,2015-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 x264 sourcecode is available at:
  26. # <http://www.videolan.org/developers/x264.html>.
  27. # Source package infos
  28. NAMESRC=${NAMESRC:-x264}
  29. COMMIT=${COMMIT:-22fcbe12046b7d6ed7af5d7a47258f1f2ebd56c1}
  30. VERSION=r$(echo "$COMMIT" | cut -c1-7)
  31. ARCHIVE=${ARCHIVE:-$NAMESRC-$COMMIT.tar.gz}
  32. WGET=${WGET:-https://code.videolan.org/videolan/x264/-/archive/$COMMIT/$ARCHIVE}
  33. # Built package infos
  34. NAMEPKG=${NAMEPKG:-x264}
  35. BUILD=${BUILD:-1GGD}
  36. ARCH=${ARCH:-$(uname -m | sed 's/^i.86$/i486/;s/^arm.*/arm/')}
  37. JOBS=${JOBS:-1}
  38. EXT=${EXT:-txz}
  39. # Directories
  40. TMP=${TMP:-/tmp}
  41. OUT=${OUT:-$TMP/build}
  42. PKG=${PKG:-$OUT/$NAMEPKG}
  43. CWD=$(pwd)
  44. set -e # Quit if a command returns non-zero
  45. # Sanity check
  46. if [ $UID -eq 0 ]; then
  47. echo "You should NOT run this script as ROOT!"
  48. exit 1
  49. fi
  50. if [ ! -d $TMP ]; then
  51. echo "$TMP does not exist or is not a directory!"
  52. exit 1
  53. fi
  54. # Compilation flags
  55. LIBDIRSUFFIX=""
  56. case "$ARCH" in
  57. i?86)
  58. CPUOPT="-O2 -march=$ARCH -mtune=i686"
  59. ;;
  60. x86_64)
  61. CPUOPT="-O2 -fPIC"
  62. LIBDIRSUFFIX="64"
  63. ;;
  64. *)
  65. CPUOPT="-O2"
  66. ;;
  67. esac
  68. # Get and verify the source archive
  69. if [ ! -r $ARCHIVE ]; then
  70. wget -c -O $ARCHIVE.part "$WGET"
  71. mv $ARCHIVE.part $ARCHIVE
  72. fi
  73. sha256sum -c $ARCHIVE.sha256
  74. NAME=$(tar ft $ARCHIVE | head -n 1 | cut -d / -f 1)
  75. # Compile
  76. cd $TMP
  77. echo "Building $ARCHIVE..."
  78. tar xf $CWD/$ARCHIVE
  79. cd $NAME
  80. ./configure \
  81. --prefix=/usr \
  82. --libdir=/usr/lib$LIBDIRSUFFIX \
  83. --enable-shared \
  84. --enable-pic \
  85. --enable-strip \
  86. --extra-cflags="$CPUOPT"
  87. make -j $JOBS
  88. make install DESTDIR=$PKG
  89. # Install the documentation
  90. mkdir -p $PKG/usr/doc/$NAMEPKG-$VERSION
  91. install -m 644 AUTHORS COPYING doc/*.txt $PKG/usr/doc/$NAMEPKG-$VERSION
  92. # Copy slack-desc file
  93. install -D -m 644 $CWD/slack-desc $PKG/install/slack-desc
  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