Skip to content

Commit

Permalink
feat: replace tcsh wrapper with sh
Browse files Browse the repository at this point in the history
  • Loading branch information
Beat Reichenbach authored and Beat Reichenbach committed Apr 1, 2024
1 parent 79b54fd commit 01cba4f
Showing 1 changed file with 47 additions and 80 deletions.
127 changes: 47 additions & 80 deletions src/bin/apps/rv/rv.wrapper
Original file line number Diff line number Diff line change
@@ -1,97 +1,64 @@
#!/bin/tcsh -f
#!/bin/sh

#
# Copyright (C) 2022 Autodesk, Inc. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

#
# This script sets the RV_HOME environment (if not already set),
# makes sure the plugins are the path and launches the actual binary.
#
# NOTE: doesn't properly set RV_HOME if invoked from a link to the script
# and RV_HOME is not already set
#

set noglob

#
# Uncomment this if you want to use the pulseaudio/libsndfile package mismatch
# workaround below.
#
#setenv RV_USE_PULSEAUDIO_WORKAROUND 1
# Uncomment this if you want to use the pulseaudio/libsndfile package mismatch
# workaround below.
# export RV_USE_PULSEAUDIO_WORKAROUND=1

#
# Workaround for pulseaudio/libsndfile package mismatch on FC/Cent that causes
# crash when accessing preferences.
#
if ((-e /usr/bin/padsp) && $?RV_USE_PULSEAUDIO_WORKAROUND) then
setenv OPTIONAL_PADSP /usr/bin/padsp
else
setenv OPTIONAL_PADSP ""
endif
# Workaround for pulseaudio/libsndfile package mismatch on FC/Cent that causes
# crash when accessing preferences.
if [ -e /usr/bin/padsp ] && [ -n "$RV_USE_PULSEAUDIO_WORKAROUND" ]; then
export OPTIONAL_PADSP="/usr/bin/padsp"
else
export OPTIONAL_PADSP=""
fi

if ($?QT_PLUGIN_PATH) then
if [ -n "$QT_PLUGIN_PATH" ]; then
echo "INFO: warning: QT_PLUGIN_PATH is set, which can cause RV to load the wrong Qt libraries/plugins. Unsetting..."
unsetenv QT_PLUGIN_PATH
endif
unset QT_PLUGIN_PATH
fi

#
# Uncomment this if you're on an older linux distro and RV is hanging in
# the Audio preferences or on startup with audio sources
#
#setenv PA_ALSA_EXCLUDE_DMIX_DEFAULT 1
# Uncomment this if you're on an older linux distro and RV is hanging in
# the Audio preferences or on startup with audio sources
# export PA_ALSA_EXCLUDE_DMIX_DEFAULT=1

#
# For unknown reasons, LANG causes problems when set to
# interesting values (like fr_FR.UTF-8).
#
unsetenv LANG
if (! $?RV_HOME) then
set canonicalName = "`readlink -f $0`"
set binName = "$canonicalName:h"
setenv RV_HOME "$binName:h"
endif
# For unknown reasons, LANG causes problems when set to
# interesting values (like fr_FR.UTF-8).
unset LANG

set platform = i386
set rvbin = "$RV_HOME/bin/rv.bin.$platform"
if [ -z "$RV_HOME" ]; then
current_dir=$(dirname "$(readlink -f "$0")" )
root_dir=$(dirname "$current_dir" )
export RV_HOME="$root_dir"
fi

if (! (-e $rvbin) ) then
set rvbin = "$RV_HOME/bin/rv.bin"
endif
rvbin="$RV_HOME/bin/rv.bin.i386"
if [ ! -e "$rvbin" ]; then
rvbin="$RV_HOME/bin/rv.bin"
fi

unsetenv BUILD_ROOT
setenv PATH "$RV_HOME/bin:${PATH}"
unset BUILD_ROOT
export PATH="$RV_HOME/bin:$PATH"

if ($?LD_LIBRARY_PATH) then
setenv LD_LIBRARY_PATH "$RV_HOME/lib:$LD_LIBRARY_PATH"
if [ -n "$LD_LIBRARY_PATH" ]; then
export LD_LIBRARY_PATH="$RV_HOME/lib:$LD_LIBRARY_PATH"
else
setenv LD_LIBRARY_PATH "$RV_HOME/lib"
endif
export LD_LIBRARY_PATH="$RV_HOME/lib"
fi

# Unless the RV_USE_SYSTEM_OPENSSL environment variable is set, use the
# OpenSSL provided with RV when the required OpenSSL version cannot be found.
#
if (! $?RV_USE_SYSTEM_OPENSSL) then
set required_openssl_found = "`openssl version | grep 1.1.1`"
if ( "$required_openssl_found" == "" ) then
setenv LD_LIBRARY_PATH "$RV_HOME/lib/OpenSSL:$LD_LIBRARY_PATH"
endif
endif
#
if [ -z "$RV_USE_SYSTEM_OPENSSL" ]; then
required_openssl_found=$( openssl version | grep 1.1.1 )
if [ -z "$required_openssl_found" ]; then
export LD_LIBRARY_PATH="$RV_HOME/lib/OpenSSL:$LD_LIBRARY_PATH"
fi
fi

# exec RV
if ("x$1" == "x") then
# No parameter supplied, just execute app
exec $OPTIONAL_PADSP $rvbin $*:q
if [ "$1" = "-d" ] || [ "$1" = "--debug" ]; then
shift # skip '-d / --debug'
gdb "${OPTIONAL_PADSP}${rvbin}" "$@"
else
if ( "$1" == "-d" || "$1" == "--debug") then
shift # skip '-d / --debug'
gdb $OPTIONAL_PADSP $rvbin $*:q
else
exec $OPTIONAL_PADSP $rvbin $*:q
endif
endif
exec "${OPTIONAL_PADSP}${rvbin}" "$@"
fi

0 comments on commit 01cba4f

Please sign in to comment.