Alexandre Julliard : transl: Get rid of the source dir parameter in parse_resfiles.php.

Alexandre Julliard julliard at winehq.org
Tue Aug 18 10:29:53 CDT 2009


Module: tools
Branch: master
Commit: d29f4dd6970b6a832fd8ce2ea79a6d63e6821a39
URL:    http://source.winehq.org/git/tools.git/?a=commit;h=d29f4dd6970b6a832fd8ce2ea79a6d63e6821a39

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Aug 18 17:16:06 2009 +0200

transl: Get rid of the source dir parameter in parse_resfiles.php.

---

 transl/Master.sh          |    2 +-
 transl/parse_resfiles.php |   52 +++++++++++++--------------------------------
 winetest/make-winetest    |    2 +-
 3 files changed, 17 insertions(+), 39 deletions(-)

diff --git a/transl/Master.sh b/transl/Master.sh
index 4c30ce1..b38d742 100755
--- a/transl/Master.sh
+++ b/transl/Master.sh
@@ -44,7 +44,7 @@ mkdir $WORKDIR/data
 mkdir $WORKDIR/data/res
 
 # Analyze all the Makefiles
-php ./parse_resfiles.php -S "$SOURCEROOT" -T "$BUILDROOT" -t "$WRCROOT" -w "$WORKDIR/data" 2>>"$WORKDIR/run.log" || exit
+php ./parse_resfiles.php -T "$BUILDROOT" -t "$WRCROOT" -w "$WORKDIR/data" 2>>"$WORKDIR/run.log" || exit
 
 # Show any changes in the log
 diff -u $WORKDIR/run.log.old $WORKDIR/run.log
diff --git a/transl/parse_resfiles.php b/transl/parse_resfiles.php
index 1911464..a6ec479 100644
--- a/transl/parse_resfiles.php
+++ b/transl/parse_resfiles.php
@@ -8,14 +8,13 @@ function resource_name2($resource)
     return "@RES($result[0]:$result[1])";
 }
 
-function create_resfiles($dir, $check)
+function create_resfiles($dir, $files)
 {
-    global $objdir, $srcdir, $toolsdir, $workdir;
+    global $objdir, $toolsdir, $workdir;
 
-    $srcs = "";
     $targets = "";
     $objs = "";
-    foreach (preg_split("/\s+/", $check['files']) as $file)
+    foreach (preg_split("/\s+/", $files) as $file)
     {
         if (preg_match("/^\s*$/", $file))
             continue;
@@ -29,11 +28,6 @@ function create_resfiles($dir, $check)
         if (preg_match("/.mc$/", $file))
         {
             $file .= ".rc";
-            $srcs .= " $objdir/$dir/$file";
-        }
-        else
-        {
-            $srcs .= " $srcdir/$dir/$file";
         }
         $targets .= preg_replace("/\.rc$/", ".res", $file). " ";
         $objs .= "$objdir/$dir/" . preg_replace("/\.rc$/", ".res", $file) . " ";
@@ -41,13 +35,8 @@ function create_resfiles($dir, $check)
     if ($targets == "")
         return;
 
-    $defs = $check['defines'];
-    if (preg_match("/^dlls/", $dir))
-        $defs .= "-D__WINESRC__";
-
-    fwrite(STDERR, "*** $dir [$defs]\n");
+    fwrite(STDERR, "*** $dir\n");
 
-    $incl = "-I$srcdir/$dir -I$objdir/$dir -I$srcdir/include -I$objdir/include";
     $norm_fn = preg_replace("/[^a-zA-Z0-9]/", "-", $dir);
 
     system("make -C $objdir/$dir -s $targets");
@@ -59,9 +48,7 @@ array_shift($argv);
 while (count($argv) != 0 && preg_match("/^-/", $argv[0]))
 {
     $opt = array_shift($argv);
-    if ($opt == "-S")
-        $srcdir = array_shift($argv);
-    else if ($opt == "-T")
+    if ($opt == "-T")
         $objdir = array_shift($argv);
     else if ($opt == "-t")
         $toolsdir = array_shift($argv);
@@ -70,7 +57,6 @@ while (count($argv) != 0 && preg_match("/^-/", $argv[0]))
     else
     {
         fwrite(STDERR, "Usage: $script [options] [makefiles]\n\n");
-        fwrite(STDERR, "  -S dir   Set the top of the Wine source tree\n");
         fwrite(STDERR, "  -T dir   Set the top of the Wine build tree\n");
         fwrite(STDERR, "  -t dir   Set the Wine tools directory\n");
         fwrite(STDERR, "  -w dir   Set the work directory\n");
@@ -78,32 +64,29 @@ while (count($argv) != 0 && preg_match("/^-/", $argv[0]))
     }
 }
 
-if ($objdir == "")
-    $objdir = $srcdir;
 if ($toolsdir == "")
     $toolsdir = $objdir;
 
-if ($srcdir == "" || $toolsdir == "" || $workdir == "")
+if ($objdir == "" || $toolsdir == "" || $workdir == "")
 {
-    die("Config entry for SOURCEROOT, WRCROOT or WORKDIR missing\n");
+    die("Config entry for BUILDROOT, WRCROOT or WORKDIR missing\n");
 }
 
 $makefiles = array();
-exec("find $srcdir/ -name Makefile.in -print", $makefiles);
+exec("find $objdir/ -name Makefile -print", $makefiles);
 
 // Parse the makefiles and create the .res files
 $checks = array();
 sort($makefiles);
 foreach ($makefiles as $makefile)
 {
-    $path = str_replace("$srcdir/", "", dirname($makefile));
-    if ($path == "programs/winetest" || $path == $srcdir || preg_match("/\/tests$/", $path))
+    $path = str_replace("$objdir/", "", dirname($makefile));
+    if ($path == "programs/winetest" || $path == $objdir || preg_match("/\/tests$/", $path))
     {
-        echo "--- Ignoring: $path/Makefile.in\n";
+        echo "--- Ignoring: $path/Makefile\n";
         continue;
     }
 
-    $defs = "";
     $files = "";
     $file = fopen("$makefile", "r") or die("Cannot open $makefile");
     while ($line = fgets($file, 4096))
@@ -114,12 +97,8 @@ foreach ($makefiles as $makefile)
             $line .= fgets($file, 4096);
         }
 
-        if (preg_match("/EXTRARCFLAGS\s*=\s*(.*)/", $line, $m))
-        {
-            $defs = $m[1];
-            if (preg_match("/res16/", $defs))
-                break;
-        }
+        if (preg_match("/EXTRARCFLAGS\s*=.*res16/", $line))
+            break;
 
         if (preg_match("/^(MC|RC)_SRCS\s*=\s*(.*)$/", $line, $m))
             $files .= " $m[2]";
@@ -129,9 +108,8 @@ foreach ($makefiles as $makefile)
     if ($files == "")
         continue;
 
-    $checks[$path]['defines'] = $defs;
-    $checks[$path]['files'] = $files;
-    create_resfiles($path, $checks[$path]);
+    $checks[$path] = 1;
+    create_resfiles($path, $files);
 }
 
 // Get all the possible languages (from kernel32) and filter
diff --git a/winetest/make-winetest b/winetest/make-winetest
index bd56fd9..6e4b24c 100755
--- a/winetest/make-winetest
+++ b/winetest/make-winetest
@@ -132,7 +132,7 @@ umask 022
 
     rm -rf data
     mkdir data data/res
-    php $toolsdir/transl/parse_resfiles.php -S ./wine -T ./build-mingw -t ./build-native -w ./data 2>>data/run.log
+    php $toolsdir/transl/parse_resfiles.php -T ./build-mingw -t ./build-native -w ./data 2>>data/run.log
     mv -f $transldir/data $transldir/data.old
     mv -f data $transldir/data
     rm -rf $transldir/data.old




More information about the wine-cvs mailing list