Ver código fonte

add Werner Lemberg's ttfautohint-build.sh script (https://github.com/source-foundry/Hack/issues/227#issuecomment-323157048) under CC0

Chris Simpkins 7 anos atrás
pai
commit
edc0a3ccfc
1 arquivos alterados com 213 adições e 0 exclusões
  1. 213 0
      tools/scripts/install/ttfautohint-build.sh

+ 213 - 0
tools/scripts/install/ttfautohint-build.sh

@@ -0,0 +1,213 @@
+#!/bin/sh
+#
+# This script builds a stand-alone binary for the command line version of
+# ttfautohint, downloading any necessary libraries.
+#
+# Version 2017-Aug-17.
+# Written by Werner Lemberg <wl@gnu.org>.
+# To the extent possible under law, the person who associated CC0 with this work
+# has waived all copyright and related or neighboring rights to this work.
+
+#
+# User configuration.
+#
+
+# The build directory.
+BUILD="$HOME/ttfautohint-build"
+
+# The library versions.
+FREETYPE_VERSION="2.8"
+HARFBUZZ_VERSION="1.4.8"
+TTFAUTOHINT_VERSION="1.6"
+
+# Necessary patches (lists of at most 10 URLs each separated by whitespace,
+# to be applied in order).
+FREETYPE_PATCHES=""
+HARFBUZZ_PATCHES=""
+TTFAUTOHINT_PATCHES=""
+
+
+#
+# Nothing to configure below this comment.
+#
+
+FREETYPE="freetype-$FREETYPE_VERSION"
+HARFBUZZ="harfbuzz-$HARFBUZZ_VERSION"
+TTFAUTOHINT="ttfautohint-$TTFAUTOHINT_VERSION"
+
+if test -d "$BUILD" -o -f "$BUILD"; then
+  echo "Build directory \`$BUILD' must not exist."
+  exit 1
+fi
+
+INST="$BUILD/local"
+
+mkdir "$BUILD"
+mkdir "$INST"
+
+cd "$BUILD"
+
+
+echo "#####"
+echo "Download all necessary archives and patches."
+echo "#####"
+
+curl -L -O "http://download.savannah.gnu.org/releases/freetype/$FREETYPE.tar.gz"
+curl -O "https://www.freedesktop.org/software/harfbuzz/release/$HARFBUZZ.tar.bz2"
+curl -L -O "http://download.savannah.gnu.org/releases/freetype/$TTFAUTOHINT.tar.gz"
+
+count=0
+for i in $FREETYPE_PATCHES
+do
+  curl -o ft-patch-$count.diff $i
+  count=`expr $count + 1`
+done
+
+count=0
+for i in $HARFBUZZ_PATCHES
+do
+  curl -o hb-patch-$count.diff $i
+  count=`expr $count + 1`
+done
+
+count=0
+for i in $TTFAUTOHINT_PATCHES
+do
+  curl -o ta-patch-$count.diff $i
+  count=`expr $count + 1`
+done
+
+
+# Our environment variables.
+TA_CPPFLAGS="-I$INST/include"
+TA_CFLAGS="-g -O2"
+TA_CXXFLAGS="-g -O2"
+TA_LDFLAGS="-L$INST/lib"
+
+
+echo "#####"
+echo "Extract archives."
+echo "#####"
+
+tar -xzvf "$FREETYPE.tar.gz"
+tar -xjvf "$HARFBUZZ.tar.bz2"
+tar -xzvf "$TTFAUTOHINT.tar.gz"
+
+
+echo "#####"
+echo "Apply patches."
+echo "#####"
+
+cd "$FREETYPE"
+for i in ../ft-patch-*.diff
+do
+  test -f $i || continue
+  patch --forward \
+        --strip=1 \
+        --reject-file=- \
+        < $i
+done
+cd ..
+
+cd "$HARFBUZZ"
+for i in ../hb-patch-*.diff
+do
+  test -f $i || continue
+  patch --forward \
+        --strip=1 \
+        --reject-file=- \
+        < $i
+done
+cd ..
+
+cd "$TTFAUTOHINT"
+for i in ../ta-patch-*.diff
+do
+  test -f $i || continue
+  patch --forward \
+        --strip=1 \
+        --reject-file=- \
+        < $i
+done
+cd ..
+
+
+echo "#####"
+echo "$FREETYPE"
+echo "#####"
+
+cd "$FREETYPE"
+
+./configure \
+  --without-bzip2 \
+  --without-png \
+  --without-zlib \
+  --without-harfbuzz \
+  --prefix="$INST" \
+  --enable-static \
+  --disable-shared \
+  CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \
+  CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \
+  LDFLAGS="$TA_LDFLAGS"
+make
+make install
+cd ..
+
+
+echo "#####"
+echo "$HARFBUZZ"
+echo "#####"
+
+cd "$HARFBUZZ"
+
+./configure \
+  --disable-dependency-tracking \
+  --disable-gtk-doc-html \
+  --with-glib=no \
+  --with-cairo=no \
+  --with-fontconfig=no \
+  --with-icu=no \
+  --prefix="$INST" \
+  --enable-static \
+  --disable-shared \
+  CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \
+  CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \
+  LDFLAGS="$TA_LDFLAGS" \
+  PKG_CONFIG=true \
+  FREETYPE_CFLAGS="-I$INST/include/freetype2" \
+  FREETYPE_LIBS="-L$INST/lib -lfreetype"
+make
+make install
+cd ..
+
+
+echo "#####"
+echo "$TTFAUTOHINT"
+echo "#####"
+
+cd "$TTFAUTOHINT"
+
+./configure \
+  --disable-dependency-tracking \
+  --without-qt \
+  --without-doc \
+  --prefix="$INST" \
+  --enable-static \
+  --disable-shared \
+  --with-freetype-config="$INST/bin/freetype-config" \
+  CFLAGS="$TA_CPPFLAGS $TA_CFLAGS" \
+  CXXFLAGS="$TA_CPPFLAGS $TA_CXXFLAGS" \
+  LDFLAGS="$TA_LDFLAGS" \
+  PKG_CONFIG=true \
+  HARFBUZZ_CFLAGS="-I$INST/include/harfbuzz" \
+  HARFBUZZ_LIBS="-L$INST/lib -lharfbuzz"
+make LDFLAGS="$TA_LDFLAGS -all-static"
+make install-strip
+cd ..
+
+
+echo "#####"
+echo "binary: $INST/bin/ttfautohint"
+echo "#####"
+
+# eof