Skip to content

Refactor build scripting to support Python 3 only builds, pinned build dependency versions, optional system installed build dependencies #416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Apr 9, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
8490024
add support for pipenv Python dependency version pinning
chrissimpkins Mar 7, 2018
384f3fa
copies build-ttf.sh as build-ttf-system.sh to use as basis for script…
chrissimpkins Mar 7, 2018
fe6e6ba
[build-pipenv.sh] added new shell script that supports builds of venv…
chrissimpkins Mar 8, 2018
e3c0e97
updated script documentation
chrissimpkins Mar 8, 2018
1700e78
[build-pipenv.sh] modified if blocks in shell script
chrissimpkins Mar 8, 2018
74d359e
[build-pipenv.sh] add Python interpreter version to environment report
chrissimpkins Mar 8, 2018
0eb8a96
[build-ttf.sh] transitioned Python build tool calls to use of pipenv …
chrissimpkins Mar 8, 2018
176a14a
[build-subsets.sh] eliminated build dependency checks, these are now …
chrissimpkins Mar 8, 2018
bda185c
[build-subsets.sh] transitioned to use of pipenv virtualenv installs …
chrissimpkins Mar 8, 2018
da20882
[Makefile] added pipenv venv setup script to the build process
chrissimpkins Mar 8, 2018
7de5d65
added Python interpreter version definition to virtualenv scripting
chrissimpkins Mar 15, 2018
10c5444
modified build variable name
chrissimpkins Mar 15, 2018
aff9f86
removed unnecessary build shell script
chrissimpkins Mar 15, 2018
4d8a9a1
added new sfnt2woff-zopfli local install script
chrissimpkins Mar 15, 2018
953c35b
[build-ttf.sh] updated script to support pinned and system installed …
chrissimpkins Mar 15, 2018
14b1912
[Makefile] updated make targets
chrissimpkins Mar 15, 2018
dd71f61
[build-woff.sh] added support for pinned version and system installed…
chrissimpkins Mar 15, 2018
353455d
[build-ttf.sh] fixes incorrect executable path checks with system ins…
chrissimpkins Mar 15, 2018
0da551b
[build-woff.sh] refactored default build approach path test for depen…
chrissimpkins Mar 15, 2018
c0f9b0c
added new woff2-compress-build shell script for local builds of woff2…
chrissimpkins Mar 15, 2018
f1c3c53
[Makefile] updated make target shell script path for local woff2_comp…
chrissimpkins Mar 15, 2018
8b05246
[build-woff2.sh] added support for pinned dependency builds and rolli…
chrissimpkins Mar 15, 2018
63c6f05
[build-woff2.sh] removed unnecessary variable
chrissimpkins Mar 15, 2018
83eac63
[Makefile] updated shellcheck target deps
chrissimpkins Mar 15, 2018
2b1d273
[build-subsets.sh] updated shell script to support pinned build depen…
chrissimpkins Mar 15, 2018
843e689
new build-archives.sh shell script
chrissimpkins Mar 15, 2018
1028b7e
[Makefile] updated archives make target with new shell script path
chrissimpkins Mar 15, 2018
842a21f
[Makefile] added subsets-system make target
chrissimpkins Mar 16, 2018
4c48555
[Makefile] added subsets-system target to .PHONY
chrissimpkins Mar 16, 2018
e20d786
[fix-dsig.py] removed from __future__ imports, code formatting = pass…
chrissimpkins Mar 16, 2018
0a01f04
[fix-fstype.py] source code formatting changes = passes flake8 tests
chrissimpkins Mar 16, 2018
96a35cb
[woff2-compress-build.sh] convert to upstream woff2 at v1.0.2 (includ…
chrissimpkins Mar 16, 2018
ee180fb
[build-pipenv.sh] modified command to create the pipenv virtual envir…
chrissimpkins Mar 16, 2018
8b7feda
[Makefile] added documentation and process specific target arrangement
chrissimpkins Mar 17, 2018
d6df277
[BUILD.md] updated build documentation with v4.x build tooling changes
chrissimpkins Mar 18, 2018
1dd3664
[BUILD.md] added TOC
chrissimpkins Mar 18, 2018
b1ebe12
[BUILD.md] minor text revisions
chrissimpkins Mar 18, 2018
bc6a683
[BUILD.md] added documentation for system PATH installed build depend…
chrissimpkins Mar 18, 2018
2a46cad
[woff2-compress-build.sh] modified woff2_compress to use brotli v1.0.3
chrissimpkins Mar 21, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 75 additions & 21 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

fonttools = "*"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to specify fonttools in addition to fontmake, because the former is a dependency of the latter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Safe to depend on the fact that this will always be the case? We have local Python scripts that depend on fontTools and will not pull it in with a pip install. pipenv simply ignores it since it was pulled in with fontmake.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, if you've scripts that directly depend on fonttools then it makes sense to have it there.

fontmake = "*"


[dev-packages]



[requires]

python_version = "3.6"
144 changes: 144 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 52 additions & 0 deletions build-pipenv.sh
Original file line number Diff line number Diff line change
@@ -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 " "
Loading