-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
130 lines (97 loc) · 3.36 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# unnamed-emoji
# https://github.com/gucci-on-fleek/unnamed-emoji
# SPDX-License-Identifier: MPL-2.0+
# SPDX-FileCopyrightText: 2023 Max Chernoff
# Configuration
.ONESHELL:
.SHELLFLAGS = -euc
export TEXMFHOME = ${CURDIR}/texmf
# Default target
.DEFAULT_GOAL := default
.PHONY: default
default:
${error Please specify a target.}
# Build the font files
qpdf := qpdf \
--verbose \
--linearize \
--compress-streams=y \
--recompress-flate \
--compression-level=9 \
--object-streams=generate \
--remove-unreferenced-resources=yes \
--replace-input
define build_font =
temp="$$(mktemp -d)"
cd "$$temp"
${CURDIR}/source/svg-to-pdf.cld \
--path=${CURDIR}/source/ \
--in=${abspath $<} \
--font=${basename ${notdir $@}} \
--cldr=${CURDIR}/third-party/cldr-json/
${qpdf} ./svg-to-pdf.pdf
mv ./svg-to-pdf.pdf ${abspath $@}
rm -r "$$temp"
endef
fonts/noto-emoji.pdf: third-party/noto-emoji/svg source/svg-to-pdf.cld
${build_font}
fonts/twemoji.pdf: third-party/twemoji/assets/svg source/svg-to-pdf.cld
${build_font}
fonts/fxemoji.pdf: third-party/fxemoji/svgs/FirefoxEmoji
${build_font}
fonts/openmoji.pdf: third-party/openmoji/color/svg source/svg-to-pdf.cld
${build_font}
fonts/emojione.pdf: third-party/emojione/assets/svg source/svg-to-pdf.cld
${build_font}
fonts/fluent-flat.pdf: third-party/fluentui-emoji/assets source/svg-to-pdf.cld
${build_font}
fonts/noto-blob.pdf: third-party/noto-blob/svg source/svg-to-pdf.cld
${build_font}
.PHONY: fonts
fonts: fonts/noto-emoji.pdf fonts/twemoji.pdf fonts/fxemoji.pdf fonts/openmoji.pdf fonts/emojione.pdf fonts/fluent-flat.pdf fonts/noto-blob.pdf ;
# Build the manual
documentation/unemoji-manual.pdf: documentation/unemoji-manual.tex
cd ${dir $<}
context ${notdir $<}
.PHONY: manual
manual: documentation/unemoji-manual.pdf ;
# Build the specimens
documentation/unemoji-specimens.pdf: documentation/unemoji-specimens.cld
cd ${dir $<}
./${notdir $<}
${qpdf} ${notdir $@}
.PHONY: specimens
specimens: documentation/unemoji-specimens.pdf ;
# Make the flags
.PHONY: noto-flags
noto-flags: third-party/region-flags/svg/
find $< -name '*.svg' -print \
| parallel --will-cite --jobs 0 -- source/make-flags.lua \
third-party/warp/naive_warp.py third-party/noto-emoji/svg/
# Bundle the files
.PHONY: bundle
bundle:
rm -r ${CURDIR}/build/ctan ${CURDIR}/build/*.zip || true
cd "${CURDIR}/texmf"
zip -r "${CURDIR}/build/unnamed-emoji.tds.zip" ./*
mkdir -p "${CURDIR}/build/ctan" && cd "${CURDIR}/build/ctan"
mkdir -p unnamed-emoji
find -L "${CURDIR}/texmf" -type f -exec cp '{}' unnamed-emoji \;
cp "${CURDIR}/build/unnamed-emoji.tds.zip" .
zip -r "${CURDIR}/build/unnamed-emoji.ctan.zip" ./*
# Update the file versions
version_run := git ls-files ':!:*.pdf' ':!:texmf' ':!:third-party' | xargs sed -Ei
.PHONY: update-version
update-version:
${version_run} "/%%[v]ersion/ s/[[:digit:]]\.[[:digit:]]\.[[:digit:]]/${version}/"
${version_run} "/%%[d]ashdate/ s/[[:digit:]]{4}.[[:digit:]]{2}.[[:digit:]]{2}/$$(date -I)/"
${version_run} "/%%[s]lashdate/ s|[[:digit:]]{4}.[[:digit:]]{2}.[[:digit:]]{2}|$$(date +%Y/%m/%d)|"
# Initialize the submodules
.PHONY: submodules
submodules: .gitmodules_sparse
git -c include.path=${abspath $^} submodule update --filter=blob:none --depth=1 --init
# Apply the necessary patches to ConTeXt
.PHONY: fix-context
fix-context:
sed -i '/registerfontmethod/,+4!b;{s/--/ /}' "$$(kpsewhich lpdf-emb.lmt)"
context --make