google-noto-emoji-fonts/noto-emoji-use-system-pngquant.patch
2016-04-22 15:20:53 +08:00

60 lines
2.0 KiB
Diff

Index: noto-emoji-e7a7241a929625feb16920a40bfa29e4a302b82b/Makefile
===================================================================
--- noto-emoji-e7a7241a929625feb16920a40bfa29e4a302b82b.orig/Makefile
+++ noto-emoji-e7a7241a929625feb16920a40bfa29e4a302b82b/Makefile
@@ -15,10 +15,9 @@
EMOJI = NotoColorEmoji
font: $(EMOJI).ttf
-CFLAGS = -std=c99 -Wall -Wextra `pkg-config --cflags --libs cairo`
+CFLAGS = $(OPT_CFLAGS) `pkg-config --cflags --libs cairo`
LDFLAGS = `pkg-config --libs cairo`
-PNGQUANTDIR := third_party/pngquant
-PNGQUANT := $(PNGQUANTDIR)/pngquant
+PNGQUANT = pngquant
PNGQUANTFLAGS = --speed 1 --skip-if-larger --force
# zopflipng is better (about 5-10%) but much slower. it will be used if
@@ -92,6 +91,12 @@ ALL_QUANTIZED_FILES = $(addprefix $(QUAN
ALL_COMPRESSED_FILES = $(addprefix $(COMPRESSED_DIR)/, $(ALL_NAMES))
# tool checks
+ifeq (,$(shell which $(PNGQUANT)))
+ ifeq (,$(wildcard $(PNGQUANT)))
+ MISSING_PNGQUANT = fail
+ endif
+endif
+
ifeq (,$(shell which $(ZOPFLIPNG)))
ifeq (,$(wildcard $(ZOPFLIPNG)))
MISSING_ZOPFLI = fail
@@ -121,6 +126,11 @@ quantized: $(ALL_QUANTIZED_FILES)
compressed: $(ALL_COMPRESSED_FILES)
+check_quantization_tool:
+ifdef MISSING_PNGQUANT
+ $(error "$(PNGQUANT) is not available")
+endif
+
check_compress_tool:
ifdef MISSING_ZOPFLI
ifdef MISSING_OPTIPNG
@@ -141,8 +151,7 @@ endif
$(EMOJI_DIR) $(FLAGS_DIR) $(RESIZED_FLAGS_DIR) $(RENAMED_FLAGS_DIR) $(QUANTIZED_DIR) $(COMPRESSED_DIR):
mkdir -p "$@"
-$(PNGQUANT):
- $(MAKE) -C $(PNGQUANTDIR)
+$(PNGQUANT): check_quantization_tool
waveflag: waveflag.c
$(CC) $< -o $@ $(CFLAGS) $(LDFLAGS)
@@ -213,5 +222,5 @@ clean:
.SECONDARY: $(EMOJI_FILES) $(FLAG_FILES) $(RESIZED_FLAG_FILES) $(RENAMED_FLAG_FILES) \
$(ALL_QUANTIZED_FILES) $(ALL_COMPRESSED_FILES)
-.PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool
+.PHONY: clean flags emoji renamed_flags quantized compressed check_compress_tool check_quantization_tool