fontforge.SlackBuild 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. #!/bin/bash
  2. # Slackware build script for fontforge
  3. # Copyright 2006-2012,2016 Robby Workman Tuscaloosa, Alabama, USA
  4. # All rights reserved.
  5. #
  6. # Redistribution and use of this script, with or without modification, is
  7. # permitted provided that the following conditions are met:
  8. #
  9. # 1. Redistributions of this script must retain the above copyright
  10. # notice, this list of conditions and the following disclaimer.
  11. #
  12. # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
  13. # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
  15. # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  16. # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  17. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  18. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  19. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  20. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  21. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. # Currently maintained by David Woodfall <dave@slackbuilds.org>
  23. #
  24. # 2022-02-08 19:11:35 +0000,20201107
  25. # Switch to cmake
  26. #
  27. # 2020-10-12 20:48:40 +0100:
  28. # Update to Version ff 20190801, gnulib 20200505~0747bf0
  29. # Added --without-libuninameslist
  30. # 20220409 bkw: Modified by SlackBuilds.org, BUILD=2:
  31. # - make PRINT_PACKAGE_NAME work even if fontforge already installed.
  32. # - get rid of /usr/share/doc.
  33. cd $(dirname $0) ; CWD=$(pwd)
  34. PRGNAM=fontforge
  35. VERSION=${VERSION:-20201107}
  36. BUILD=${BUILD:-3}
  37. TAG=${TAG:-_SBo}
  38. PKGTYPE=${PKGTYPE:-tgz}
  39. ENABLE_BCINT=${ENABLE_BCINT:-yes}
  40. FREETYPE=${FREETYPE:-2.11.1}
  41. GNULIB=${GNULIB:-0.1}
  42. UTHASH=${UTHASH:-2.3.0}
  43. if [ -x /usr/bin/sphinx-build ]; then
  44. DOCS=ON
  45. fi
  46. if [ -z "$ARCH" ]; then
  47. case "$( uname -m )" in
  48. i?86) ARCH=i586 ;;
  49. arm*) ARCH=arm ;;
  50. *) ARCH=$( uname -m ) ;;
  51. esac
  52. fi
  53. if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  54. echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  55. exit 0
  56. fi
  57. # This ought to be more reliable than testing if a package DB file
  58. # exists. A little convoluted perhaps.
  59. if $PRGNAM -v 2>/dev/null |
  60. sed -n "s,^\($PRGNAM .*\),Found existing installation:\n \n\1,p
  61. n;p;a\ " | grep -v "^$"; then
  62. echo "Please uninstall any previous versions of $PRGNAM before building
  63. a new one."
  64. exit 1
  65. fi
  66. TMP=${TMP:-/tmp/SBo}
  67. PKG=$TMP/package-$PRGNAM
  68. OUTPUT=${OUTPUT:-/tmp}
  69. if [ "$ARCH" = "i586" ]; then
  70. SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  71. LIBDIRSUFFIX=""
  72. elif [ "$ARCH" = "i686" ]; then
  73. SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  74. LIBDIRSUFFIX=""
  75. elif [ "$ARCH" = "x86_64" ]; then
  76. SLKCFLAGS="-O2 -fPIC"
  77. LIBDIRSUFFIX="64"
  78. else
  79. SLKCFLAGS="-O2"
  80. LIBDIRSUFFIX=""
  81. fi
  82. set -e
  83. rm -rf $PKG
  84. mkdir -p $TMP $PKG $OUTPUT
  85. cd $TMP
  86. rm -rf $PRGNAM-$VERSION freetype-$FREETYPE
  87. tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
  88. tar xvf $CWD/freetype-$FREETYPE.tar.xz
  89. chown -R root:root $PRGNAM-$VERSION freetype-$FREETYPE
  90. chmod -R u+w,go+r-w,a-s $PRGNAM-$VERSION freetype-$FREETYPE
  91. cd $PRGNAM-$VERSION
  92. tar xvf $CWD/gnulib-$GNULIB.tar.gz
  93. tar xvf $CWD/uthash-$UTHASH.tar.gz
  94. mv gnulib-"$GNULIB" gnulib
  95. mv uthash-"$UTHASH" uthash
  96. chown -R root:root gnulib uthash
  97. chmod -R u+w,go+r-w,a-s gnulib uthash
  98. mkdir -p build
  99. cd build
  100. cmake \
  101. -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
  102. -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
  103. -DCMAKE_INSTALL_PREFIX=/usr \
  104. -DLIB_SUFFIX=${LIBDIRSUFFIX} \
  105. -DMAN_INSTALL_DIR=/usr/man \
  106. -DENABLE_LIBSPIRO=OFF \
  107. -DENABLE_LIBUNINAMESLIST=OFF \
  108. -DENABLE_DOCS=${DOCS:-OFF} \
  109. -DCMAKE_BUILD_TYPE=Release ..
  110. make
  111. make install DESTDIR=$PKG
  112. cd ..
  113. # Let's add the cidmaps
  114. mkdir -p $PKG/usr/share/fontforge
  115. tar xvf $CWD/cidmaps.tgz -C $PKG/usr/share/fontforge || exit 1
  116. chmod 0644 $PKG/usr/share/fontforge/*.cidmap
  117. chown root:root $PKG/usr/share/fontforge/*.cidmap
  118. rm -f $PKG/{,usr/}lib${LIBDIRSUFFIX}/*.la
  119. find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | \
  120. grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  121. mv $PKG/usr/share/man $PKG/usr
  122. find $PKG/usr/man -type f -exec gzip -9 {} \;
  123. for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
  124. mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
  125. # Move docs
  126. if [ -d $PKG/usr/share/doc/$PRGNAM/ ]; then
  127. mv $PKG/usr/share/doc/$PRGNAM/* $PKG/usr/doc/$PRGNAM-$VERSION
  128. rm -rf $PKG/usr/share/doc
  129. fi
  130. cp -a AUTHORS LICENSE $PKG/usr/doc/$PRGNAM-$VERSION
  131. cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
  132. find $PKG/usr/doc -type f -exec chmod 644 {} \+
  133. mkdir -p $PKG/install
  134. cat $CWD/slack-desc > $PKG/install/slack-desc
  135. cat $CWD/doinst.sh > $PKG/install/doinst.sh
  136. cd $PKG
  137. /sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE