Files
LocalAI/backend/go/gemxcpp/package.sh
T
Richard Palethorpe 3de91d48d9 feat(motion): add GEM-X backend and duplex streaming API
Add the GEM-X native backend with live pose and root displacement output, bounded duplex WebSocket streaming, session authorization, metrics and usage accounting. Share the embedded bidirectional RPC channel adapter across streaming backends.

Include backend build and gallery integration, API documentation, schemas and tests.

Assisted-by: Codex:gpt-6
Signed-off-by: Richard Palethorpe <io@richiejp.com>
(cherry picked from commit 016dc3d71a)
2026-10-13 08:27:24 +00:00

40 lines
2.0 KiB
Bash
Executable File

#!/bin/bash
set -euo pipefail
BACKEND_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
# The package is generated; never mix libraries from different build variants.
rm -rf -- "$BACKEND_DIR/package"
mkdir -p "$BACKEND_DIR/package/lib"
cp "$BACKEND_DIR/gemxcpp" "$BACKEND_DIR/run.sh" "$BACKEND_DIR/package/"
chmod +x "$BACKEND_DIR/package/run.sh"
find "$BACKEND_DIR/${BUILD_DIR:-build-cpu}" \( -name 'libgemx.so*' -o -name 'libgemx.dylib' -o -name 'libggml*.so*' -o -name 'libggml*.dylib' \) -exec cp -a {} "$BACKEND_DIR/package/lib/" \;
cp "$BACKEND_DIR/sources/gem-x.cpp/LICENSE" "$BACKEND_DIR/package/LICENSE.gemx"
cp "$BACKEND_DIR/sources/gem-x.cpp/NOTICE" "$BACKEND_DIR/package/NOTICE.gemx"
cp -R "$BACKEND_DIR/sources/gem-x.cpp/LICENSES" "$BACKEND_DIR/package/LICENSES.gemx"
cp "$BACKEND_DIR/sources/gem-x.cpp/ggml/LICENSE" "$BACKEND_DIR/package/LICENSE.ggml"
if [ "$(uname -s)" != Darwin ]; then
# purego's executable also imports libdl/libpthread, even with CGO disabled.
for library in "$BACKEND_DIR/package/gemxcpp" "$BACKEND_DIR"/package/lib/*.so*; do
while read -r dependency; do
[ -f "$dependency" ] && cp -L "$dependency" "$BACKEND_DIR/package/lib/"
done < <(ldd "$library" | awk '/=> \// {print $3}')
done
loader=$(ldd "$BACKEND_DIR/package/lib/libgemx.so" | awk '/ld-linux/ {print $1; exit}')
if [ -f "$loader" ]; then cp -L "$loader" "$BACKEND_DIR/package/lib/ld.so"; fi
source "$BACKEND_DIR/../../../scripts/build/package-gpu-libs.sh" "$BACKEND_DIR/package/lib"
package_gpu_libs
if [ "${BUILD_TYPE:-}" = vulkan ]; then
# NVIDIA's host ICD dlopens EGL; it is not visible in libgemx's ldd tree.
for soname in libEGL.so.1 libGLdispatch.so.0 libX11.so.6 libXext.so.6; do
dependency=$(ldconfig -p | awk -v name="$soname" '$1 == name {print $NF; exit}')
if [ ! -f "$dependency" ]; then
echo "Missing Vulkan ICD runtime dependency: $soname" >&2
exit 1
fi
copy_lib "$dependency"
done
sweep_transitive_deps
fi
fi