Skip to content

Commit 785a177

Browse files
author
Beat Reichenbach
committed
feat: replace tcsh wrapper with sh
1 parent 5e9f57a commit 785a177

File tree

1 file changed

+47
-80
lines changed

1 file changed

+47
-80
lines changed

src/bin/apps/rv/rv.wrapper

Lines changed: 47 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,97 +1,64 @@
1-
#!/bin/tcsh -f
1+
#!/bin/sh
22

3-
#
4-
# Copyright (C) 2022 Autodesk, Inc. All Rights Reserved.
5-
#
6-
# SPDX-License-Identifier: Apache-2.0
7-
#
8-
9-
#
10-
# This script sets the RV_HOME environment (if not already set),
11-
# makes sure the plugins are the path and launches the actual binary.
12-
#
13-
# NOTE: doesn't properly set RV_HOME if invoked from a link to the script
14-
# and RV_HOME is not already set
15-
#
16-
17-
set noglob
18-
19-
#
20-
# Uncomment this if you want to use the pulseaudio/libsndfile package mismatch
21-
# workaround below.
22-
#
23-
#setenv RV_USE_PULSEAUDIO_WORKAROUND 1
3+
# Uncomment this if you want to use the pulseaudio/libsndfile package mismatch
4+
# workaround below.
5+
# export RV_USE_PULSEAUDIO_WORKAROUND=1
246

25-
#
26-
# Workaround for pulseaudio/libsndfile package mismatch on FC/Cent that causes
27-
# crash when accessing preferences.
28-
#
29-
if ((-e /usr/bin/padsp) && $?RV_USE_PULSEAUDIO_WORKAROUND) then
30-
setenv OPTIONAL_PADSP /usr/bin/padsp
31-
else
32-
setenv OPTIONAL_PADSP ""
33-
endif
7+
# Workaround for pulseaudio/libsndfile package mismatch on FC/Cent that causes
8+
# crash when accessing preferences.
9+
if [ -e /usr/bin/padsp ] && [ -n "$RV_USE_PULSEAUDIO_WORKAROUND" ]; then
10+
export OPTIONAL_PADSP="/usr/bin/padsp"
11+
else
12+
export OPTIONAL_PADSP=""
13+
fi
3414

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

40-
#
41-
# Uncomment this if you're on an older linux distro and RV is hanging in
42-
# the Audio preferences or on startup with audio sources
43-
#
44-
#setenv PA_ALSA_EXCLUDE_DMIX_DEFAULT 1
20+
# Uncomment this if you're on an older linux distro and RV is hanging in
21+
# the Audio preferences or on startup with audio sources
22+
# export PA_ALSA_EXCLUDE_DMIX_DEFAULT=1
4523

46-
#
47-
# For unknown reasons, LANG causes problems when set to
48-
# interesting values (like fr_FR.UTF-8).
49-
#
50-
unsetenv LANG
51-
52-
if (! $?RV_HOME) then
53-
set canonicalName = "`readlink -f $0`"
54-
set binName = "$canonicalName:h"
55-
setenv RV_HOME "$binName:h"
56-
endif
24+
# For unknown reasons, LANG causes problems when set to
25+
# interesting values (like fr_FR.UTF-8).
26+
unset LANG
5727

58-
set platform = i386
59-
set rvbin = "$RV_HOME/bin/rv.bin.$platform"
28+
if [ -z "$RV_HOME" ]; then
29+
current_dir=$(dirname "$(readlink -f "$0")" )
30+
root_dir=$(dirname "$current_dir" )
31+
export RV_HOME="$root_dir"
32+
fi
6033

61-
if (! (-e $rvbin) ) then
62-
set rvbin = "$RV_HOME/bin/rv.bin"
63-
endif
34+
rvbin="$RV_HOME/bin/rv.bin.i386"
35+
if [ ! -e "$rvbin" ]; then
36+
rvbin="$RV_HOME/bin/rv.bin"
37+
fi
6438

65-
unsetenv BUILD_ROOT
66-
setenv PATH "$RV_HOME/bin:${PATH}"
39+
unset BUILD_ROOT
40+
export PATH="$RV_HOME/bin:$PATH"
6741

68-
if ($?LD_LIBRARY_PATH) then
69-
setenv LD_LIBRARY_PATH "$RV_HOME/lib:$LD_LIBRARY_PATH"
42+
if [ -n "$LD_LIBRARY_PATH" ]; then
43+
export LD_LIBRARY_PATH="$RV_HOME/lib:$LD_LIBRARY_PATH"
7044
else
71-
setenv LD_LIBRARY_PATH "$RV_HOME/lib"
72-
endif
45+
export LD_LIBRARY_PATH="$RV_HOME/lib"
46+
fi
7347

7448
# Unless the RV_USE_SYSTEM_OPENSSL environment variable is set, use the
7549
# OpenSSL provided with RV when the required OpenSSL version cannot be found.
76-
#
77-
if (! $?RV_USE_SYSTEM_OPENSSL) then
78-
set required_openssl_found = "`openssl version | grep 1.1.1`"
79-
if ( "$required_openssl_found" == "" ) then
80-
setenv LD_LIBRARY_PATH "$RV_HOME/lib/OpenSSL:$LD_LIBRARY_PATH"
81-
endif
82-
endif
50+
#
51+
if [ -z "$RV_USE_SYSTEM_OPENSSL" ]; then
52+
required_openssl_found=$( openssl version | grep 1.1.1 )
53+
if [ -z "$required_openssl_found" ]; then
54+
export LD_LIBRARY_PATH="$RV_HOME/lib/OpenSSL:$LD_LIBRARY_PATH"
55+
fi
56+
fi
8357

8458
# exec RV
85-
86-
87-
if ("x$1" == "x") then
88-
# No parameter supplied, just execute app
89-
exec $OPTIONAL_PADSP $rvbin $*:q
59+
if [ "$1" = "-d" ] || [ "$1" = "--debug" ]; then
60+
shift # skip '-d / --debug'
61+
gdb "${OPTIONAL_PADSP}${rvbin}" "$@"
9062
else
91-
if ( "$1" == "-d" || "$1" == "--debug") then
92-
shift # skip '-d / --debug'
93-
gdb $OPTIONAL_PADSP $rvbin $*:q
94-
else
95-
exec $OPTIONAL_PADSP $rvbin $*:q
96-
endif
97-
endif
63+
exec "${OPTIONAL_PADSP}${rvbin}" "$@"
64+
fi

0 commit comments

Comments
 (0)