diff --git a/assets/showcase.mp4 b/assets/showcase.mp4 new file mode 100644 index 0000000..1b4c6fd Binary files /dev/null and b/assets/showcase.mp4 differ diff --git a/bin/meowc.ml b/bin/meowc.ml index b798721..16c625d 100644 --- a/bin/meowc.ml +++ b/bin/meowc.ml @@ -1,6 +1,8 @@ open Meow open Types +let version = "0.1.0" + let usage = String.concat "\n" [ @@ -35,6 +37,7 @@ let usage = " -v print each command as it finishes"; " -q only print warnings and errors"; " --no-color plain output"; + " --version print the version and exit"; ] let cores_from_cpuinfo () = @@ -120,6 +123,7 @@ let parse_args argv = | "-q" :: r -> fl.quiet <- true; go r | "--no-color" :: r -> Style.enabled := false; go r | ("-h" | "--help") :: _ -> print_endline usage; exit 0 + | ("-V" | "--version") :: _ -> print_endline ("meowc " ^ version); exit 0 | (("-f" | "-j" | "-C" | "-D" | "--prefix" | "--target" | "--sysroot") as o) :: [] -> Diag.error "%s needs a value" o | a :: r when String.length a > 2 && String.sub a 0 2 = "-j" -> diff --git a/tools/record-showcase.sh b/tools/record-showcase.sh new file mode 100755 index 0000000..faec694 --- /dev/null +++ b/tools/record-showcase.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +source "$(dirname "${BASH_SOURCE[0]}")/record-lib.sh" + +GEOMETRY=${GEOMETRY:-1280x720} +LUA=${LUA:-$HOME/projects/lua} +OUT="$ROOT/assets/showcase.mp4" +WORK=$(mktemp -d) + +cp -a "$LUA" "$WORK/lua" +rm -rf "$WORK/lua/build" +mkdir -p "$WORK/bin" +ln -sf "$ROOT/meowc" "$WORK/bin/meowc" + +start_xvfb "$GEOMETRY" + +kitty \ + --config "$HOME/.config/kitty/kitty.conf" \ + -o remember_window_size=no \ + -o "initial_window_width=${GEOMETRY%x*}" \ + -o "initial_window_height=${GEOMETRY#*x}" \ + -o confirm_os_window_close=0 \ + --directory "$WORK/lua" \ + -- bash --noprofile --norc >/dev/null 2>&1 & +sleep 3 + +for _ in $(seq 30); do + xdotool search --onlyvisible --class kitty >/dev/null 2>&1 && break + sleep 1 +done +xdotool search --onlyvisible --class kitty windowactivate >/dev/null 2>&1 || true +xdotool type --delay 10 -- 'export PS1="lua-5.4.7 $ " WINEDEBUG=-all LIBGL_ALWAYS_SOFTWARE=1 MESA_DEBUG=silent PATH='"$WORK"'/bin:$PATH; clear' +xdotool key Return +sleep 1 + +start_capture "$GEOMETRY" "$WORK/showcase.mkv" + +send_line 'meowc build' 8.5 +send_line './build/bin/lua -v' 1.8 +send_line 'meowc --target x86_64-w64-mingw32 build' 13 +send_line 'file build/x86_64-w64-mingw32/bin/lua.exe' 2.2 +send_line 'wine build/x86_64-w64-mingw32/bin/lua.exe -v' 3.2 + +stop_capture + +# Fit the cut to the target length rather than truncating the ending off it +LIMIT=${LIMIT:-29.5} +raw=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$WORK/showcase.mkv") +speed=$(python3 -c "print(max(1.0, $raw / $LIMIT))") +ffmpeg -v error -y -i "$WORK/showcase.mkv" -an -vf "setpts=PTS/$speed" \ + -c:v libx264 -crf 20 -preset slow -pix_fmt yuv420p -movflags +faststart "$OUT" +echo "raw ${raw}s, sped up ${speed}x" +rm -rf "$WORK" +echo "wrote $OUT"