winemaker: include the new functions

André Hentschel nerv at dawncrow.de
Tue Mar 3 13:28:41 CST 2009


---
 tools/winemaker |   37 +++++++++++++++++++++++++------------
 1 files changed, 25 insertions(+), 12 deletions(-)

diff --git a/tools/winemaker b/tools/winemaker
index c47f928..8a1d1ad 100755
--- a/tools/winemaker
+++ b/tools/winemaker
@@ -3,6 +3,7 @@ use strict;
 
 # Copyright 2000-2004 Francois Gouget for CodeWeavers
 # Copyright 2004 Dimitrie O. Paun
+# Copyright 2009 André Hentschel
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -19,7 +20,7 @@ use strict;
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 #
 
-my $version="0.6.0";
+my $version="0.7.0";
 
 use Cwd;
 use File::Basename;
@@ -1664,11 +1665,18 @@ sub source_scan()
   # The main directory is always going to be there
   push @projects,\@main_project;
 
-  # Now scan the directory tree looking for source files and, maybe, targets
-  print "Scanning the source directories...\n";
-  source_scan_directory(\@main_project,"","",0);
-
-  @projects=sort { @$a[$P_PATH] cmp @$b[$P_PATH] } @projects;
+    if (defined $opt_work_dir) {
+        # Now scan the directory tree looking for source files and, maybe, targets
+        print "Scanning the source directories...\n";
+        source_scan_directory(\@main_project,"","",0);
+        @projects=sort { @$a[$P_PATH] cmp @$b[$P_PATH] } @projects;
+    } elsif (defined $opt_work_file) {
+        if ($opt_work_file =~ /.dsp$/i or $opt_work_file =~ /.vcproj$/i) {
+            source_scan_project_file(\@main_project,0,$opt_work_file);
+        } elsif ($opt_work_file =~ /.dsw$/i or $opt_work_file =~ /.sln$/i) {
+            source_scan_workspace_file($opt_work_file);
+        }
+    }
 }
 
 #####
@@ -2520,7 +2528,7 @@ sub usage()
   print STDERR "                 [-Dmacro[=defn]] [-Idir] [-Pdir] [-idll] [-Ldir] [-llibrary]\n";
   print STDERR "                 [--nodlls] [--nomsvcrt] [--interactive] [--single-target name]\n";
   print STDERR "                 [--generated-files|--nogenerated-files]\n";
-  print STDERR "                 work_directory\n";
+  print STDERR "                 work_directory|project_file|workspace_file\n";
   print STDERR "\nWinemaker is designed to recursively convert all the Windows sources found in\n";
   print STDERR "the specified directory so that they can be compiled with Winelib. During this\n";
   print STDERR "process it will modify and rename some of the files in that directory.\n";
@@ -2594,8 +2602,13 @@ while (@ARGV>0) {
   # Catch errors
   } else {
     if ($arg ne "--help" and $arg ne "-h" and $arg ne "-?") {
-      if (!defined $opt_work_dir) {
-        $opt_work_dir=$arg;
+      if (!defined $opt_work_dir and !defined $opt_work_file) {
+    if (-f $arg) {
+      $opt_work_file=$arg;
+    }
+    else {
+      $opt_work_dir=$arg;
+    }
       } else {
         print STDERR "error: the work directory, \"$arg\", has already been specified (was \"$opt_work_dir\")\n";
         usage();
@@ -2606,10 +2619,10 @@ while (@ARGV>0) {
   }
 }
 
-if (!defined $opt_work_dir) {
-  print STDERR "error: you must specify the directory containing the sources to be converted\n";
+if (!defined $opt_work_dir and !defined $opt_work_file) {
+  print STDERR "error: you must specify the directory or project file containing the sources to be converted\n";
   usage();
-} elsif (!chdir $opt_work_dir) {
+} elsif (defined $opt_work_dir and !chdir $opt_work_dir) {
   print STDERR "error: could not chdir to the work directory\n";
   print STDERR "       $!\n";
   usage();
-- 
1.6.0.4


--------------070906060204010305000705--



More information about the wine-patches mailing list