forked from qt-creator/qt-creator
We used to set QT_OPENGL, currently set LD_LIBRARY_PATH when qtcreator.sh is used, and might set other variables in the future, but these environment modifications should not be passed on to user applications or when we run tools that are not shipped with Qt Creator. For LD_LIBRARY_PATH there already was a hack for Environment::systemEnvironment. For environment variables that we might set in main() in the future, this patch caches the system environment for Environment::systemEnvironment early before any modifications are made. The previous hack for LD_LIBRARY_PATH no longer works, since it used QCoreApplication::applicationDirPath() which cannot be used at that point in time (before the QApplication has been created). Instead pass the correct user LD_LIBRARY_PATH directly from qtcreator.sh to Qt Creator through a command line option, which is cleaner anyhow. Task-number: QTCREATORBUG-20808 Change-Id: I6674a5e0537e1b37fd7dcbff371b542fa24bce69 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
46 lines
1.2 KiB
Bash
Executable File
46 lines
1.2 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
# Use this script if you add paths to LD_LIBRARY_PATH
|
|
# that contain libraries that conflict with the
|
|
# libraries that Qt Creator depends on.
|
|
|
|
makeAbsolute() {
|
|
case $1 in
|
|
/*)
|
|
# already absolute, return it
|
|
echo "$1"
|
|
;;
|
|
*)
|
|
# relative, prepend $2 made absolute
|
|
echo `makeAbsolute "$2" "$PWD"`/"$1" | sed 's,/\.$,,'
|
|
;;
|
|
esac
|
|
}
|
|
|
|
me=`which "$0"` # Search $PATH if necessary
|
|
if test -L "$me"; then
|
|
# Try GNU readlink(1)
|
|
nme=`readlink -nf "$me" 2>/dev/null`
|
|
if test -n "$nme"; then
|
|
me=$nme
|
|
else
|
|
# No GNU readlink(1), so let's try ls -l
|
|
base=`dirname "$me"`
|
|
me=`ls -l "$me" | sed 's/^.*-> //'`
|
|
me=`makeAbsolute "$me" "$base"`
|
|
fi
|
|
fi
|
|
|
|
bindir=`dirname "$me"`
|
|
libdir=`cd "$bindir/../lib" ; pwd`
|
|
# Add path to deployed Qt libraries in package
|
|
qtlibdir=$libdir/Qt/lib
|
|
if test -d "$qtlibdir"; then
|
|
qtlibpath=:$qtlibdir
|
|
fi
|
|
# Add Qt Creator library path
|
|
_ORIGINAL_LD_LIBRARY_PATH=$LD_LIBRARY_PATH
|
|
LD_LIBRARY_PATH=$libdir:$libdir/qtcreator$qtlibpath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
|
|
export LD_LIBRARY_PATH
|
|
exec "$bindir/qtcreator" -user-library-path "$_ORIGINAL_LD_LIBRARY_PATH" ${1+"$@"}
|