qtcreator.sh 1.13 KB
Newer Older
1 2
#! /bin/sh

3 4 5 6
# Use this script if you add paths to LD_LIBRARY_PATH
# that contain libraries that conflict with the
# libraries that Qt Creator depends on.

7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
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
22 23 24 25
    # Try GNU readlink(1)
    nme=`readlink -nf "$me" 2>/dev/null`
    if test -n "$nme"; then
        me=$nme
26
    else
27
        # No GNU readlink(1), so let's try ls -l
28
        base=`dirname "$me"`
29
        me=`ls -l "$me" | sed 's/^.*-> //'`
30 31 32 33 34 35
        me=`makeAbsolute "$me" "$base"`
    fi
fi

bindir=`dirname "$me"`
libdir=`cd "$bindir/../lib" ; pwd`
36 37 38 39 40 41 42
# 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
LD_LIBRARY_PATH=$libdir:$libdir/qtcreator$qtlibpath${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
43 44
export LD_LIBRARY_PATH
exec "$bindir/qtcreator" ${1+"$@"}