ext-ms-win-rtcore-ntuser-dpi-l1-1-0: Add dll.
[wine.git] / tools / winewrapper
blob2206d7c444638331d9ee2f7256d7eb2c44dcfa8a
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/libs/wine:$DYLD_LIBRARY_PATH"
73 else
74 DYLD_LIBRARY_PATH="$topdir/libs/wine"
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"
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"
91 elif [ -x "$topdir/loader/wine64" ]
92 then WINELOADER="$topdir/loader/wine64"
93 else
94 echo "$name: could not find the Wine loader in $topdir"
95 exit 1
97 export WINELOADER
99 # any local settings ?
100 if [ -f "$topdir/.winewrapper" ]
101 then
102 . $topdir/.winewrapper
105 # and run the application
107 exec "$WINELOADER" "$@"