d3dcompiler: Parse multiplicative expressions.
[wine] / tools / winewrapper
1 #!/bin/sh
2 #
3 # Wrapper script to run Wine and Winelib apps from inside the source tree
4 #
5 # Copyright (C) 2002 Alexandre Julliard
6 #
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.
11 #
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.
16 #
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
20 #
21
22 # first determine the directory that contains the app itself
23
24 appdir=""
25 name=$0
26
27 case "$0" in
28   */*)
29     # $0 contains a path, use it
30     appdir=`dirname "$0"`
31     name=`basename "$0"`
32     ;;
33   *)
34     # no directory in $0, search in PATH
35     saved_ifs=$IFS
36     IFS=:
37     for d in $PATH
38     do
39       IFS=$saved_ifs
40       if [ -x "$d/$name" ]
41       then
42         appdir="$d"
43         break
44       fi
45     done
46     ;;
47 esac
48
49 # now find the top-level directory of the build tree
50
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
62 fi
63
64 # setup the environment
65
66 topdir=`cd "$topdir" && pwd`
67
68 if [ "`uname -s`" = "Darwin" ]
69 then
70   if [ -n "$DYLD_LIBRARY_PATH" ]
71   then
72     DYLD_LIBRARY_PATH="$topdir/libs/wine:$DYLD_LIBRARY_PATH"
73   else
74     DYLD_LIBRARY_PATH="$topdir/libs/wine"
75   fi
76   export DYLD_LIBRARY_PATH
77 else
78   if [ -n "$LD_LIBRARY_PATH" ]
79   then
80     LD_LIBRARY_PATH="$topdir/libs/wine:$LD_LIBRARY_PATH"
81   else
82     LD_LIBRARY_PATH="$topdir/libs/wine"
83   fi
84   export LD_LIBRARY_PATH
85 fi
86
87 if [ -x "$topdir/loader/$name" ]
88 then WINELOADER="$topdir/loader/$name"
89 elif [ -x "$topdir/loader/wine" ]
90 then WINELOADER="$topdir/loader/wine"
91 else
92   echo "$name: could not find the Wine loader in $topdir"
93   exit 1
94 fi
95 export WINELOADER
96
97 # any local settings ?
98 if [ -f "$topdir/.winewrapper" ]
99 then
100     . $topdir/.winewrapper
101 fi
102
103 # and run the application
104
105 exec "$WINELOADER" "$@"