aom.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. #!/bin/bash
  2. # ----------------------------------------------------------------------
  3. # Slackware build script for aom
  4. #
  5. # Copyright (c) 2018-2022 Andrew Strong, Blue Mountains, Australia.
  6. #
  7. # Permission to use, copy, modify, and distribute this software for
  8. # any purpose with or without fee is hereby granted, provided that
  9. # the above copyright notice and this permission notice appear in all
  10. # copies.
  11. #
  12. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. # IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. # SUCH DAMAGE.
  24. # ----------------------------------------------------------------------
  25. cd $(dirname $0) ; CWD=$(pwd)
  26. PRGNAM=aom
  27. # The 'official' archive for the aom 3.3.0 release has the git commit in
  28. # the filename, so adjustments are required for a sane Slackware build:
  29. VERSION=${VERSION:-3.3.0}
  30. GITCOMMIT=${GITCOMMIT:-87460cef80fb03def7d97df1b47bad5432e5e2e4}
  31. BUILD=${BUILD:-1}
  32. TAG=${TAG:-_SBo}
  33. PKGTYPE=${PKGTYPE:-tgz}
  34. if [ -z "$ARCH" ]; then
  35. case "$( uname -m )" in
  36. i?86) ARCH=i586 ;;
  37. arm*) ARCH=arm ;;
  38. *) ARCH=$( uname -m ) ;;
  39. esac
  40. fi
  41. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  42. # the name of the created package would be, and then exit. This information
  43. # could be useful to other scripts.
  44. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  45. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  46. exit 0
  47. fi
  48. TMP=${TMP:-/tmp/SBo}
  49. PKG=$TMP/package-$PRGNAM
  50. OUTPUT=${OUTPUT:-/tmp}
  51. if [ "$ARCH" = "i586" ]; then
  52. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  53. LIBDIRSUFFIX=""
  54. elif [ "$ARCH" = "i686" ]; then
  55. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  56. LIBDIRSUFFIX=""
  57. elif [ "$ARCH" = "x86_64" ]; then
  58. SLKCFLAGS="-O2 -fPIC"
  59. LIBDIRSUFFIX="64"
  60. else
  61. SLKCFLAGS="-O2"
  62. LIBDIRSUFFIX=""
  63. fi
  64. set -e
  65. rm -rf $PKG
  66. mkdir -p $TMP $PKG $OUTPUT
  67. cd $TMP
  68. rm -rf $PRGNAM-$VERSION
  69. mkdir -p $PRGNAM-$VERSION
  70. tar xvf $CWD/$PRGNAM-$GITCOMMIT.tar.gz -C $TMP/$PRGNAM-$VERSION
  71. cd $PRGNAM-$VERSION
  72. chown -R root:root .
  73. find -L . \
  74. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  75. -o -perm 511 \) -exec chmod 755 {} \; -o \
  76. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  77. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  78. cd build
  79. # I don't build either the HTML or the Latex docs as IMHO at this stage
  80. # of aom development they are still not terribly useful for non-developers.
  81. # To enable these docs change '-DENABLE_DOCS=0' below to '1' to build
  82. # the docs and then uncomment the 'extra docs' section below to install them...
  83. cmake \
  84. -G "Unix Makefiles" \
  85. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  86. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  87. -DCMAKE_INSTALL_PREFIX=/usr \
  88. -DCMAKE_INSTALL_LIBDIR=lib${LIBDIRSUFFIX} \
  89. -DCMAKE_INSTALL_INCLUDEDIR=include \
  90. -DCMAKE_BUILD_TYPE=Release \
  91. -DENABLE_NASM=1 \
  92. -DENABLE_DOCS=0 \
  93. -DBUILD_SHARED_LIBS=1 \
  94. -DENABLE_TESTS=0 \
  95. ../
  96. make -j1
  97. make install DESTDIR=$PKG
  98. cd ..
  99. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  100. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  101. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  102. cp -a AUTHORS CHANGELOG LICENSE PATENTS README.md $PKG/usr/doc/$PRGNAM-$VERSION
  103. # These are the 'extra docs', more details above...
  104. # mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/{html,latex}
  105. # cp -a build/docs/html/* $PKG/usr/doc/$PRGNAM-$VERSION/html
  106. # cp -a build/docs/latex/* $PKG/usr/doc/$PRGNAM-$VERSION/latex
  107. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  108. mkdir -p $PKG/install
  109. cat $CWD/slack-desc > $PKG/install/slack-desc
  110. cd $PKG
  111. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE