Patch: winemaker-options

Martin Wilck Martin.Wilck at Fujitsu-Siemens.com
Fri Sep 6 11:54:48 CDT 2002


This patch fixes winemaker's annoying habit to insist 
on --mfc even if --nomfc was specified, and adds an option 
to not add any DLLs automatically.

Patch: winemaker-options.diff

Martin Wilck <Martin.Wilck at fujitsu-siemens.com>

Modified files:

tools:        winemaker
        - fix --nomfc option which is currrently broken
        - add --nodlls option for small apps

This patch is incremental over Francois Gouget's latest winemaker patch:
http://www.winehq.com/hypermail/wine-patches/2002/09/0028.html
and my previous patch (winemaker-bugs.diff)

--- CVS/wine/tools/winemaker	Fri Sep  6 17:35:39 2002
+++ TMP/wine/tools/winemaker	Fri Sep  6 17:36:46 2002
@@ -234,6 +234,14 @@
 my $TF_MFC=4;
 
 ##
+# User has specified --nomfc option for this target or globally
+my $TF_NOMFC=8;
+
+##
+# --nodlls option: Do not use standard DLL set
+my $TF_NODLLS=16;
+
+##
 # Initialize a target:
 # - set the target type to TT_SETTINGS, i.e. no real target will
 #   be generated.
@@ -436,23 +444,37 @@
       push @{@$target[$T_LIBRARY_PATH]},$option;
     } elsif ($option =~ /^-l/) {
       push @{@$target[$T_LIBRARIES]},"$'";
-    } elsif (@$target[$T_TYPE] != $TT_DLL and $option =~ /^--wrap/) {
-      @$target[$T_FLAGS]|=$TF_WRAP;
-    } elsif (@$target[$T_TYPE] != $TT_DLL and $option =~ /^--nowrap/) {
-      @$target[$T_FLAGS]&=~$TF_WRAP;
-    } elsif ($option =~ /^--mfc/) {
-      @$target[$T_FLAGS]|=$TF_MFC;
+    } elsif ($option =~ /^--wrap/) {
       if (@$target[$T_TYPE] != $TT_DLL) {
         @$target[$T_FLAGS]|=$TF_WRAP;
+      } else {
+        print STDERR "warning: option --wrap is illegal for DLLs - ignoring";
+      };
+    } elsif ($option =~ /^--nowrap/) {
+      if (@$target[$T_TYPE] != $TT_DLL) {
+        @$target[$T_FLAGS]&=~$TF_WRAP;
+      } else {
+        print STDERR "warning: option --nowrap is illegal for DLLs - ignoring";
       }
+    } elsif ($option =~ /^--mfc/) {
+      @$target[$T_FLAGS]|=$TF_MFC;
+      @$target[$T_FLAGS]&=~$TF_NOMFC;
     } elsif ($option =~ /^--nomfc/) {
       @$target[$T_FLAGS]&=~$TF_MFC;
-      @$target[$T_FLAGS]&=~($TF_MFC|$TF_WRAP);
+      @$target[$T_FLAGS]|=$TF_NOMFC;
+    } elsif ($option =~ /^--nodlls/) {
+      @$target[$T_FLAGS]|=$TF_NODLLS;
     } else {
       print STDERR "error: unknown option \"$option\"\n";
       return 0;
     }
   }
+  if (@$target[$T_TYPE] != $TT_DLL &&
+      @$target[$T_FLAGS] & $TF_MFC &&
+      !(@$target[$T_FLAGS] & $TF_WRAP)) {
+    print STDERR "info: option --mfc requires --wrap";
+    @$target[$T_FLAGS]|=$TF_WRAP;
+  }
   return 1;
 }
 
@@ -543,7 +565,7 @@
       } elsif ($dentry =~ /\.c$/i and $dentry !~ /\.spec\.c$/) {
 	push @sources_c,"$dentry";
       } elsif ($dentry =~ /\.(cpp|cxx)$/i) {
-	if ($dentry =~ /^stdafx.cpp$/i) {
+	if ($dentry =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
 	  push @sources_misc,"$dentry";
 	  @$project_settings[$T_FLAGS]|=$TF_MFC;
 	} else {
@@ -553,7 +575,7 @@
 	push @sources_rc,"$dentry";
       } elsif ($dentry =~ /\.(h|hxx|hpp|inl|rc2|dlg)$/i) {
 	push @sources_misc,"$dentry";
-	if ($dentry =~ /^stdafx.h$/i) {
+	if ($dentry =~ /^stdafx.h$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
 	  @$project_settings[$T_FLAGS]|=$TF_MFC;
 	}
       } elsif ($dentry =~ /\.dsp$/i) {
@@ -779,7 +801,11 @@
     # which we don't have in Wine. Also I add ntdll which seems
     # necessary for Winelib.
     my @std_dlls=qw(advapi32.dll comdlg32.dll gdi32.dll kernel32.dll ntdll.dll odbc32.dll ole32.dll oleaut32.dll shell32.dll user32.dll winspool.drv);
-    @$target[$T_DLLS]=\@std_dlls;
+    if (@$target[$T_FLAGS] & $TF_NODLLS == 0) {
+      @$target[$T_DLLS]=\@std_dlls;
+    } else {
+      @$target[$T_DLLS]=[];
+    }
     push @{@$project[$P_TARGETS]},$target;
 
     # Ask for target-specific options
@@ -2169,7 +2195,7 @@
   print STDERR "Usage: winemaker [--nobanner] [--backup|--nobackup] [--nosource-fix]\n";
   print STDERR "                 [--lower-none|--lower-all|--lower-uppercase]\n";
   print STDERR "                 [--lower-include|--nolower-include]\n";
-  print STDERR "                 [--guiexe|--windows|--cuiexe|--console|--dll]\n";
+  print STDERR "                 [--guiexe|--windows|--cuiexe|--console|--dll|--nodlls]\n";
   print STDERR "                 [--wrap|--nowrap] [--mfc|--nomfc]\n";
   print STDERR "                 [-Dmacro[=defn]] [-Idir] [-Pdir] [-idll] [-Ldir] [-llibrary]\n";
   print STDERR "                 [--interactive] [--single-target name]\n";
@@ -2182,9 +2208,6 @@
   exit (2);
 }
 
-
-project_init(\@main_project,"");
-
 while (@ARGV>0) {
   my $arg=shift @ARGV;
   # General options
@@ -2245,11 +2268,13 @@
     $opt_flags&=~$TF_WRAP;
   } elsif ($arg eq "--mfc") {
     $opt_flags|=$TF_MFC;
-    $opt_flags|=$TF_MFC|$TF_WRAP;
     $needs_mfc=1;
   } elsif ($arg eq "--nomfc") {
-    $opt_flags&=~($TF_MFC|$TF_WRAP);
+    $opt_flags&=~$TF_MFC;
+    $opt_flags|=$TF_NOMFC;
     $needs_mfc=0;
+  } elsif ($arg eq "--nodlls") {
+    $opt_flags|=$TF_NODLLS;
 
   # Catch errors
   } else {
@@ -2264,6 +2289,11 @@
       usage();
     }
   }
+
+  if ($opt_flags & $TF_MFC && $opt_target_type != $TT_DLL) {
+    print STDERR "info: option --mfc requires --wrap\n";
+    $opt_flags |= $TF_WRAP;
+  };
 }
 
 if (!defined $opt_work_dir) {
@@ -2279,6 +2309,8 @@
   print_banner();
 }
 
+project_init(\@main_project,"");
+
 # Fix the file and directory names
 fix_file_and_directory_names(".");
 
-- 
Martin Wilck                Phone: +49 5251 8 15113
Fujitsu Siemens Computers   Fax:   +49 5251 8 20409
Heinz-Nixdorf-Ring 1	    mailto:Martin.Wilck at Fujitsu-Siemens.com
D-33106 Paderborn           http://www.fujitsu-siemens.com/primergy








More information about the wine-patches mailing list