smoffice2018.SlackBuild 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/bash
  2. # Slackware build script for smoffice2018
  3. # Based on the Arch Linux PKGBUILD.
  4. # Copyright 2018-2020, Alexander Verbovetsky, Moscow, Russia
  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. # 20220217 bkw: Modified by SlackBuilds.org: updated for v2018_982.
  24. # Note: upstream plays a dirty trick on us. When they release a new
  25. # version, they don't just remove the old download links... they make
  26. # the old links redirect to the latest version. Which is why I've
  27. # hosted v2018_982 on slackware.uk.
  28. cd $(dirname $0) ; CWD=$(pwd)
  29. PRGNAM=smoffice2018
  30. VERSION=${VERSION:-2018_982}
  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. case "$ARCH" in
  42. i?86) SMARCH=i386 ;;
  43. x86_64) SMARCH=amd64 ;;
  44. *) printf "\n$ARCH is unsupported for the SoftMaker Office.\n\n"
  45. exit 1 ;;
  46. esac
  47. # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
  48. # the name of the created package would be, and then exit. This information
  49. # could be useful to other scripts.
  50. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  51. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  52. exit 0
  53. fi
  54. TMP=${TMP:-/tmp/SBo}
  55. PKG=$TMP/package-$PRGNAM
  56. OUTPUT=${OUTPUT:-/tmp}
  57. set -e
  58. rm -rf $PKG
  59. mkdir -p $TMP $PKG/opt/smoffice2018 $OUTPUT
  60. cd $TMP
  61. tar xvf $CWD/softmaker-office-${VERSION//_/-}-${SMARCH}.tgz
  62. tar xvf office2018.tar.lzma -C $PKG/opt/smoffice2018
  63. cd $PKG
  64. mkdir -p usr/bin
  65. install -m 0755 -o root -g root $CWD/planmaker18 usr/bin
  66. install -m 0755 -o root -g root $CWD/presentations18 usr/bin
  67. install -m 0755 -o root -g root $CWD/textmaker18 usr/bin
  68. for s in 16 24 32 48 64 128 256 512 1024; do
  69. mkdir -p usr/share/icons/hicolor/${s}x${s}/apps
  70. for a in pml prl tml; do
  71. cp -a opt/smoffice2018/icons/${a}_${s}.png \
  72. usr/share/icons/hicolor/${s}x${s}/apps/application-x-${a}18.png
  73. done
  74. done
  75. for s in 16 24 32 48 64 96 128 256 512 1024; do
  76. mkdir -p usr/share/icons/hicolor/${s}x${s}/mimetypes
  77. for a in pmd pmd_mso pmd_oth prd prd_mso prd_oth tmd tmd_mso tmd_oth; do
  78. cp -a opt/smoffice2018/icons/${a}_${s}.png \
  79. usr/share/icons/hicolor/${s}x${s}/mimetypes/application-x-${a}.png
  80. done
  81. done
  82. mkdir -p usr/share/applications
  83. cp -a $CWD/planmaker-2018.desktop usr/share/applications/
  84. cp -a $CWD/presentations-2018.desktop usr/share/applications/
  85. cp -a $CWD/textmaker-2018.desktop usr/share/applications/
  86. mkdir -p usr/share/mime/packages/
  87. cp -a opt/smoffice2018/mime/softmaker-office-2018.xml \
  88. usr/share/mime/packages/
  89. chown -R root:root .
  90. find -L . \
  91. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  92. -o -perm 511 \) -exec chmod 755 {} \; -o \
  93. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  94. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
  95. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  96. | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  97. mkdir -p usr/doc/$PRGNAM-$VERSION
  98. mv opt/smoffice2018/*.pdf opt/smoffice2018/mime/copyright \
  99. usr/doc/$PRGNAM-$VERSION
  100. cat $CWD/$PRGNAM.SlackBuild > usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  101. mkdir -p install
  102. cat $CWD/slack-desc > install/slack-desc
  103. cat $CWD/doinst.sh > install/doinst.sh
  104. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE