Skip to content

Commit dd71f61

Browse files
committed
[build-woff.sh] added support for pinned version and system installed build dep compiles
1 parent 14b1912 commit dd71f61

File tree

1 file changed

+25
-57
lines changed

1 file changed

+25
-57
lines changed

build-woff.sh

Lines changed: 25 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,14 @@
77
# Copyright 2018 Christopher Simpkins
88
# MIT License
99
#
10-
# Usage: ./build-woff.sh (--install-dependencies)
10+
# Usage: ./build-woff.sh (--system)
1111
# 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
1414
#
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.
1918
#
2019
# ///////////////////////////////////////////////////////////////////
2120

@@ -50,55 +49,29 @@ BOLDITALIC_WOFF="hack-bolditalic.woff"
5049
if [ $# -gt 1 ]
5150
then
5251
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
5453
exit 1
5554
fi
5655

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
9967
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+
10275
fi
10376

10477
# Build woff files from ttf files
@@ -165,8 +138,3 @@ fi
165138
if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then
166139
echo "Bold Italic woff build path: $WOFF_BUILD/$BOLDITALIC_WOFF"
167140
fi
168-
169-
170-
171-
172-

0 commit comments

Comments
 (0)