use Makefile to use make -j all
This commit is contained in:
parent
3252093a0e
commit
1b77b1af54
35
Makefile
Normal file
35
Makefile
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
FONTARTS := $(sort \
|
||||||
|
$(patsubst %.otf,%,\
|
||||||
|
$(patsubst %.woff,%,\
|
||||||
|
$(patsubst %.woff2,%,\
|
||||||
|
$(wildcard *.woff2 *.woff *.otf)\
|
||||||
|
))))
|
||||||
|
OTFS := $(patsubst %,%.otf,$(FONTARTS))
|
||||||
|
WOFFS := $(patsubst %,%.woff,$(FONTARTS))
|
||||||
|
WOFF2S := $(patsubst %,%.woff2,$(FONTARTS))
|
||||||
|
FONTS := $(OTFS) $(WOFFS) $(WOFF2S)
|
||||||
|
CACHES := $(patsubst %,%.fc,$(FONTS))
|
||||||
|
|
||||||
|
all: fonts caches
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
fonts: $(FONTS)
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
caches: $(CACHES)
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
%.woff: %.otf
|
||||||
|
sfnt2woff-zopfli "$<"
|
||||||
|
|
||||||
|
%.woff2: %.otf
|
||||||
|
woff2_compress "$<"
|
||||||
|
|
||||||
|
%.otf.fc: %.otf fc.format
|
||||||
|
> "$@" LANG=C LC_NUMERIC=C fc-scan --format "$$(cat fc.format)" "$<"
|
||||||
|
|
||||||
|
%.woff.fc: %.woff fc.format
|
||||||
|
> "$@" LANG=C LC_NUMERIC=C fc-scan --format "$$(cat fc.format)" "$<"
|
||||||
|
|
||||||
|
%.woff2.fc: %.woff.fc
|
||||||
|
cp "$<" "$@"
|
9
fc.format
Normal file
9
fc.format
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
family=%{family}
|
||||||
|
fullname=%{fullname}
|
||||||
|
postscriptname=%{postscriptname}
|
||||||
|
variable=%{variable}
|
||||||
|
slant=%{slant}
|
||||||
|
style=%{style}
|
||||||
|
weight=%{weight}
|
||||||
|
width=%{width}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
({src ? null , srcs ? null, name ? "", pname ? "", version ? ""}:
|
({src ? null , srcs ? null, name ? "", pname ? "", version ? ""}:
|
||||||
with pkgs;
|
with pkgs;
|
||||||
let
|
let
|
||||||
|
escapeShellArg = lib.strings.escapeShellArg;
|
||||||
name_ =
|
name_ =
|
||||||
if "" != name
|
if "" != name
|
||||||
then name
|
then name
|
||||||
|
@ -25,52 +26,59 @@
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
>"Makefile" echo ${escapeShellArg (builtins.readFile ./Makefile)}
|
||||||
|
>"fc.format" echo ${escapeShellArg (builtins.readFile ./fc.format)}
|
||||||
'';
|
'';
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
set -e
|
set -e
|
||||||
build_dir="$TMPDIR/build"
|
build_dir="$TMPDIR/build"
|
||||||
mkdir "$build_dir"
|
mkdir "$build_dir"
|
||||||
find "$source_dir" \( -name \*.otf -or -name \*.ttf -or -name \*.woff -or -name \*.woff2 \) -exec cp \{\} "$build_dir" \;
|
find "$source_dir" \( -name Makefile -or -name fc.format -or -name \*.otf -or -name \*.ttf -or -name \*.woff -or -name \*.woff2 \) -exec cp \{\} "$build_dir" \;
|
||||||
cd "$build_dir"
|
cd "$build_dir"
|
||||||
|
for f in *.ttf
|
||||||
for s in *.otf *.ttf
|
|
||||||
do
|
do
|
||||||
bn="''${s%.otf}"
|
[ -f "''${f%.ttf}.otf" ] || mv "$f" "''${f%.ttf}.otf"
|
||||||
bn="''${bn%.ttf}"
|
|
||||||
if ! [ -e "$bn.woff" ]
|
|
||||||
then
|
|
||||||
echo "sfnt2woff-zopfli $s => $bn.woff"
|
|
||||||
sfnt2woff-zopfli "$s"
|
|
||||||
fi
|
|
||||||
if ! [ -e "$bn.woff2" ]
|
|
||||||
then
|
|
||||||
echo "woff2_compress $s => $bn.woff2"
|
|
||||||
woff2_compress "$s"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
for s in *.otf *.ttf *.woff
|
|
||||||
do
|
|
||||||
fc="`dirname "$s"`/`basename "$s"`.fc"
|
|
||||||
echo "fc-scan $s"
|
|
||||||
LANG=C LC_NUMERIC=C fc-scan --format 'family=%{family}
|
|
||||||
fullname=%{fullname}
|
|
||||||
postscriptname=%{postscriptname}
|
|
||||||
variable=%{variable}
|
|
||||||
slant=%{slant}
|
|
||||||
style=%{style}
|
|
||||||
weight=%{weight}
|
|
||||||
width=%{width}
|
|
||||||
|
|
||||||
' "$s" > "$fc"
|
|
||||||
done
|
|
||||||
for s in *.woff2
|
|
||||||
do
|
|
||||||
o="`dirname "$s"`/`basename "$s" .woff2`.woff.fc"
|
|
||||||
fc="`dirname "$s"`/`basename "$s"`.fc"
|
|
||||||
cp "$o" "$fc"
|
|
||||||
done
|
done
|
||||||
|
make -j all
|
||||||
'';
|
'';
|
||||||
|
# for s in *.otf *.ttf
|
||||||
|
# do
|
||||||
|
# bn="''${s%.otf}"
|
||||||
|
# bn="''${bn%.ttf}"
|
||||||
|
# if ! [ -e "$bn.woff" ]
|
||||||
|
# then
|
||||||
|
# echo "sfnt2woff-zopfli $s => $bn.woff"
|
||||||
|
# sfnt2woff-zopfli "$s"
|
||||||
|
# fi
|
||||||
|
# if ! [ -e "$bn.woff2" ]
|
||||||
|
# then
|
||||||
|
# echo "woff2_compress $s => $bn.woff2"
|
||||||
|
# woff2_compress "$s"
|
||||||
|
# fi
|
||||||
|
# done
|
||||||
|
#
|
||||||
|
# for s in *.otf *.ttf *.woff
|
||||||
|
# do
|
||||||
|
# fc="`dirname "$s"`/`basename "$s"`.fc"
|
||||||
|
# echo "fc-scan $s"
|
||||||
|
# LANG=C LC_NUMERIC=C fc-scan --format 'family=%{family}
|
||||||
|
#fullname=%{fullname}
|
||||||
|
#postscriptname=%{postscriptname}
|
||||||
|
#variable=%{variable}
|
||||||
|
#slant=%{slant}
|
||||||
|
#style=%{style}
|
||||||
|
#weight=%{weight}
|
||||||
|
#width=%{width}
|
||||||
|
#
|
||||||
|
#' "$s" > "$fc"
|
||||||
|
# done
|
||||||
|
# for s in *.woff2
|
||||||
|
# do
|
||||||
|
# o="`dirname "$s"`/`basename "$s" .woff2`.woff.fc"
|
||||||
|
# fc="`dirname "$s"`/`basename "$s"`.fc"
|
||||||
|
# cp "$o" "$fc"
|
||||||
|
# done
|
||||||
|
# '';
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
cd "$TMPDIR"
|
cd "$TMPDIR"
|
||||||
mkdir -p $out/share/{doc/${name_},fonts/{opentype,truetype,WOFF,WOFF2}{,/.fc}}
|
mkdir -p $out/share/{doc/${name_},fonts/{opentype,truetype,WOFF,WOFF2}{,/.fc}}
|
||||||
|
|
Loading…
Reference in a new issue