3 # Wrapper script to run Wine and Winelib apps from inside the source tree
5 # Copyright (C) 2002 Alexandre Julliard
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 # first determine the directory that contains the app itself
29 # $0 contains a path, use it
34 # no directory in $0, search in PATH
49 # now find the top-level directory of the build tree
51 if [ -x "$appdir/server/wineserver" ]
53 elif [ -x "$appdir/../server/wineserver" ]
54 then topdir
="$appdir/.."
55 elif [ -x "$appdir/../../server/wineserver" ]
56 then topdir
="$appdir/../.."
57 elif [ -x "$appdir/../../../server/wineserver" ]
58 then topdir
="$appdir/../../.."
60 echo "$name: could not locate the Wine build tree"
64 # setup the environment
66 topdir
=`cd "$topdir" && pwd`
68 if [ "`uname -s`" = "Darwin" ]
70 if [ -n "$DYLD_LIBRARY_PATH" ]
72 DYLD_LIBRARY_PATH
="$topdir/libs/wine:$DYLD_LIBRARY_PATH"
74 DYLD_LIBRARY_PATH
="$topdir/libs/wine"
76 export DYLD_LIBRARY_PATH
78 if [ -n "$LD_LIBRARY_PATH" ]
80 LD_LIBRARY_PATH
="$topdir/libs/wine:$LD_LIBRARY_PATH"
82 LD_LIBRARY_PATH
="$topdir/libs/wine"
84 export LD_LIBRARY_PATH
87 if [ -x "$topdir/loader/$name" ]
88 then WINELOADER
="$topdir/loader/$name"
89 elif [ -x "$topdir/loader/wine" ]
90 then WINELOADER
="$topdir/loader/wine"
92 echo "$name: could not find the Wine loader in $topdir"
97 # any local settings ?
98 if [ -f "$topdir/.winewrapper" ]
100 .
$topdir/.winewrapper
103 # and run the application
105 exec "$WINELOADER" "$@"