diff --git a/Makefile b/Makefile index 458d0cf75..86e192042 100644 --- a/Makefile +++ b/Makefile @@ -1,40 +1,94 @@ all: build -archives: - postbuild_processing/archive_prep/archiver.sh +# FONT COMPILES + +# +# Recommended usage: +# +# The following targets build *.ttf, *.woff, *.woff2 (including *.woff and *.woff2 subsets): +# +# `make` - builds fonts with pinned build dependency versions of all Python and local, compiled C/C++ projects +# `make build-system` - builds fonts with system PATH installed versions of build dependencies +# +# Dependency installs for default builds with `make` can be executed with: +# +# 1) pip3 install pipenv +# 2) make compile-local-dep +# +# Optional dependency install for `make` if your development system does not support the defined Python interpreter version: +# +# 3) curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +# build: ttf webfonts -build-with-dependencies: source/*.ufo - ./build-ttf.sh --install-dependencies - ./build-woff.sh --install-dependencies - ./build-woff2.sh --install-dependencies +build-with-dependencies: compile-local-dep ttf webfonts + +build-system: ttf-system webfonts-system + +build-local-ttfa: + tools/scripts/install/ttfautohint-build.sh + +build-local-sfnt2woffzopfli: + tools/scripts/install/sfnt2woff-zopfli-build.sh + +build-local-woff2: + tools/scripts/install/woff2-compress-build.sh + +compile-local-dep: build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 + +pipenv: + ./build-pipenv.sh + +subsets: pipenv ./build-subsets.sh +subsets-system: + ./build-subsets.sh --system + +ttf: pipenv + ./build-ttf.sh + +ttf-system: + ./build-ttf.sh --system + +webfonts: woff woff2 subsets + +webfonts-system: woff-system woff2-system subsets-system + +woff: pipenv + ./build-woff.sh + +woff-system: + ./build-woff.sh --system + +woff2: pipenv + ./build-woff2.sh + +woff2-system: + ./build-woff2.sh --system + + +# RELEASE PREP + +archives: + ./build-archives.sh + css: tools/scripts/css/css-build.sh -lint: shellcheck ufolint -shellcheck: build-ttf.sh build-woff.sh build-woff2.sh build-subsets.sh tools/scripts/install/ttfautohint-build.sh postbuild_processing/archive_prep/archiver.sh tools/scripts/css/css-build.sh - $@ $^ +# TESTING -subsets: source/*.ufo - ./build-subsets.sh +lint: shellcheck ufolint -ttf: - ./build-ttf.sh +shellcheck: *.sh tools/scripts/css/*.sh tools/scripts/install/*.sh + $@ $^ ufolint: source/*.ufo $@ $^ -webfonts: - ./build-woff.sh - ./build-woff2.sh - ./build-subsets.sh -woff: - ./build-woff.sh +# PHONY TARGETS -woff2: - ./build-woff2.sh +.PHONY: all archives build build-with-dependencies build-local-ttfa build-local-sfnt2woffzopfli build-local-woff2 build-system compile-local-dep css lint pipenv shellcheck subsets subsets-system ttf ttf-system ufolint webfonts webfonts-system woff woff-system woff2 woff2-system diff --git a/Pipfile b/Pipfile new file mode 100644 index 000000000..eda2f9356 --- /dev/null +++ b/Pipfile @@ -0,0 +1,20 @@ +[[source]] + +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + + +[packages] + +fonttools = "*" +fontmake = "*" + + +[dev-packages] + + + +[requires] + +python_version = "3.6" diff --git a/Pipfile.lock b/Pipfile.lock new file mode 100644 index 000000000..f6710e190 --- /dev/null +++ b/Pipfile.lock @@ -0,0 +1,144 @@ +{ + "_meta": { + "hash": { + "sha256": "60fe748ce602e0ad6290ca1db986d09913e7fdefee286a24b92af07cf8d9bb77" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.6" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "booleanoperations": { + "hashes": [ + "sha256:62723b7cabe3e727546df945c155e2f8be9514ef8c4f3b2f0f5cdb24ebbcfdf1", + "sha256:e405de0126aaf0f6e4f3dcebd18079db601e825e123cb095366b2a50e9abbc8c" + ], + "version": "==0.8.0" + }, + "compreffor": { + "hashes": [ + "sha256:02e03207bd74b8792ea51ff8ad7922d246a38886fc9a5ef4a65391cf0095533f", + "sha256:33ae053dcf2545bdcf9eb56d0ebc5ccc8a0bc49374a9fb3af35971c39109cca6", + "sha256:3c0eed769ecfc0da821cb46ee63d2ac4ab4342560d879a5e9ff194c191d72539", + "sha256:55ce6038dac9f58121ec066ccff8ff9cb4704f663f7ab40d5a548885bc949765", + "sha256:56d4997450c1303f3af4666120b8a504d3787900cc6c565851104371b00ea75d", + "sha256:71bb9f86f150bc132cc3a1c9f7d8b1171eb81603d7af79fc98c424780e468c6a", + "sha256:778ae7e6dd8115748fe3a25d80acd9dfe713a847868e083e0c67bc4c6f4aa220", + "sha256:902ce5a0264f17d693f517468d0cf0e33e0713198d485a43b99bb657baa3933c", + "sha256:bf6f12b7804bd3549df31bd5d77fe8ea3723c12d9f5ce697855b5361ab0e9f7a", + "sha256:c9578301995e9e011896a2ee3751419256b33342004b6ea6d34960c51d1463d5", + "sha256:cd503ea6bceb3dbb39c7f99dce1074803f031ba5980157b91e895a740c40f849", + "sha256:ce932125880f337a6d35cfe4ec444f5c3452ab3baa7e790a819f769499b1e2ff", + "sha256:cee7caea337b9396d9680cb847da8ead569c26974c64d80bd4977611b95aa687", + "sha256:d7edd2216462d5c730ea44fabab6369991fe628a30016bc21157a8aeff0cddb6", + "sha256:eac13d9df51e7ed8ef72c9fdfe82cd9fbab4740f63a441834b7a122a561111a2", + "sha256:faa61f3481a33cc93ae3cbd6daa501fec5091528d9465b86202c0ba7989db067", + "sha256:fc0bfb08401998c02c427e3d530d56b4bb185dd098ef6a017d61bc5080752763", + "sha256:fc7d4fb787b91d903733cbd9c1aa0374499d3ed92a2a45cd9d12483aa0203819" + ], + "version": "==0.4.6" + }, + "cu2qu": { + "hashes": [ + "sha256:b177236481117339a7b9363ab018b31f0cbf80b199abe64e33a10adaddb93a61", + "sha256:f6cb02827079ed41838ddb7d073ad7a426662a2f4fd7be32f33826b64f6facdb" + ], + "version": "==1.4.0" + }, + "defcon": { + "hashes": [ + "sha256:42bcc52bd2a277091c27af4d2ec9308db7a6fc20b5b9898ce46bd3e49fa8540e", + "sha256:a6e27b5d938501514378c5b8adfc2315f738756deef7f1165b6eddf1c40ebb0a" + ], + "version": "==0.3.5" + }, + "fontmake": { + "hashes": [ + "sha256:537586d53e040a8f990ca68ca6efcfc1ac57a080d1dadc6478f79271fce6f5f5", + "sha256:6582efe3b4ae777ee1b6e71f8e94466a68a91935b317dfbf444a32928d6f74c9" + ], + "version": "==1.4.0" + }, + "fontmath": { + "hashes": [ + "sha256:0be82c86eeb620608f7d6c4509e66246d02b95641d686cb8df668a6697ee8f9d", + "sha256:2a7bbee59c2e06659e95c3e9c4a656d19fe0584a2f2bc711588e1c884e14bf14" + ], + "version": "==0.4.4" + }, + "fonttools": { + "hashes": [ + "sha256:5cc459fb891968e35852fceb93aad4272fa782f90332ffb603f0fcab1d0ac2d6", + "sha256:d13e98c9f3b635a5334dab69eb471d7286928ac82db7ca57b5bf4cdf3824789a" + ], + "version": "==3.24.1" + }, + "glyphslib": { + "hashes": [ + "sha256:d1e920e3969434ca1701887ac98372bff5dd0642af8a2b386504dff266610a3f", + "sha256:f56b1bf874b9f99228d610933a9cced919374da8a24059e927376a0a5355d081" + ], + "version": "==2.2.1" + }, + "mutatormath": { + "hashes": [ + "sha256:46bb5209af53ee245d0e6cb9fe47f4f5718db7c158136715cd28494b239395c5", + "sha256:ebf8291637c7de30fe83f9402dad17c6ac9e1feb16d530e0a560d8e6abf48fce" + ], + "version": "==2.1.0" + }, + "pyclipper": { + "hashes": [ + "sha256:013dc2a39722914e2399a7608012c21da81c0e719e4aee958d0cbf3f603094ac", + "sha256:04337a635dc5cd6a17bc9a85f778eeb4b9569bb9a87d789005d1b7e86dadf8ca", + "sha256:191f12cd9ec385d44f181786d250d29b07c515c0b2d6e28d91fe482649d0525b", + "sha256:19beee2f26f6037f7d42aac0acc216d73bd2cc6dc36a6fc0565767de5080b4ba", + "sha256:1c9c298039727c1896c013d7b25bcddd8e778b4f06d8d20c019b0a4679c26446", + "sha256:209a770d211e760b33c8b8af60dc475ad16aea68a5f1f80e66128ce5da7bcb27", + "sha256:30823cd4f27345ef303ea6c1ec7a964fa43067063a76e31cfea032954c648039", + "sha256:3f11e87f0b82bccc6de57eead2628ca419694352e8b843bcd228eec9c9357680", + "sha256:3fa17ca0bb2b78c22efd1844a13789d351b51516a54b9cd8c482afef9c2cff04", + "sha256:5726921e921990915f441ad91304280b26a0d5e70882d503da4e741425100c5e", + "sha256:5ef5c5633c1783836837b7b198c35dec54d9506d9ff5695b4293fe96de8b5481", + "sha256:75d03cf5e6fc6c18329e51e9f1662d9d21c37f99692438761022f5ced7300ebc", + "sha256:79b2b1bf113045481d3f418e692f15e089b2053574accfc951fd9d0b73132204", + "sha256:8794d4f29a650854f503fc63f96a06baec30c604771149b474db92499edc8072", + "sha256:8f09d9eac721726eb7db9bd94597d1910e472a4d08dcb2adb715700124827d3e", + "sha256:9f67c98a51ed0296046f8448ecc25a8d61ab97c55b4281984b2bbfa883813c7b", + "sha256:a1bb42a403e1cfcaaf826384647faa6039c163b4a4a9960c194f37ee48148c00", + "sha256:b06076efafb1e3d4f14b63e8da69da34f883eb541844df108f2629866f42d02a", + "sha256:b685844cc5eb196fbbcd1970e37a6216e257683bba82e4c81030dc7060c027fd", + "sha256:bf23b1343411d977b82ea018189c8c9b84f9da5ea74a3e8c9444e71318a51488", + "sha256:c158f2eab791ce072190188b82dba131475337a6ca5db3a63c78454d21ab989a", + "sha256:d3da370f6947c54e1146784d5deda0ab789f2184a2e189a8e05aaa2cfd9ed82b", + "sha256:e0cd47d425dfa2e1f9da74eeca5b0b568b439d5fa397fbf2979ac2c33eb1772a", + "sha256:e938e1a13f10d1770602ad505c00d7cad3e685adc4548c041ae2d56ca04b4dba", + "sha256:ea169703d1c7a53f6eb8fcbe8ec4057db7064fabbdc402be3bc016218b72c0d5" + ], + "version": "==1.1.0" + }, + "ufo2ft": { + "hashes": [ + "sha256:3fc0aa8283fa28fecf0cf2e86c327778a32cfd1955ae62731fdff0463bd8d6a5", + "sha256:aa2b8dd983b61e401015ced8d30540df39a5f3faf7a6b1e38c15fe23f18749c5" + ], + "version": "==1.1.0" + }, + "ufolib": { + "hashes": [ + "sha256:0cead288602914f6c3fcad6e7b704f2d27797658eaba8637b48cd64784e807f7", + "sha256:34fd6a7492350526beac0d108a6cf8f6059c629150300a864a91837f7a351e1f" + ], + "version": "==2.1.1" + } + }, + "develop": {} +} diff --git a/postbuild_processing/archive_prep/archiver.sh b/build-archives.sh similarity index 91% rename from postbuild_processing/archive_prep/archiver.sh rename to build-archives.sh index ee737f976..4d80db966 100755 --- a/postbuild_processing/archive_prep/archiver.sh +++ b/build-archives.sh @@ -2,18 +2,18 @@ # //////////////////////////////////////////////////////////////////// # -# archiver.sh +# build-archives.sh # A shell script that packages .zip, tar.gz, and tar.xz font archives # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./archiver.sh +# Usage: ./build-archives.sh # # //////////////////////////////////////////////////////////////////// -HACK_VERSION="v3.003" -HACK_ARCHIVES_DIR="../../../Hack-archives" -HACK_BUILD_DIR="../../build" +HACK_VERSION="v4.000" +HACK_ARCHIVES_DIR="../../Hack-archives" +HACK_BUILD_DIR="build" # Make build directory the current working directory diff --git a/build-pipenv.sh b/build-pipenv.sh new file mode 100755 index 000000000..4b02873c3 --- /dev/null +++ b/build-pipenv.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# build-pipenv.sh +# A shell script that creates a virtualenv for Hack font builds +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./build-pipenv.sh +# +# ///////////////////////////////////////////////////////////////// + +if ! which pipenv + then + echo "Unable to detect a pipenv install. Please install with 'pip install pipenv' then repeat your build attempt." 1>&2 + exit 1 +fi + +# create virtualenv and install build dependencies +pipenv install --ignore-pipfile + +# test for fontmake install in venv +if ! pipenv run fontmake --version + then + echo "Unable to detect fontmake install with pipenv. Please repeat your build attempt." 1>&2 + exit 1 +fi + +# test for fontTools install in venv +if ! pipenv run python -c "import fontTools" + then + echo "Unable to detect fontTools install with pipenv. Please repeat your build attempt." 1>&2 + exit 1 +fi + +# print environment used for build to std output stream + +echo "=================================" +echo " PYTHON BUILD ENVIRONMENT" +echo "=================================" +echo " " +echo "Python interpreter version:" +pipenv run python --version +echo " " +pipenv graph + +echo " " +echo "=================================" +echo " " +echo "=================================" +echo " " diff --git a/build-subsets.sh b/build-subsets.sh index 42df0dc4d..819329038 100755 --- a/build-subsets.sh +++ b/build-subsets.sh @@ -7,27 +7,17 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-subsets.sh -# -# NOTE: must install build dependencies in: -# 1) build-ttf.sh -# 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 +# Usage: ./build-subsets.sh (--system) +# Arguments: +# --system (optional) - build with system installed versions +# of build dependencies # # ////////////////////////////////////////////////////////////////////// -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script -# - 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) +# default build tooling definitions TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" +FONTMAKE="pipenv run fontmake" +PYTHON="pipenv run python" # The sfnt2woff-zopfli build directory. SFNTWOFF_BUILD="$HOME/sfnt2woff-zopfli-build" @@ -79,83 +69,30 @@ BOLDITALIC_WOFF2="hack-bolditalic-subset.woff2" WEB_BUILD="build/web/fonts" # test for number of arguments -if [ $# -gt 0 ] +if [ $# -gt 1 ] then 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 fi -# //////////////////////////////////////// +# ////////////////////////////////////////////// # # -# Confirm that dependencies are installed +# Re-define build dependencies to PATH +# installed versions if --system flag is used # # -# //////////////////////////////////////// - -INSTALLFLAG=0 - -echo "Confirming that build dependencies are installed..." -echo " " - -# fontmake installed -if ! which fontmake - then - echo "fontmake was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -fi - -# fontTools python library can be imported -if ! python -c "import fontTools" - then - echo "The fontTools library was not found. Please install all build dependencies with 'make build-with-dependencies', then attempt your build again." 1>&2 - INSTALLFLAG=1 -else - echo "fontTools Python library identified" -fi - -# 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 ! [ -f "$WOFF2_BIN" ] - then - 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 - INSTALLFLAG=1 -else - echo "woff2_compress executable identified" +if [ "$1" = "--system" ]; then + TTFAH="ttfautohint" + FONTMAKE="fontmake" + PYTHON="python3" + SFNTWOFF_BIN="sfnt2woff-zopfli" + WOFF2_BIN="woff2_compress" 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 # //////////////////////////////////////////////// # @@ -167,7 +104,7 @@ fi # //////////////////////////////////////////////// # cleanup any previously created temp directory that was not removed -if ! [ -d "$TEMP_SOURCE" ]; then +if [ -d "$TEMP_SOURCE" ]; then rm -rf $TEMP_SOURCE fi @@ -204,21 +141,21 @@ fi # build regular subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant subset. Build canceled." 1>&2 exit 1 fi # build bold subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant subset. Build canceled." 1>&2 exit 1 fi # build italic subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant subset. Build canceled." 1>&2 exit 1 @@ -226,7 +163,7 @@ fi # build bold italic subset -if ! fontmake --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf +if ! $FONTMAKE --subset -u "$TEMP_SOURCE/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant subset. Build canceled." 1>&2 exit 1 @@ -245,7 +182,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf then echo "Unable to complete DSIG table fixes on the release files" exit 1 @@ -255,7 +192,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 diff --git a/build-ttf.sh b/build-ttf.sh index 1558dece2..54fe629a0 100755 --- a/build-ttf.sh +++ b/build-ttf.sh @@ -7,75 +7,74 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-ttf.sh (--install-dependencies) +# Usage: ./build-ttf.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - use system installed build dependencies # # ///////////////////////////////////////////////////////////////// -# ttfautohint local install path from Werner Lemberg's ttfautohint-build.sh install script -# - 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) +# default build tooling definitions TTFAH="$HOME/ttfautohint-build/local/bin/ttfautohint" +FONTMAKE="pipenv run fontmake" +PYTHON="pipenv run python" +INSTALLFLAG=0 # test for number of arguments if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-ttf.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-ttf.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # fontmake - pip install --upgrade fontmake - # fontTools (installed with fontmake at this time. leave this as dependency check as python scripts for fixes require it should fontTools eliminate dep) - pip install --upgrade fonttools - # ttfautohint v1.6 (must be pinned to v1.6 and above for Hack instruction sets) - tools/scripts/install/ttfautohint-build.sh - -fi - -# confirm executable installs and library imports for build dependencies -INSTALLFLAG=0 - -echo "Confirming that build dependencies are installed..." -echo " " -# fontmake installed -if ! which fontmake - then - echo "Unable to install fontmake with 'pip install fontmake'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -fi -# fontTools python library can be imported -if ! python -c "import fontTools" - then - echo "Unable to install fontTools with 'pip install fonttools'. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 -else - echo "fontTools Python library identified" -fi -# 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 "Unable to install ttfautohint from source. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - INSTALLFLAG=1 - else - TTFAH="ttfautohint" # revise TTFAH variable to ttfautohint installed on the user's PATH for excecution of hints below - fi -fi -# if any of the dependency installs failed, exit and do not attempt build, notify user -if [ $INSTALLFLAG -eq 1 ] - then +# Optional build with system-installed build dependencies instead of pinned build process defined versions +if [ "$1" = "--system" ] + then + # re-define the default executables to executables that exist on PATH + TTFAH="ttfautohint" + FONTMAKE="fontmake" + PYTHON="python3" + + echo "=================================" + echo " BUILD ENVIRONMENT" + echo "=================================" + # test re-defined system-installed build dependency paths + if ! which "$TTFAH"; then + echo "Unable to identify a system installed version of ttfautohint. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + ttfautohint --version + fi + if ! which "$FONTMAKE"; then + echo "Unable to identify a system installed version of fontmake. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + "$FONTMAKE" --version + fi + if ! which "$PYTHON"; then + echo "Unable to identify a Python 3 installation. Please install and try again." 1>&2 + INSTALLFLAG=1 + else + "$PYTHON" --version + fi + echo "=================================" + echo " " + echo "=================================" + echo " " +fi + +# ttfautohint path test for default builds +# test for local ttfautohint install using repository provided install script and defined ttfautohint version (and its dependencies) +# no tests for Python build dependencies here because they are always installed by default & tested in the pipenv virtualenv before these steps +if [ $# -eq 0 ]; then + if ! [ -f "$TTFAH" ]; then + echo "Unable to identify the expected local install path for ttfautohint. Please install and try again." 1>&2 + INSTALLFLAG=1 + fi +fi + +# If any of the dependency checks failed, exit the build and notify user +if [ $INSTALLFLAG -eq 1 ]; then echo "Build canceled." 1>&2 exit 1 fi @@ -110,21 +109,21 @@ fi # build regular set -if ! fontmake -u "source/Hack-Regular.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Regular.ufo" -o ttf then echo "Unable to build the Hack-Regular variant set. Build canceled." 1>&2 exit 1 fi # build bold set -if ! fontmake -u "source/Hack-Bold.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Bold.ufo" -o ttf then echo "Unable to build the Hack-Bold variant set. Build canceled." 1>&2 exit 1 fi # build italic set -if ! fontmake -u "source/Hack-Italic.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-Italic.ufo" -o ttf then echo "Unable to build the Hack-Italic variant set. Build canceled." 1>&2 exit 1 @@ -132,7 +131,7 @@ fi # build bold italic set -if ! fontmake -u "source/Hack-BoldItalic.ufo" -o ttf +if ! $FONTMAKE -u "source/Hack-BoldItalic.ufo" -o ttf then echo "Unable to build the Hack-BoldItalic variant set. Build canceled." 1>&2 exit 1 @@ -144,7 +143,7 @@ fi echo " " echo "Attempting DSIG table fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-dsig.py master_ttf/*.ttf then echo "Unable to complete DSIG table fixes on the release files" exit 1 @@ -154,7 +153,7 @@ fi echo " " echo "Attempting fstype fixes with fontbakery..." echo " " -if ! python postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf +if ! $PYTHON postbuild_processing/fixes/fix-fstype.py master_ttf/*.ttf then echo "Unable to complete fstype fixes on the release files" exit 1 diff --git a/build-woff.sh b/build-woff.sh index e98fe145c..b11b319dd 100755 --- a/build-woff.sh +++ b/build-woff.sh @@ -7,15 +7,14 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-woff.sh (--install-dependencies) +# Usage: ./build-woff.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - build with a system installed version +# of build dependencies # -# NOTE: If you change the source, you must build new ttf files -# with build.sh PRIOR to execution of this script. -# This script builds directly from previous ttf builds, -# not source files. +# NOTE: If you modify the source, you must build new ttf files +# PRIOR to execution of this script. This script builds +# directly from previous ttf builds, not source files. # # /////////////////////////////////////////////////////////////////// @@ -50,55 +49,31 @@ BOLDITALIC_WOFF="hack-bolditalic.woff" if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-woff.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-woff.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # define the current directory (Hack repository) - CUR_DIR=$(pwd) - - if test -d "$BUILD" -o -f "$BUILD"; then - echo "Build directory \`$BUILD' must not exist." - exit 1 - fi - - mkdir "$BUILD" - - cd "$BUILD" || exit 1 - - echo "#####" - echo "Download archive." - echo "#####" - - curl -L -O "https://github.com/bramstein/sfnt2woff-zopfli/archive/v$SFNTWOFF_VERSION.tar.gz" - - echo "#####" - echo "Extract archives." - echo "#####" - - tar -xzvf "v$SFNTWOFF_VERSION.tar.gz" - - cd "$SFNTWOFF" || exit 1 - - echo "#####" - echo "Build $SFNTWOFF." - echo "#####" - - make - - # make Hack repository the current directory again following the build - cd "$CUR_DIR" || exit 1 +# determine if system installed executable on PATH is requested for build +# then test for presence of the sfnt2woff-zopfli build dependency based upon where it should be located +if [ "$1" = "--system" ]; then + SFNTWOFF_BIN="sfnt2woff-zopfli" + if ! which $SFNTWOFF_BIN; then + echo "Unable to identify sfnt2woff-zopfli executable on system PATH. Please install and try again." 1>&2 + exit 1 + else + # display version of installed sfnt2woff-zopfli + echo "Beginning web font build with $SFNTWOFF_BIN" + fi fi - -if [ -f "$SFNTWOFF_BIN" ]; then - echo "Beginning web font build with $SFNTWOFF" -else - 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 - exit 1 +# test for sfnt2woff-zopfli with default build approach +if [ $# -eq 0 ]; then + if [ -f "$SFNTWOFF_BIN" ]; then + echo "Beginning web font build with $SFNTWOFF_BIN" + else + echo "Unable to locate sfnt2woff-zopfli on the path $SFNTWOFF_BIN. Please install this build dependency and then repeat your build attempt." 1>&2 + exit 1 + fi fi # Build woff files from ttf files @@ -165,8 +140,3 @@ fi if [ -f "$WOFF_BUILD/$BOLDITALIC_WOFF" ]; then echo "Bold Italic woff build path: $WOFF_BUILD/$BOLDITALIC_WOFF" fi - - - - - diff --git a/build-woff2.sh b/build-woff2.sh index 42cbbab68..5c1a399f1 100755 --- a/build-woff2.sh +++ b/build-woff2.sh @@ -7,21 +7,18 @@ # Copyright 2018 Christopher Simpkins # MIT License # -# Usage: ./build-woff2.sh (--install-dependencies) +# Usage: ./build-woff2.sh (--system) # Arguments: -# --install-dependencies (optional) - installs all -# build dependencies prior to the build script execution +# --system (optional) - use build dependencies installed on PATH # # NOTE: If you change the source, you must build new ttf files -# with build.sh PRIOR to execution of this script. -# This script builds directly from previous ttf builds, -# not source files. +# PRIOR to the execution of this script. This script builds +# directly from previous ttf builds, not source files. # # /////////////////////////////////////////////////////////////////// # The woff2 git clone directory. BUILD="$HOME" -INST="$HOME/woff2" # woff2 executable path WOFF2_BIN="$BUILD/woff2/woff2_compress" @@ -47,50 +44,31 @@ BOLDITALIC_WOFF="hack-bolditalic.woff2" if [ $# -gt 1 ] then echo "Inappropriate arguments included in your command." 1>&2 - echo "Usage: ./build-woff2.sh (--install-dependencies)" 1>&2 + echo "Usage: ./build-woff2.sh (--system)" 1>&2 exit 1 fi -# Optional build dependency install request with syntax `./build-web.sh --install-dependencies` -if [ "$1" = "--install-dependencies" ] - then - # define the current directory (Hack repository) - CUR_DIR=$(pwd) - - if test -d "$INST" -o -f "$INST"; then - echo "Build directory \`$INST' must not exist." - exit 1 - fi - - cd "$BUILD" || exit 1 - - echo "#####" - echo "git clone woff2 project" - echo "#####" - - # clone the Source Foundry fork of the woff2 repo - # contains fix for OS X build bug - https://github.com/google/woff2/issues/73 - # recursive flag to clone the brotli submodule within the woff2 repo - git clone --recursive https://github.com/source-foundry/woff2.git - - cd "$INST" || exit 1 - - echo "#####" - echo "Build woff2" - echo "#####" - - make clean all - - # make Hack repository the current directory again following the build - cd "$CUR_DIR" || exit 1 +# determine if system installed executable on PATH is requested for build +# then test for presence of the woff2_compress build dependency based upon where it should be located +if [ "$1" = "--system" ]; then + WOFF2_BIN="woff2_compress" + if ! which $WOFF2_BIN; then + echo "Unable to identify woff2_compress executable on system PATH. Please install and try again." 1>&2 + exit 1 + else + # display version of installed woff2_compress + echo "Beginning web font build with $WOFF2_BIN" + fi fi - -if [ -f "$WOFF2_BIN" ]; then - echo "Beginning web font build with $WOFF2_BIN" -else - echo "Unable to locate woff2_compress on path $WOFF2_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 - exit 1 +# test for woff2_compress executable with default build approach +if [ $# -eq 0 ]; then + if [ -f "$WOFF2_BIN" ]; then + echo "Beginning web font build with $WOFF2_BIN" + else + echo "Unable to locate woff2_compress on path $WOFF2_BIN. Please attempt a manual install of this build dependency and then repeat your build attempt." 1>&2 + exit 1 + fi fi # Build woff2 files from ttf files diff --git a/docs/BUILD.md b/docs/BUILD.md index 09c57f984..1ea6ea2ca 100644 --- a/docs/BUILD.md +++ b/docs/BUILD.md @@ -1,37 +1,114 @@ +# Hack Font Builds from Source Files + +Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. The default build approach requires a *nix platform (macOS, Linux, a Unix-like development platform for Windows such as MinGW) and uses pinned build dependency versions to support font files that render reproducibly (relative to upstream repository builds) in a given rendering environment. See the bottom of this document for an alternative approach that uses system-installed versions of all build dependencies and supports build dependency versions that differ from those used in the upstream repository. + +## Quickstart +The following commands will do the following: + +1. Clone the Hack source repository +2. Install the `pipenv` dependency +3. Compile and install a local version `ttfautohint` (i.e., *off of the system PATH*) +4. Build *.ttf desktop fonts +5. Build *.woff web fonts (including subsets) +6. Build *.woff2 web fonts (including subsets) + +**Quickstart Hack font compile process** + +``` +$ git clone https://github.com/source-foundry/Hack.git +$ cd Hack +$ pip3 install pipenv +$ make compile-local-dep +$ make +``` + +The build process takes minutes to complete on the average system. You will see a great deal of text stream by in your terminal during the build. This text stream is normal and expected during the build. + +You will find the compiled fonts in the build directory (located in the top level of the source repository) after you complete these steps. + +Detailed instructions follow if you have difficulties with any of the above steps. If you encounter an error that is not addressed in this build documentation, please report it as a new issue report on the repository. *Please review the entire build document below to confirm that we have not explained how to address your problem before you submit a new issue report*! + +## Contents + +- [Build dependency installation](#build-dependencies) + - [Python interpreter](#python-interpreter-dependency) + - [ttf desktop font dependencies](#desktop-font-ttf-dependencies) + - [woff and woff2 web font dependencies](#web-font-woff--woff2-dependencies) +- [Automated font builds with make](#automated-font-builds) +- [Build paths](#build-paths) +- [Uninstall build dependencies](#uninstall-build-dependencies) + ## Build dependencies -Hack is compiled from UFO v2 spec source files to ttf, woff, and woff2 fonts with free, open source build tools. You can either install the tools manually or use the automated build dependency installation approach documented below. +### Python interpreter dependency -### Desktop font (ttf) build dependencies +The Hack fonts are built with a Python version 3 interpreter. The Python interpreter version is fixed at each git commit. You may view the Python interpreter in use at any commit in the Pipfile and Pipfile.lock files that are located in the root directory of the repository. [Click here](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/source-foundry/Hack%24%40master+python_version) to search for these values in the current HEAD commit of the master branch. + +If this version of the Python interpreter is not available on your development system, you may install [`pyenv`](https://github.com/pyenv/pyenv-installer) before you attempt your build. If `pyenv` is installed before the build, `pipenv` will automatically install the interpreter defined in the Hack build in the virtual environment used for the build, even if it is not installed on your system. + +The pyenv project defines the following command as a supported approach to install `pyenv`: + + +**Pull and install the pyenv executable** + +``` +curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash +``` + +### Desktop font (ttf) dependencies To build the Hack desktop fonts (ttf) from source you will need the following build dependencies: +- [pipenv](https://github.com/pypa/pipenv) Python executable - [fontmake](https://github.com/googlei18n/fontmake) Python executable - [fonttools](https://github.com/fonttools/fonttools) Python library - [ttfautohint](https://www.freetype.org/ttfautohint/) executable (includes Harfbuzz and FreeType dependencies) -### Web font (woff + woff2) build dependencies +`fontmake` and `fontTools` are automatically installed during the compile process. + +`pipenv` must be installed manually with the following command before you attempt a build: + +**Install pipenv** + +``` +$ pip3 install pipenv +``` + +`ttfautohint` (including its Harfbuzz and FreeType dependencies) can be installed locally on the path defined for use in Hack builds with the following command: -To build the Hack web fonts from source you will need all of the build dependencies listed above for desktop font builds. In addition you will need the following dependencies for the web font build steps: +**Compile and install a local copy of ttfautohint** + +``` +$ make compile-local-dep +``` + +This path is defined as the following subdirectory on your $HOME path: + +- ttfautohint: `$HOME/ttfautohint-build` + +### Web font (woff + woff2) dependencies + +To build the Hack web fonts from source you will need all of the build dependencies listed above for desktop font builds and the following additional dependencies: - [sfnt2woff-zopfli](https://github.com/bramstein/sfnt2woff-zopfli) C++ executable - [woff2_compress](https://github.com/source-foundry/woff2) C++ executable +The sfnt2woff-zopfli executable and woff2_compress executable are compiled and installed on a local build path (i.e., off of system PATH) with the following command: -### Automated build dependency installation - -Install all build dependencies for desktop and web fonts with the following make command: +**Compile and install local copies of sfnt2woff-zopfli and woff2_compress** ``` -$ make build-with-dependencies +$ make compile-local-dep ``` -This will install all necessary build dependencies and complete a build of all desktop and web fonts. +These paths are defined as the following subdirectories on your $HOME path: +- sfnt2woff-zopfli: `$HOME/sfnt2woff-zopfli-build` +- woff2: `$HOME/woff2` ## Automated font builds -After the build dependencies are installed, use make targets from the root of the Hack repository to build font sets. +After the build dependencies are installed, use make targets from the root of the Hack repository to build font sets. The following commands build the regular, bold, italic, and bold italic variants of the respective build types: #### Build all desktop and web fonts (including web font subsets) @@ -40,7 +117,7 @@ After the build dependencies are installed, use make targets from the root of th $ make ``` -#### Build ttf desktop fonts +#### Build ttf desktop fonts only ``` $ make ttf @@ -80,37 +157,62 @@ Desktop fonts are available on the path `build/ttf` from the root of the reposit ### Web fonts (woff + woff2) -Web fonts are available on the path `build/web/fonts` from the root of the repository upon completion of your build. +Web fonts are available on the path `build/web/fonts` from the root of the repository upon completion of your build. CSS files that may be used with your web font builds are available on the path `build/web`. + +## Uninstall build dependencies +Python packages that are used during the build process are installed in a virtual environment with `pipenv`. The virtual environment and all Python packages installed in that environment can be eliminated with the execution of the following command in the root of the repository: -## Uninstall +``` +$ pipenv -rm +``` -All build dependencies installed with the automated approaches can be uninstalled with the following commands: +All compiled project build dependencies installed as part of this build process can be uninstalled with the following commands: ``` -$ pip uninstall fontmake -$ pip uninstall fonttools $ rm -rf ~/ttfautohint-build $ rm -rf ~/sfnt2woff-zopfli-build $ rm -rf ~/woff2 ``` -Here are all of the above commands in a single line that can be copied/pasted into your terminal to accomplish the entire uninstall process: +In cases where a compile did not proceed to completion (e.g., you intentionally exited early, or an exception was raised that led to an early termination of the build), a temporary directory may still exist in the root of the repository on the path `master_ttf`. This directory can be removed with: + +``` +$ rm -rf master_ttf +``` + +## Compile with system PATH installed build dependencies + +The following make targets are available for those who would like to build with system PATH installed versions of all build dependencies. This approach allows you build with dependency versions that differ from those used in the upstream project. Please see the note at the bottom of this section for caveats to this approach. + +#### System PATH build dependency compiles of all fonts ``` -$ pip uninstall fontmake && pip uninstall fonttools && rm -rf ~/ttfautohint-build && rm -rf ~/sfnt2woff-zopfli-build && rm -rf ~/woff2 +$ make build-system ``` -In cases where a compile did not proceed to completion (e.g. you intentionally exited early or an exception was raised) a temporary directory may still exist in the root of the repository on the path `master_ttf`. This can be removed with: +#### System PATH build dependency compiles of desktop fonts ``` -$ rm -rf master_ttf +$ make ttf-system +``` + +#### System PATH build dependency compiles of all web fonts + +``` +$ make webfonts-system ``` -### Uninstall Details +#### System PATH build dependency compiles of woff web fonts -fontmake and fonttools are Python packages and are uninstalled with pip. +``` +$ make woff-system +``` -The FreeType library (including its build dependency Harfbuzz), ttfautohint, sfnt2woff-zopfli, and woff2 are built in directories on your $HOME path. They are not installed on your $PATH (unless of course you have defined $HOME on $PATH) so they **will not** work from the command line with the name of the executable file only (e.g. `$ ttfautohint [file path]`). This is intentional. +#### System PATH build dependency compiles of woff web fonts + +``` +$ make woff2-system +``` -Repeat execution of the build process cleans up the temporary directory `master_ttf` if found so this step is not mandatory to repeat a build and should not lead to errors with the build. +You must install all build dependencies before use of these make targets. Please refer to the documentation for the respective build dependency projects for details about installations. While we release these system PATH installed compile make targets to simplify the approach to builds for users who prefer not to (or cannot) create a development environment that matches the one used for our upstream builds, this approach is not otherwise supported or tested in this repository. Please understand this caveat if you intend to release fonts built with this approach in a production environment as differences in the build dependency versions can alter font renders. diff --git a/postbuild_processing/fixes/fix-dsig.py b/postbuild_processing/fixes/fix-dsig.py index 9502712fa..916ab1108 100644 --- a/postbuild_processing/fixes/fix-dsig.py +++ b/postbuild_processing/fixes/fix-dsig.py @@ -14,34 +14,36 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# See AUTHORS.txt for the list of Authors and LICENSE.txt for the License. - # Adapted for the Hack typeface build workflow by Chris Simpkins - -from __future__ import print_function, unicode_literals import sys import os from fontTools import ttLib def set_empty_dsig(ttFont): - newDSIG = ttLib.newTable("DSIG") - newDSIG.ulVersion = 1 - newDSIG.usFlag = 0 - newDSIG.usNumSigs = 0 - newDSIG.signatureRecords = [] - ttFont.tables["DSIG"] = newDSIG + newDSIG = ttLib.newTable("DSIG") + newDSIG.ulVersion = 1 + newDSIG.usFlag = 0 + newDSIG.usNumSigs = 0 + newDSIG.signatureRecords = [] + ttFont.tables["DSIG"] = newDSIG + def main(argv): - for path in argv: - if not os.path.exists(path): - sys.stderr.write("[fix-dsig.py] ERROR: " + path + " is not a valid path to a font file") - sys.exit(1) - else: - font = ttLib.TTFont(path) - set_empty_dsig(font) - font.save(path) - print(path + " - successful DSIG table fix") + for path in argv: + if not os.path.exists(path): + sys.stderr.write( + "[fix-dsig.py] ERROR: " + + path + + " is not a valid path to a font file" + ) + sys.exit(1) + else: + font = ttLib.TTFont(path) + set_empty_dsig(font) + font.save(path) + print(path + " - successful DSIG table fix") + if __name__ == '__main__': - main(sys.argv[1:]) + main(sys.argv[1:]) diff --git a/postbuild_processing/fixes/fix-fstype.py b/postbuild_processing/fixes/fix-fstype.py index 011251139..41fdb94a3 100644 --- a/postbuild_processing/fixes/fix-fstype.py +++ b/postbuild_processing/fixes/fix-fstype.py @@ -14,17 +14,20 @@ # See the License for the specific language governing permissions and # limitations under the License. # - # Adapted for the Hack typeface build workflow by Chris Simpkins - import os import sys from fontTools.ttLib import TTFont + def main(argv): for path in argv: if not os.path.exists(path): - sys.stderr.write("[fix-fstype.py] ERROR: " + path + " is not a valid path to a font file") + sys.stderr.write( + "[fix-fstype.py] ERROR: " + + path + + " is not a valid path to a font file" + ) sys.exit(1) else: font = TTFont(path) @@ -32,5 +35,6 @@ def main(argv): font.save(path) print(path + " - successful fstype fix") + if __name__ == '__main__': - main(sys.argv[1:]) + main(sys.argv[1:]) diff --git a/tools/scripts/install/sfnt2woff-zopfli-build.sh b/tools/scripts/install/sfnt2woff-zopfli-build.sh new file mode 100755 index 000000000..4cdd9bcf7 --- /dev/null +++ b/tools/scripts/install/sfnt2woff-zopfli-build.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# sfnt2woff-zopfli-build.sh +# A shell script that builds the sfnt2woff-zopfli build dependency +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./sfnt2woff-zopfli-build.sh +# +# ///////////////////////////////////////////////////////////////// + +# The sfnt2woff-zopfli build directory. +BUILD="$HOME/sfnt2woff-zopfli-build" + +# sfnt2woff-zopfli version +SFNTWOFF_VERSION="1.1.0" +SFNTWOFF="sfnt2woff-zopfli-$SFNTWOFF_VERSION" + +# Path to sfnt2woff-zopfli executable +SFNTWOFF_BIN="$BUILD/$SFNTWOFF/sfnt2woff-zopfli" + +if test -d "$BUILD" -o -f "$BUILD"; then + echo "Build directory '$BUILD' must not exist." + exit 1 +fi + +mkdir "$BUILD" + +cd "$BUILD" || exit 1 + +echo "#####" +echo "Download archive." +echo "#####" + +curl -L -O "https://github.com/bramstein/sfnt2woff-zopfli/archive/v$SFNTWOFF_VERSION.tar.gz" + +echo "#####" +echo "Extract archives." +echo "#####" + +tar -xzvf "v$SFNTWOFF_VERSION.tar.gz" + +cd "$SFNTWOFF" || exit 1 + +echo "#####" +echo "Build $SFNTWOFF." +echo "#####" + +make + +if [ -f "$SFNTWOFF_BIN" ]; then + echo "sfnt2woff-zopfli successfully built on the path '$SFNTWOFF_BIN'" +else + echo "The sfnt2woff-zopfli build failed." + exit 1 +fi diff --git a/tools/scripts/install/woff2-compress-build.sh b/tools/scripts/install/woff2-compress-build.sh new file mode 100755 index 000000000..3f17c959b --- /dev/null +++ b/tools/scripts/install/woff2-compress-build.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +# ///////////////////////////////////////////////////////////////// +# +# woff2-compress-build.sh +# A shell script that builds the woff2_compress build dependency +# Copyright 2018 Christopher Simpkins +# MIT License +# +# Usage: ./woff2-compress-build.sh +# +# ///////////////////////////////////////////////////////////////// + +# The woff2 git clone directory. +BUILD="$HOME" +INST="$HOME/woff2" +WOFF2_COMMIT="5e5f2cf20d5f9d3373a2d8b4905105f80646c014" + +# woff2 executable path +WOFF2_BIN="$BUILD/woff2/woff2_compress" + +if test -d "$INST" -o -f "$INST"; then + echo "Build directory \`$INST' must not exist." + exit 1 +fi + +cd "$BUILD" || exit 1 + +echo "#####" +echo "git clone woff2 project" +echo "#####" + +# clone the woff2 repository +git clone --recursive https://github.com/google/woff2.git + +cd "$INST" || exit 1 + +# checkout desired version tag +echo " " +echo "Checking out woff2 at commit $WOFF2_COMMIT" +git checkout $WOFF2_COMMIT + +echo "#####" +echo "Build woff2" +echo "#####" + +make clean all + +if [ -f "$WOFF2_BIN" ]; then + echo " " + echo "woff2_compress successfully built on the path '$WOFF2_BIN'" +else + echo "The woff2_compress build failed." + exit 1 +fi