aegisub.SlackBuild 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. #!/bin/bash
  2. # Copyright 2014-2021 Willy Sudiarto Raharjo <willysr@slackbuilds.org>
  3. # All rights reserved.
  4. #
  5. # Redistribution and use of this script, with or without modification, is
  6. # 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 IMPLIED
  12. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  13. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  14. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  15. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  16. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  17. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  18. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  19. # OTHERWISE) ARISING IN ANY WAY OUTPUT OF THE USE OF THIS SOFTWARE, EVEN IF
  20. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  21. cd $(dirname $0) ; CWD=$(pwd)
  22. PRGNAM=aegisub
  23. VERSION=${VERSION:-3.2.2}
  24. BUILD=${BUILD:-3}
  25. TAG=${TAG:-_SBo}
  26. PKGTYPE=${PKGTYPE:-tgz}
  27. MVER=3.2
  28. if [ -z "$ARCH" ]; then
  29. case "$( uname -m )" in
  30. i?86) export ARCH=i586 ;;
  31. arm*) export ARCH=arm ;;
  32. *) export ARCH=$( uname -m ) ;;
  33. esac
  34. fi
  35. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  36. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  37. exit 0
  38. fi
  39. TMP=${TMP:-/tmp/SBo}
  40. PKG=$TMP/package-$PRGNAM
  41. OUTPUT=${OUTPUT:-/tmp}
  42. if [ "$ARCH" = "i586" ]; then
  43. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  44. LIBDIRSUFFIX=""
  45. elif [ "$ARCH" = "i686" ]; then
  46. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  47. LIBDIRSUFFIX=""
  48. elif [ "$ARCH" = "x86_64" ]; then
  49. SLKCFLAGS="-O2 -fPIC"
  50. LIBDIRSUFFIX="64"
  51. else
  52. SLKCFLAGS="-O2"
  53. LIBDIRSUFFIX=""
  54. fi
  55. set -e
  56. rm -rf $PKG
  57. mkdir -p $TMP $PKG $OUTPUT
  58. cd $TMP
  59. rm -rf $PRGNAM-$VERSION
  60. tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
  61. cd $PRGNAM-$VERSION
  62. chown -R root:root .
  63. find -L . \
  64. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  65. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  66. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  67. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  68. for i in $CWD/patches/* ; do patch -p1 < $i ; done
  69. sed 's|gil/gil_all.hpp|gil.hpp|g' -i src/*.cpp # boost 1.69
  70. sed 's/$(LIBS_BOOST) $(LIBS_ICU)/$(LIBS_BOOST) $(LIBS_ICU) -pthread/' -i tools/Makefile # missing link flag
  71. LDFLAGS="$LDFLAGS -lz" \
  72. CFLAGS="$SLKCFLAGS" \
  73. CPPFLAGS+=' -DU_USING_ICU_NAMESPACE=1' \
  74. CXXFLAGS="$SLKCFLAGS" \
  75. ./configure \
  76. --prefix=/usr \
  77. --docdir=/usr/doc/$PRGNAM-$VERSION \
  78. --build=$ARCH-slackware-linux
  79. make
  80. make install DESTDIR=$PKG
  81. ln -s $PRGNAM-$MVER $PKG/usr/bin/$PRGNAM
  82. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  83. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  84. rm -f $PKG/usr/bin/aegisub
  85. (
  86. cd $PKG/usr/bin
  87. ln -s aegisub-$MVER aegisub
  88. )
  89. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  90. cp -a README.md LICENCE $PKG/usr/doc/$PRGNAM-$VERSION
  91. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  92. mkdir -p $PKG/install
  93. cat $CWD/slack-desc > $PKG/install/slack-desc
  94. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  95. cd $PKG
  96. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE