teighafileconverter.SlackBuild 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #!/bin/bash
  2. # Slackware build script for TeighaFileConverter
  3. # Copyright 2012-2014 Fridrich von Stauffenberg <email removed>
  4. # Copyright 2018 B. Watson <yalhcru@gmail.com>
  5. # All rights reserved.
  6. #
  7. # Redistribution and use of this script, with or without modification, is
  8. # permitted provided that the following conditions are met:
  9. #
  10. # 1. Redistributions of this script must retain the above copyright
  11. # notice, this list of conditions and the following disclaimer.
  12. #
  13. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  14. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  15. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  16. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  18. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  19. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  20. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  21. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  22. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. # 20180724 bkw:
  24. # - Take over maintenance.
  25. # - Update for v19.5.0.0. This adds x86_64 support, but means qt5 is
  26. # now required.
  27. # - Pacify desktop-file-validate.
  28. # - Simplify script a bit.
  29. # - Clarify README and slack-desc.
  30. # - Name the x86 package according to ARCH (i586 or i686). No effect on
  31. # the package contents, just the filename.
  32. cd $(dirname $0) ; CWD=$(pwd)
  33. PRGNAM=teighafileconverter
  34. VERSION=${VERSION:-19.5.0.0}
  35. BUILD=${BUILD:-1}
  36. TAG=${TAG:-_SBo}
  37. PKGTYPE=${PKGTYPE:-tgz}
  38. if [ -z "$ARCH" ]; then
  39. case "$( uname -m )" in
  40. i?86) ARCH=i586 ;;
  41. arm*) ARCH=arm ;;
  42. *) ARCH=$( uname -m ) ;;
  43. esac
  44. fi
  45. ORIGNAM=TeighaFileConverter
  46. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  47. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  48. exit 0
  49. fi
  50. TMP=${TMP:-/tmp/SBo}
  51. PKG=$TMP/package-$PRGNAM
  52. OUTPUT=${OUTPUT:-/tmp}
  53. case "$ARCH" in
  54. i?86) DEBARCH=X86 ; LIBDIRSUFFIX="" ;;
  55. x86_64) DEBARCH=X64 ; LIBDIRSUFFIX="64" ;;
  56. *) echo "Unsupported ARCH, only i?86 and x86_64 supported" 1>&2
  57. exit 1 ;;
  58. esac
  59. set -e
  60. # No "source" directory, extract directly to $PKG.
  61. rm -rf $PKG
  62. mkdir -p $TMP $PKG $OUTPUT
  63. cd $PKG
  64. # How to extract a .deb without creating temp files. If you're using this
  65. # in your own SlackBuild, be aware that some .debs contain data.tar.xz
  66. # instead of .gz.
  67. ar p $CWD/${ORIGNAM}_QT5_lnx${DEBARCH}_*dll.deb data.tar.gz | tar xvfz -
  68. chown -R root:root .
  69. find . -type d -exec chmod 755 {} \;
  70. find -L . \! -name '*.so' \! -name '*.tx*' -type f -exec chmod 644 {} \;
  71. # Binaries aren't stripped, according to 'file', but they don't get any
  72. # smaller if I strip them, so leave them as-is.
  73. PKGLIB=$PKG/usr/lib$LIBDIRSUFFIX
  74. mkdir -p $PKGLIB
  75. mv $PKG/usr/bin/${ORIGNAM}_$VERSION $PKGLIB/$ORIGNAM
  76. sed "s,@LIBDIRSUFFIX@,$LIBDIRSUFFIX,g" $CWD/$PRGNAM.sh > $PKG/usr/bin/$ORIGNAM
  77. chmod 755 $PKG/usr/bin/$ORIGNAM $PKGLIB/$ORIGNAM/$ORIGNAM
  78. # .desktop file spec says they *must* be UTF-8, upstream used 8859-1...
  79. PKGAPP=$PKG/usr/share/applications
  80. iconv -f ISO-8859-1 -t UTF-8 $PKGAPP/${ORIGNAM}_$VERSION.desktop | \
  81. sed 's@/usr/bin/@@g' > \
  82. $PKGAPP/${ORIGNAM}.desktop
  83. rm -f $PKGAPP/${ORIGNAM}_$VERSION.desktop
  84. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  85. mkdir -p $PKGDOC
  86. mv $PKG/usr/share/doc/$ORIGNAM/* $PKGDOC
  87. rm -rf $PKG/usr/share/doc
  88. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  89. mkdir -p $PKG/install
  90. cat $CWD/slack-desc > $PKG/install/slack-desc
  91. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  92. cd $PKG
  93. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE