Running w/ out-of-tree compilation

Paul Millar p.millar at physics.gla.ac.uk
Tue Apr 19 03:09:05 CDT 2005


Hi everyone,

Here's 2nd attempt at the patch to allow running wine from outside of the CVS tree (but still running
without installing wine).

I've tried to include feedback from Detlef and to be more cross-platform with its use of shell scripting.

Cheers,

Paul.

ChangeLog:
   Relax the assumption that the source-tree is coincident with the binary
   tree.
   Fix a missing quotation so directories with spaces are handled correctly
   Includes feedback from Detlef Riekenberg <wine.dev at web.de>



Index: tools/wineprefixcreate.in
===================================================================
RCS file: /home/wine/wine/tools/wineprefixcreate.in,v
retrieving revision 1.7
diff -u -r1.7 wineprefixcreate.in
--- tools/wineprefixcreate.in	16 Dec 2004 14:22:37 -0000	1.7
+++ tools/wineprefixcreate.in	18 Apr 2005 22:30:35 -0000
@@ -26,11 +26,12 @@
     echo "Usage: $0 [options]"
     echo ""
     echo "Options:"
-    echo "  -h, --help                 Display this message"
-    echo "      --prefix <dir>         Directory to create (default: \$WINEPREFIX or ~/.wine)"
-    echo "  -q, --quiet                Don't print status messages"
-    echo "  -u, --update               Update the prefix directory if it already exists"
-    echo "      --use-wine-tree <dir>  Run from the Wine source tree <dir>"
+    echo "  -h, --help                   Display this message"
+    echo "      --prefix <dir>           Directory to create (default: \$WINEPREFIX or ~/.wine)"
+    echo "  -q, --quiet                  Don't print status messages"
+    echo "  -u, --update                 Update the prefix directory if it already exists"
+    echo "      --use-wine-tree <dir>    Run from the Wine binary tree <dir>"
+    echo "      --use-source-tree <dir>  Take data from the Wine source tree <dir>"
     echo ""
 }
 
@@ -77,11 +78,20 @@
                 dlldir="$topdir/programs"
                 datadir="$topdir/tools"
             else
-                echo "$2 is not a valid Wine source tree"
+                echo "$2 is not a valid Wine binary tree"
                 exit 1
             fi
             shift 2
             ;;
+       --use-source-tree)
+           srcdatadir=`cd "$2/tools" && pwd`
+           if [ ! -e "$srcdatadir/wine.inf" ]
+           then
+               echo "$2 is not a valid Wine source tree"
+               exit 1
+           fi
+           shift 2
+           ;;
         *)
             echo "Unknown option $1"
             usage
@@ -90,6 +100,12 @@
   esac
 done
 
+if [ -n "$srcdatadir" -a -z "$topdir" ]
+then
+  echo "WARNING: you have specified --use-source-tree without specifying --use-wine-tree. These"
+  echo "WARNING: options are usually specified together.  Try \"$0 --help\" for more information."
+fi
+
 WINEPREFIX="${WINEPREFIX:-$HOME/.wine}"
 
 if [ -d "$WINEPREFIX" ] || mkdir "$WINEPREFIX"; then :
@@ -162,10 +178,23 @@
 link_app winebrowser  "$CROOT/windows/winebrowser.exe"
 
 # Copy the .inf script and run it
+for dir in "$datadir" "$srcdatadir"
+do
+  if [ -n "$dir" -a -e "$dir/wine.inf" ]
+  then
+    cp "$dir/wine.inf" "$CROOT/windows/inf/wine.inf"
+    break
+  fi
+done
+
+if [ ! -e "$CROOT/windows/inf/wine.inf" ]
+then
+  echo "Cannot find the wine.inf file.  This is either a bug within wine or its packaging."
+  exit 1
+fi
 
-cp "$datadir/wine.inf" "$CROOT/windows/inf/wine.inf"
 export WINEPREFIX
-${WINELOADER:-wine} rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
+"${WINELOADER:-wine}" rundll32.exe setupapi.dll,InstallHinfSection DefaultInstall 128 wine.inf
 
 # Wait for the wineserver to finish
 
Index: tools/winewrapper
===================================================================
RCS file: /home/wine/wine/tools/winewrapper,v
retrieving revision 1.10
diff -u -r1.10 winewrapper
--- tools/winewrapper	16 Jul 2004 02:45:25 -0000	1.10
+++ tools/winewrapper	18 Apr 2005 22:30:35 -0000
@@ -22,6 +22,7 @@
 # first determine the directory that contains the app itself
 
 appdir=""
+srcdir=""
 case "$0" in
   */*)
     # $0 contains a path, use it
@@ -43,25 +44,43 @@
     ;;
 esac
 
-# now find the top-level directory of the source tree
 
-if [ -x "$appdir/server/wineserver" ]
-then topdir="$appdir"
-elif [ -x "$appdir/../server/wineserver" ]
-then topdir="$appdir/.."
-elif [ -x "$appdir/../../server/wineserver" ]
-then topdir="$appdir/../.."
-elif [ -x "$appdir/../../../server/wineserver" ]
-then topdir="$appdir/../../.."
-else
-  echo "$0: could not locate Wine source tree"
-  exit 1
-fi
+# find the top-level directory of a Wine tree
+findBase()
+{
+  if [ -e "$2/$3" ]
+  then dir="."
+  elif [ -e "$2/../$3" ]
+  then dir=".."
+  elif [ -e "$2/../../$3" ]
+  then dir="../.."
+  elif [ -e "$2/../../../$3" ]
+  then dir="../../.."
+  else
+    echo "$0: could not locate the Wine tree"
+    exit 1
+  fi
+
+  # Convert to absolute dir
+  adir=`cd "$2/$dir" && pwd`
+
+  # Store in the right variable
+  eval "$1=\"$adir\""
+}
 
-# setup the environment
+# now find the top-level directory of the (binary) Wine tree
+findBase topdir "$appdir" "server/wineserver" 
+
+# if we're operating out of a different directory, search that tree for data
+if [ -h "$0" ]
+then
+  thisScript=`readlink "$0"`
+  ptr=`dirname "$thisScript"`
+  findBase srcdir "$ptr" "tools/wine.inf"
+fi
 
-topdir=`cd "$topdir" && pwd`
 
+# setup the environment
 if [ -n "$LD_LIBRARY_PATH" ]
 then
   LD_LIBRARY_PATH="$topdir/libs:$LD_LIBRARY_PATH"
@@ -88,7 +107,12 @@
 
 if [ -z "$WINEPREFIX" -a ! -d "$HOME/.wine" ]
 then
-    "$topdir/tools/wineprefixcreate" --update --use-wine-tree "$topdir"
+    if [ -n "$srcdir" ]
+    then
+        "$topdir/tools/wineprefixcreate" --update --use-wine-tree "$topdir" --use-source-tree "$srcdir"
+    else
+        "$topdir/tools/wineprefixcreate" --update --use-wine-tree "$topdir"
+    fi
 fi
 
 # and run the application
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20050419/16f46f42/attachment.pgp


More information about the wine-patches mailing list