widl: Add support for structures.
[wine.git] / tools / winewrapper
blobd6d1bc8f70a0ab550d59b426817d6cc4b457802e
1 #!/bin/sh
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
24 appdir=""
25 name=$0
27 case "$0" in
28 */*)
29 # $0 contains a path, use it
30 appdir=`dirname "$0"`
31 name=`basename "$0"`
34 # no directory in $0, search in PATH
35 saved_ifs=$IFS
36 IFS=:
37 for d in $PATH
39 IFS=$saved_ifs
40 if [ -x "$d/$name" ]
41 then
42 appdir="$d"
43 break
45 done
47 esac
49 # now find the top-level directory of the build tree
51 if [ -x "$appdir/server/wineserver" ]
52 then topdir="$appdir"
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/../../.."
59 else
60 echo "$name: could not locate the Wine build tree"
61 exit 1
64 # setup the environment
66 topdir=`cd "$topdir" && pwd`
68 if [ "`uname -s`" = "Darwin" ]
69 then
70 if [ -n "$DYLD_LIBRARY_PATH" ]
71 then
72 DYLD_LIBRARY_PATH="$topdir/dlls/ntdll:$topdir/dlls/win32u:$DYLD_LIBRARY_PATH"
73 else
74 DYLD_LIBRARY_PATH="$topdir/dlls/ntdll:$topdir/dlls/win32u"
76 export DYLD_LIBRARY_PATH
79 if [ -x "$topdir/loader/$name" ]
80 then WINELOADER="$topdir/loader/$name"
81 elif [ -x "$topdir/loader/wine" ]
82 then WINELOADER="$topdir/loader/wine"
83 elif [ -x "$topdir/loader/wine64" ]
84 then WINELOADER="$topdir/loader/wine64"
85 else
86 echo "$name: could not find the Wine loader in $topdir"
87 exit 1
89 export WINELOADER
91 # any local settings ?
92 if [ -f "$topdir/.winewrapper" ]
93 then
94 . $topdir/.winewrapper
97 # and run the application
99 exec "$WINELOADER" "$@"