old makefiles

This commit is contained in:
Aleksey 2023-09-29 17:03:18 +04:00
parent f9216b6dda
commit 23a0d0ad45
2 changed files with 32 additions and 0 deletions

14
Makefile Normal file
View File

@ -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

18
make.jq Normal file
View File

@ -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")