From 23a0d0ad458148775d803f15e81e8d0314bac2ed Mon Sep 17 00:00:00 2001 From: Aleksey Chubukov Date: Fri, 29 Sep 2023 17:03:18 +0400 Subject: [PATCH] old makefiles --- Makefile | 14 ++++++++++++++ make.jq | 18 ++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 Makefile create mode 100644 make.jq diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f2da5cc --- /dev/null +++ b/Makefile @@ -0,0 +1,14 @@ +.PHONY: all subrecipes_png subrecipes_webp +makeFileDir := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +all: subrecipes_png subrecipes_webp + true +subrecipes_webp: stickers.json $(makeFileDir)/make.jq + mkdir -p ./stickers + jq -r -f make.jq --arg out_format '-f webp -preset:v icon -frames 1 ' --arg out_ext webp stickers.json > src/Makefile.webp.mk + $(MAKE) -C src -f Makefile.webp.mk +subrecipes_png: stickers.json $(makeFileDir)/make.jq + mkdir -p ./stickers + jq -r -f make.jq --arg out_format '-preset:v icon -frames 1' --arg out_ext png stickers.json > src/Makefile.png.mk + $(MAKE) -C src -f Makefile.png.mk +stickers.json: + touch stickers.json diff --git a/make.jq b/make.jq new file mode 100644 index 0000000..6b85728 --- /dev/null +++ b/make.jq @@ -0,0 +1,18 @@ +#!/usr/bin/env jq +. as $stickers | [ + "allstickers_"+$out_ext+": " + ( [ $stickers[]| select(.disabled != "true") | "../stickers/sticker_"+.name+"."+$out_ext ] | join(" ")), + ($stickers[] | select(.disabled != "true") | [ + "../stickers/sticker_"+.name+"."+$out_ext + ": "+ ((.in[]| select(.format != "lavfi") | .input )|gsub("(\\s+)"; "\\ ")), + "ffmpeg " + +(if .in.base.format then "-f "+.in.base.format else "" end) +" -i "+ (.in.base.input|@sh) + + " -vf " + +(if .colors and .colors.transparent then "geq=\\''" + +"r=if(lt(alpha(X,Y),128),"+(.colors.transparent[0]|tostring)+",r(X,Y)):" + +"g=if(lt(alpha(X,Y),128),"+(.colors.transparent[1]|tostring)+",g(X,Y)):" + +"b=if(lt(alpha(X,Y),128),"+(.colors.transparent[2]|tostring)+",b(X,Y)):" + +"a=alpha(X,Y)'\\'," else "" end) + +"scale=w=512:h=512:force_original_aspect_ratio=decrease" + + " " + +"-y -lossless 1 "+$out_format+" ../stickers/sticker_"+.name+"."+$out_ext + ] | join("\n\t")) +] | join ("\n")