fop.SlackBuild 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. #!/bin/bash
  2. # Slackware build script for fop
  3. # Copyright 2015 Thorn Inurcide USA
  4. # Copyright 2020, 2021, 2023 Lenard Spencer, Orlando, Florida, USA
  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. # 20220412 bkw: Modified by SlackBuilds.org, BUILD=2:
  24. # - remove mention of jai and jai-imageio from README, since we no
  25. # longer have these in the repo.
  26. # - use relative symlink for binary.
  27. # 20220301 bkw: Modified by SlackBuilds.org: fix build on 15.0.
  28. # The fop-2.6 SlackBuild downloaded 230 prebuilt .jar files during its
  29. # build process. Since we're trusting prebuilt code anyway, and since
  30. # we prefer not to do network access from a SlackBuild, I've made this
  31. # a binary repack: this script no longer builds fop, it just packages
  32. # the official binary release.
  33. # Also updated for version 2.7, and made this a noarch package since
  34. # there's no native code.
  35. # The offo-hyphenation stuff had to change: we have to use the precompiled
  36. # zip file, not the source. See:
  37. # https://xmlgraphics.apache.org/fop/2.7/hyphenation.html
  38. cd $(dirname $0) ; CWD=$(pwd)
  39. PRGNAM=fop
  40. VERSION=${VERSION:-2.8}
  41. BUILD=${BUILD:-1}
  42. TAG=${TAG:-_SBo}
  43. PKGTYPE=${PKGTYPE:-tgz}
  44. ARCH=noarch
  45. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  46. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  47. exit 0
  48. fi
  49. TMP=${TMP:-/tmp/SBo}
  50. PKG=$TMP/package-$PRGNAM
  51. OUTPUT=${OUTPUT:-/tmp}
  52. set -e
  53. rm -rf $PKG
  54. mkdir -p $TMP $PKG/opt/$PRGNAM-$VERSION $OUTPUT
  55. cd $PKG/opt
  56. rm -rf $PRGNAM-$VERSION
  57. tar xvf $CWD/$PRGNAM-$VERSION-bin.tar.gz
  58. cd $PRGNAM-$VERSION
  59. chown -R root:root .
  60. find -L . \
  61. \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  62. -o -perm 511 \) -exec chmod 755 {} \+ -o \
  63. \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  64. -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \+
  65. PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
  66. mkdir -p $PKGDOC
  67. mv KEYS LICENSE NOTICE README $PKGDOC
  68. mv $PRGNAM $PRGNAM.old
  69. mv $PRGNAM.old/* .
  70. rmdir $PRGNAM.old
  71. # 20220305 bkw: don't need windows stuff
  72. rm -f $PRGNAM.{bat,cmd}
  73. # 20220305 bkw: OFFO hyphenation can't be distributed with FOP, due
  74. # to licensing issues. Here it's a separate .jar file:
  75. unzip -p $CWD/offo-hyphenation-compiled.zip \
  76. offo-hyphenation-compiled/fop-hyph.jar \
  77. > lib/fop-hyph.jar
  78. # Symlink it all to /opt/fop so the .foprc won't need edited every update:
  79. cd $PKG/opt
  80. ln -s $PRGNAM-$VERSION $PRGNAM
  81. mkdir -p $PKG/usr/bin
  82. ln -s ../../opt/$PRGNAM-$VERSION/$PRGNAM $PKG/usr/bin/$PRGNAM
  83. cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
  84. mkdir -p $PKG/install
  85. cat $CWD/slack-desc > $PKG/install/slack-desc
  86. cd $PKG
  87. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE