This repository has no description
1#!/usr/bin/env bash
2set -euo pipefail
3
4ROOT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)"
5PROBE_DIR="$ROOT_DIR/tests/cubism-probe"
6CONTROL_DIR="$ROOT_DIR/tests/gdextension-control"
7OPENVT_DIR="$ROOT_DIR/vendor/open-vt"
8ADDON_DIR="$PROBE_DIR/addons/gd_cubism"
9LIB_DIR="$ADDON_DIR/bin/linux/x86_64"
10MODEL_PATH="/home/nandi/.local/share/godot/app_userdata/open-vt/Live2DModels/Haru/Haru.model3.json"
11
12export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-/run/user/$(id -u)}"
13export WAYLAND_DISPLAY="${WAYLAND_DISPLAY:-wayland-1}"
14export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:-}"
15
16pass() { echo "PASS: $1"; }
17fail() { echo "FAIL: $1"; }
18
19mkdir -p "$PROBE_DIR/addons"
20rm -rf "$ADDON_DIR"
21cp -R "$OPENVT_DIR/thirdparty/gd_cubism/demo/addons/gd_cubism" "$ADDON_DIR"
22mkdir -p "$LIB_DIR"
23cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" "$LIB_DIR/"
24cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libLive2DCubismCore.so" "$LIB_DIR/"
25
26if [ -f "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" ]; then
27 cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.release.x86_64.so" "$LIB_DIR/"
28else
29 cp "$OPENVT_DIR/addons/gd_cubism/bin/linux/x86_64/libgd_cubism.linux.debug.x86_64.so" "$LIB_DIR/libgd_cubism.linux.release.x86_64.so"
30fi
31
32test -f "$ADDON_DIR/gd_cubism.gdextension" && pass "gdextension file present" || fail "gdextension file missing"
33test -f "$LIB_DIR/libgd_cubism.linux.debug.x86_64.so" && pass "gd_cubism binary present" || fail "gd_cubism binary missing"
34test -f "$LIB_DIR/libgd_cubism.linux.release.x86_64.so" && pass "gd_cubism release binary present" || fail "gd_cubism release binary missing"
35test -f "$LIB_DIR/libLive2DCubismCore.so" && pass "Cubism core binary present" || fail "Cubism core binary missing"
36test -f "$MODEL_PATH" && pass "Haru model present" || fail "Haru model missing"
37
38echo "--- Control case ---"
39mkdir -p "$CONTROL_DIR/bin"
40cp "$ROOT_DIR/tests/gdextension-control-src/example.gdextension" "$CONTROL_DIR/example.gdextension"
41devenv shell -- bash -lc 'c++ -shared -fPIC -std=c++17 \
42 -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/include \
43 -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/gen/include \
44 -I /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/gdextension \
45 /home/nandi/code/character/tests/gdextension-control-src/example.cpp \
46 /home/nandi/code/character/tests/gdextension-control-src/register_types.cpp \
47 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/godot.cpp \
48 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/class_db.cpp \
49 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/error_macros.cpp \
50 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/memory.cpp \
51 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/method_bind.cpp \
52 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/object.cpp \
53 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/variant/variant.cpp \
54 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/core/print_string.cpp \
55 /home/nandi/code/character/vendor/open-vt/thirdparty/gd_cubism/godot-cpp/src/variant/variant_internal.cpp \
56 -o /home/nandi/code/character/tests/gdextension-control/bin/libgdext_control.linux.template_debug.x86_64.so'
57cp "$CONTROL_DIR/bin/libgdext_control.linux.template_debug.x86_64.so" "$CONTROL_DIR/bin/libgdext_control.linux.template_release.x86_64.so"
58
59if ldd "$LIB_DIR/libgd_cubism.linux.debug.x86_64.so" | grep -q 'not found'; then
60 fail "gd_cubism binary has missing shared library deps"
61else
62 pass "gd_cubism binary shared library deps resolved"
63fi
64
65if ldd "$LIB_DIR/libLive2DCubismCore.so" | grep -q 'not found'; then
66 fail "Cubism core binary has missing shared library deps"
67else
68 pass "Cubism core shared library deps resolved"
69fi
70
71echo "--- Godot probe ---"
72echo "Using Godot binary: ${GODOT4_BIN:-godot4}"
73"${GODOT4_BIN:-godot4}" --headless --path "$PROBE_DIR" --quit-after 1 2>&1 | tee "$PROBE_DIR/probe.log"
74
75echo "--- GDExtension control probe ---"
76"${GODOT4_BIN:-godot4}" --headless --path "$CONTROL_DIR" --quit-after 1 2>&1 | tee "$CONTROL_DIR/probe.log"
77
78echo "--- Extension file sanity ---"
79grep -n . "$ADDON_DIR/gd_cubism.gdextension" | sed -n '1,120p'