|
7 | 7 | # Copyright 2018 Christopher Simpkins
|
8 | 8 | # MIT License
|
9 | 9 | #
|
10 |
| -# Usage: ./build-ttf.sh (--install-dependencies) |
| 10 | +# Usage: ./build-ttf.sh (--system) |
11 | 11 | # Arguments:
|
12 |
| -# --install-dependencies (optional) - installs all |
13 |
| -# build dependencies prior to the build script execution |
| 12 | +# --system (optional) - use system installed build dependencies |
14 | 13 | #
|
15 | 14 | # /////////////////////////////////////////////////////////////////
|
16 | 15 |
|
17 |
| -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script |
| 16 | +# default build tooling definitions |
18 | 17 | TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint"
|
| 18 | +FONTMAKE="pipenv run fontmake" |
| 19 | +PYTHON="pipenv run python" |
| 20 | +INSTALLFLAG=0 |
19 | 21 |
|
20 | 22 | # test for number of arguments
|
21 | 23 | if [ $# -gt 1 ]
|
22 | 24 | then
|
23 | 25 | echo "Inappropriate arguments included in your command." 1>&2
|
24 |
| - echo "Usage: ./build-ttf.sh (--install-dependencies)" 1>&2 |
| 26 | + echo "Usage: ./build-ttf.sh (--system)" 1>&2 |
25 | 27 | exit 1
|
26 | 28 | fi
|
27 | 29 |
|
28 |
| -# Optional build dependency install request with syntax `./build.sh --install-dependencies` |
29 |
| -if [ "$1" = "--install-dependencies" ] |
30 |
| - then |
31 |
| - # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) |
32 |
| - tools/scripts/install/ttfautohint-build.sh |
33 |
| - |
34 |
| -fi |
35 |
| - |
36 |
| -# confirm executable installs and library imports for build dependencies |
37 |
| -INSTALLFLAG=0 |
38 |
| - |
39 |
| - |
40 |
| -# ttfautohint installed |
41 |
| -# - tests for install to local path from ttfautohint-build.sh script |
42 |
| -# - 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 |
43 |
| -if ! [ -f "$TTFAH" ] |
44 |
| - then |
45 |
| - if ! which ttfautohint |
46 |
| - then |
47 |
| - echo "Unable to install ttfautohint from source. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 |
48 |
| - INSTALLFLAG=1 |
49 |
| - else |
50 |
| - TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below |
51 |
| - fi |
52 |
| -fi |
53 |
| -# if any of the dependency installs failed, exit and do not attempt build, notify user |
54 |
| -if [ $INSTALLFLAG -eq 1 ] |
| 30 | +# Optional build with system-installed build dependencies instead of pinned build process defined versions |
| 31 | +if [ "$1" = "--system" ] |
55 | 32 | then
|
| 33 | + # re-define the default executables to executables that exist on PATH |
| 34 | + TTFAH="ttfautohint" |
| 35 | + FONTMAKE="fontmake" |
| 36 | + PYTHON="python3" |
| 37 | + |
| 38 | + echo "=================================" |
| 39 | + echo " BUILD ENVIRONMENT" |
| 40 | + echo "=================================" |
| 41 | + # test re-defined system-installed build dependency paths |
| 42 | + if ! which "$TTFAH"; then |
| 43 | + echo "Unable to identify a system installed version of ttfautohint. Please install and try again." 1>&2 |
| 44 | + INSTALLFLAG=1 |
| 45 | + else |
| 46 | + ttfautohint --version |
| 47 | + fi |
| 48 | + if ! which "$FONTMAKE"; then |
| 49 | + echo "Unable to identify a system installed version of fontmake. Please install and try again." 1>&2 |
| 50 | + INSTALLFLAG=1 |
| 51 | + else |
| 52 | + "$FONTMAKE" --version |
| 53 | + fi |
| 54 | + if ! which "$PYTHON"; then |
| 55 | + echo "Unable to identify a Python 3 installation. Please install and try again." 1>&2 |
| 56 | + INSTALLFLAG=1 |
| 57 | + else |
| 58 | + "$PYTHON" --version |
| 59 | + fi |
| 60 | + echo "=================================" |
| 61 | + echo " " |
| 62 | + echo "=================================" |
| 63 | + echo " " |
| 64 | +fi |
| 65 | + |
| 66 | +# test for local ttfautohint install using repository provided install script and defined ttfautohint version (and its dependencies) |
| 67 | +# no tests for Python build dependencies here because they are always installed by default & tested in the pipenv virtualenv before these steps |
| 68 | +if ! [ -f "$TTFAH" ]; then |
| 69 | + echo "Unable to identify the expected local install path for ttfautohint. Please install and try again." 1>&2 |
| 70 | + INSTALLFLAG=1 |
| 71 | +fi |
| 72 | + |
| 73 | + |
| 74 | +# If any of the dependency checks failed, exit the build and notify user |
| 75 | +if [ $INSTALLFLAG -eq 1 ]; then |
56 | 76 | echo "Build canceled." 1>&2
|
57 | 77 | exit 1
|
58 | 78 | fi
|
|
87 | 107 |
|
88 | 108 | # build regular set
|
89 | 109 |
|
90 |
| -if ! pipenv run fontmake -u "source/Hack-Regular.ufo" -o ttf |
| 110 | +if ! $FONTMAKE -u "source/Hack-Regular.ufo" -o ttf |
91 | 111 | then
|
92 | 112 | echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2
|
93 | 113 | exit 1
|
94 | 114 | fi
|
95 | 115 |
|
96 | 116 | # build bold set
|
97 |
| -if ! pipenv run fontmake -u "source/Hack-Bold.ufo" -o ttf |
| 117 | +if ! $FONTMAKE -u "source/Hack-Bold.ufo" -o ttf |
98 | 118 | then
|
99 | 119 | echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2
|
100 | 120 | exit 1
|
101 | 121 | fi
|
102 | 122 |
|
103 | 123 | # build italic set
|
104 |
| -if ! pipenv run fontmake -u "source/Hack-Italic.ufo" -o ttf |
| 124 | +if ! $FONTMAKE -u "source/Hack-Italic.ufo" -o ttf |
105 | 125 | then
|
106 | 126 | echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2
|
107 | 127 | exit 1
|
108 | 128 | fi
|
109 | 129 |
|
110 | 130 | # build bold italic set
|
111 | 131 |
|
112 |
| -if ! pipenv run fontmake -u "source/Hack-BoldItalic.ufo" -o ttf |
| 132 | +if ! $FONTMAKE -u "source/Hack-BoldItalic.ufo" -o ttf |
113 | 133 | then
|
114 | 134 | echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2
|
115 | 135 | exit 1
|
|
121 | 141 | echo " "
|
122 | 142 | echo "Attempting DSIG table fixes with fontbakery..."
|
123 | 143 | echo " "
|
124 |
| -if ! pipenv run python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf |
| 144 | +if ! $PYTHON postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf |
125 | 145 | then
|
126 | 146 | echo "Unable to complete DSIG table fixes on the release files"
|
127 | 147 | exit 1
|
|
131 | 151 | echo " "
|
132 | 152 | echo "Attempting fstype fixes with fontbakery..."
|
133 | 153 | echo " "
|
134 |
| -if ! pipenv run python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf |
| 154 | +if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf |
135 | 155 | then
|
136 | 156 | echo "Unable to complete fstype fixes on the release files"
|
137 | 157 | exit 1
|
|
0 commit comments