|
7 | 7 | # Copyright 2018 Christopher Simpkins |
8 | 8 | # MIT License |
9 | 9 | # |
10 | | -# Usage: ./build-woff.sh (--install-dependencies) |
| 10 | +# Usage: ./build-woff.sh (--system) |
11 | 11 | # Arguments: |
12 | | -# --install-dependencies (optional) - installs all |
13 | | -# build dependencies prior to the build script execution |
| 12 | +# --system (optional) - build with a system installed version |
| 13 | +# of build dependencies |
14 | 14 | # |
15 | | -# NOTE: If you change the source, you must build new ttf files |
16 | | -# with build.sh PRIOR to execution of this script. |
17 | | -# This script builds directly from previous ttf builds, |
18 | | -# not source files. |
| 15 | +# NOTE: If you modify the source, you must build new ttf files |
| 16 | +# PRIOR to execution of this script. This script builds |
| 17 | +# directly from previous ttf builds, not source files. |
19 | 18 | # |
20 | 19 | # /////////////////////////////////////////////////////////////////// |
21 | 20 |
|
@@ -50,55 +49,29 @@ BOLDITALIC_WOFF="hack-bolditalic.woff" |
50 | 49 | if [ $# -gt 1 ] |
51 | 50 | then |
52 | 51 | echo "Inappropriate arguments included in your command." 1>&2 |
53 | | - echo "Usage: ./build-woff.sh (--install-dependencies)" 1>&2 |
| 52 | + echo "Usage: ./build-woff.sh (--system)" 1>&2 |
54 | 53 | exit 1 |
55 | 54 | fi |
56 | 55 |
|
57 | | -# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` |
58 | | -if [ "$1" = "--install-dependencies" ] |
59 | | - then |
60 | | - # define the current directory (Hack repository) |
61 | | - CUR_DIR=$(pwd) |
62 | | - |
63 | | - if test -d "$BUILD" -o -f "$BUILD"; then |
64 | | - echo "Build directory \`$BUILD' must not exist." |
65 | | - exit 1 |
66 | | - fi |
67 | | - |
68 | | - mkdir "$BUILD" |
69 | | - |
70 | | - cd "$BUILD" || exit 1 |
71 | | - |
72 | | - echo "#####" |
73 | | - echo "Download archive." |
74 | | - echo "#####" |
75 | | - |
76 | | - curl -L -O "https://github.com/bramstein/sfnt2woff-zopfli/archive/v$SFNTWOFF_VERSION.tar.gz" |
77 | | - |
78 | | - echo "#####" |
79 | | - echo "Extract archives." |
80 | | - echo "#####" |
81 | | - |
82 | | - tar -xzvf "v$SFNTWOFF_VERSION.tar.gz" |
83 | | - |
84 | | - cd "$SFNTWOFF" || exit 1 |
85 | | - |
86 | | - echo "#####" |
87 | | - echo "Build $SFNTWOFF." |
88 | | - echo "#####" |
89 | | - |
90 | | - make |
91 | | - |
92 | | - # make Hack repository the current directory again following the build |
93 | | - cd "$CUR_DIR" || exit 1 |
94 | | -fi |
95 | | - |
96 | | - |
97 | | -if [ -f "$SFNTWOFF_BIN" ]; then |
98 | | - echo "Beginning web font build with $SFNTWOFF" |
| 56 | +# determine if system installed executable on PATH is requested for build |
| 57 | +# then test for presence of the sfnt2woff-zopfli build dependency based upon where it should be located |
| 58 | +if [ "$1" = "--system" ]; then |
| 59 | + SFNTWOFF_BIN="sfnt2woff-zopfli" |
| 60 | + if ! which $SFNTWOFF_BIN; then |
| 61 | + echo "Unable to identify sfnt2woff-zopfli executable on system PATH. Please install and try again." 1>&2 |
| 62 | + exit 1 |
| 63 | + else |
| 64 | + # display version of installed sfnt2woff-zopfli |
| 65 | + echo "Beginning web font build with $SFNTWOFF_BIN" |
| 66 | + fi |
99 | 67 | else |
100 | | - echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 |
101 | | - exit 1 |
| 68 | + if [ -f "$SFNTWOFF_BIN" ]; then |
| 69 | + echo "Beginning web font build with $SFNTWOFF_BIN" |
| 70 | + else |
| 71 | + echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please install this build dependency and then repeat your build attempt." 1>&2 |
| 72 | + exit 1 |
| 73 | + fi |
| 74 | + |
102 | 75 | fi |
103 | 76 |
|
104 | 77 | # Build woff files from ttf files |
|
165 | 138 | if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then |
166 | 139 | echo "Bold Italic woff build path: $WOFF_BUILD/$BOLDITALIC_WOFF" |
167 | 140 | fi |
168 | | - |
169 | | - |
170 | | - |
171 | | - |
172 | | - |
0 commit comments