[build-subsets.sh] updated shell script to support pinned build dependency versions and system installed versions of build dependencies

also eliminates dependency checks as these will have run during ttf build and other web font builds prior to execution of this script
pull/416/head
Chris Simpkins 2018-03-15 17:13:22 +07:00
parent 83eac6382d
commit 2b1d273848
1 changed files with 26 additions and 70 deletions

@ -7,27 +7,17 @@
# Copyright 2018 Christopher Simpkins # Copyright 2018 Christopher Simpkins
# MIT License # MIT License
# #
# Usage: ./build-subsets.sh # Usage: ./build-subsets.sh (--system)
# # Arguments:
# NOTE: must install build dependencies in: # --system (optional) - build with system installed versions
# 1) build-ttf.sh # of build dependencies
# 2) build-woff.sh
# 3) build-woff2.sh
# before you execute this script. You can do this with:
#
#
# $ ./build-ttf.sh --install-dependencies
# $ ./build-woff.sh --install-dependencies
# $ ./build-woff2.sh --install-dependencies
# #
# ////////////////////////////////////////////////////////////////////// # //////////////////////////////////////////////////////////////////////
# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script # default build tooling definitions
# - This is revised to ttfautohint on the user's PATH if this local install is not identified
# then the identified ttfautohint is used to execute hinting. Versions of ttfautohint < 1.6 exit with status
# code 1 due to use of -R option
# - The intent is to support use of ttfautohint installed on a user's PATH (e.g. they've previously installed it)
TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint"
FONTMAKE="pipenv run fontmake"
PYTHON="pipenv run python"
# The sfnt2woff-zopfli build directory. # The sfnt2woff-zopfli build directory.
SFNTWOFF_BUILD="$HOME/sfnt2woff-zopfli-build" SFNTWOFF_BUILD="$HOME/sfnt2woff-zopfli-build"
@ -79,64 +69,30 @@ BOLDITALIC_WOFF2="hack-bolditalic-subset.woff2"
WEB_BUILD="build/web/fonts" WEB_BUILD="build/web/fonts"
# test for number of arguments # test for number of arguments
if [ $# -gt 0 ] if [ $# -gt 1 ]
then then
echo "Inappropriate arguments included in your command." 1>&2 echo "Inappropriate arguments included in your command." 1>&2
echo "Usage: ./build-subsets.sh" 1>&2 echo "Usage: ./build-subsets.sh (--system)" 1>&2
exit 1 exit 1
fi fi
# //////////////////////////////////////// # //////////////////////////////////////////////
# #
# #
# Confirm that dependencies are installed # Re-define build dependencies to PATH
# installed versions if --system flag is used
# #
# #
# //////////////////////////////////////// # //////////////////////////////////////////////
INSTALLFLAG=0
# ttfautohint installed
# - tests for install to local path from ttfautohint-build.sh script
# - if not found on this path, tests for install on system PATH - if found, revises TTFAH to the string "ttfautohint" for execution of instruction sets
if ! [ -f "$TTFAH" ]
then
if ! which ttfautohint
then
echo "ttfautohint was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2
INSTALLFLAG=1
else
TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below
echo "ttfautohint executable identified"
fi
else
echo "ttfautohint executable identified"
fi
# sfntwoff-zopfli installed
if ! [ -f "$SFNTWOFF_BIN" ]
then
echo "sfnt2woff-zopfli was not found on the path $SFNTWOFF_BIN. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2
INSTALLFLAG=1
else
echo "sfnt2woff-zopfli executable identified"
fi
# woff2 installed if [ "$1" = "--system" ]; then
if ! [ -f "$WOFF2_BIN" ] TTFAH="ttfautohint"
then FONTMAKE="fontmake"
echo "woff2_compress was not found on the path $WOFF2_BIN. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 PYTHON="python3"
INSTALLFLAG=1 SFNTWOFF_BIN="sfnt2woff-zopfli"
else WOFF2_BIN="woff2_compress"
echo "woff2_compress executable identified"
fi fi
# if any of the dependency installs failed, exit and do not attempt build, notify user
if [ $INSTALLFLAG -eq 1 ]
then
echo "Build canceled." 1>&2
exit 1
fi
# //////////////////////////////////////////////// # ////////////////////////////////////////////////
# #
@ -148,7 +104,7 @@ fi
# //////////////////////////////////////////////// # ////////////////////////////////////////////////
# cleanup any previously created temp directory that was not removed # cleanup any previously created temp directory that was not removed
if ! [ -d "$TEMP_SOURCE" ]; then if [ -d "$TEMP_SOURCE" ]; then
rm -rf $TEMP_SOURCE rm -rf $TEMP_SOURCE
fi fi
@ -185,21 +141,21 @@ fi
# build regular subset # build regular subset
if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf
then then
echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2 echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2
exit 1 exit 1
fi fi
# build bold subset # build bold subset
if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf
then then
echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2 echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2
exit 1 exit 1
fi fi
# build italic subset # build italic subset
if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf
then then
echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2 echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2
exit 1 exit 1
@ -207,7 +163,7 @@ fi
# build bold italic subset # build bold italic subset
if ! pipenv run fontmake --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf
then then
echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2 echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2
exit 1 exit 1
@ -226,7 +182,7 @@ fi
echo " " echo " "
echo "Attempting DSIG table fixes with fontbakery..." echo "Attempting DSIG table fixes with fontbakery..."
echo " " echo " "
if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf if ! $PYTHON postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf
then then
echo "Unable to complete DSIG table fixes on the release files" echo "Unable to complete DSIG table fixes on the release files"
exit 1 exit 1
@ -236,7 +192,7 @@ fi
echo " " echo " "
echo "Attempting fstype fixes with fontbakery..." echo "Attempting fstype fixes with fontbakery..."
echo " " echo " "
if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf
then then
echo "Unable to complete fstype fixes on the release files" echo "Unable to complete fstype fixes on the release files"
exit 1 exit 1