#!/bin/sh
# Crystalfontz cfUtils launcher -- GENERATED, do not edit.
#
# Serves both layouts unmodified:
#   relocatable tarball : <root>/bin/<app>        -> <root>
#   installed package   : /usr/bin/<app> -> symlink -> <prefix>/bin/<app> -> <prefix>
#
# The application binaries carry DT_RUNPATH pointing at the Qt prefix on the
# build machine, which does not exist here. ld.so searches LD_LIBRARY_PATH
# BEFORE DT_RUNPATH (see ld.so(8)), so exporting it below reliably overrides
# that stale path without needing patchelf.

self=$0
case $self in
    */*) ;;
    *)   self=$(command -v -- "$self" 2>/dev/null) || self=$0 ;;
esac
self=$(readlink -f -- "$self") || {
    echo "cfa835_video_encoder: cannot resolve own path" >&2; exit 127; }
prefix=$(cd -- "$(dirname -- "$self")/.." && pwd -P) || {
    echo "cfa835_video_encoder: cannot resolve install prefix" >&2; exit 127; }

real="$prefix/libexec/cfa835_video_encoder"
[ -x "$real" ] || {
    echo "cfa835_video_encoder: missing $real -- broken installation" >&2; exit 127; }

LD_LIBRARY_PATH="$prefix/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
QT_PLUGIN_PATH="$prefix/plugins${QT_PLUGIN_PATH:+:$QT_PLUGIN_PATH}"
export LD_LIBRARY_PATH QT_PLUGIN_PATH

exec "$real" "$@"
