winemaker: Naming and the build system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since Winemaker was created tons of stuff has changed in the Winelib 
naming conventions and how one builds things:
  * executables used to be named 'foo.so' and now they are called 
'foo.exe.so'
  * libraries used to be named 'libfoo.so' and now they are called 
'foo.dll.so'
  * you once had to store the executable type, references to the 
resource file and lots of other information in spec files. Now spec 
files are much less needed. In fact for executables they don't seem 
necessary at all.

This patch should bring winemaker more or less up to speed. It also 
changes the target naming convention (and makes it more consistent). 
Target names must now include the '.exe' or '.dll' extension (apparently 
we previously had foo for executables and foo.dll.so for libraries).


Changelog:

    Francois Gouget <fgouget@codeweavers.com>

  * tools/winemaker
    Include the '.exe'/'.dll' extension in the target nane (T_NAME field)
    Update winemaker to match the latest Winelib naming convention: 
'foo.exe.so' for executables and 'foo.dll.so' for dlls.
    No longer link with same-directory dlls by default (i.e. just import 
them). You now have to come up with valid spec files.
    Executables don't need a spec file -> don't generate one.
    Update the wrapper to match the new naming convention

-- 
Francois Gouget
fgouget@codeweavers.com

Index: tools/winemaker
===================================================================
RCS file: /home/wine/wine/tools/winemaker,v
retrieving revision 1.44
diff -u -r1.44 winemaker
--- tools/winemaker	6 Sep 2002 18:36:19 -0000	1.44
+++ tools/winemaker	9 Sep 2002 07:40:53 -0000
@@ -519,11 +519,7 @@
 	# resulting executable/library. They should not contain anything else.
 	my @candidates=grep /\.(exe|dll)$/i, @{get_directory_contents("$fullentry")};
 	foreach my $candidate (@candidates) {
-	  if ($candidate =~ s/\.exe$//i) {
-	    $targets{$candidate}=1;
-	  } elsif ($candidate =~ s/^(.*)\.dll$/lib$1.so/i) {
-	    $targets{$candidate}=1;
-	  }
+	  $targets{$candidate}=1;
 	}
       } elsif ($dentry =~ /^include/i) {
         # This directory must contain headers we're going to need
@@ -536,9 +532,7 @@
 	source_scan_directory($project,"$fullentry/","$dentry/",$no_target);
       }
     } elsif (-f "$fullentry") {
-      if ($dentry =~ s/\.exe$//i) {
-	$targets{$dentry}=1;
-      } elsif ($dentry =~ s/^(.*)\.dll$/lib$1.so/i) {
+      if ($dentry =~ /\.(exe|dll)$/i) {
 	$targets{$dentry}=1;
       } elsif ($dentry =~ /\.c$/i and $dentry !~ /\.spec\.c$/) {
 	push @sources_c,"$dentry";
@@ -624,7 +618,7 @@
       foreach my $filename (@$prj_list) {
 	$filename =~ s/\.(dsp|mak)$//i;
 	if ($opt_target_type == $TT_DLL) {
-	  $filename = "lib$filename.so";
+	  $filename = "$filename.dll";
 	}
 	$targets{$filename}=1;
       }
@@ -653,7 +647,7 @@
 	}
 	$name =~ s+(/|\.[^.]*)$++;
 	if ($opt_target_type == $TT_DLL) {
-	  $name = "lib$name.so";
+	  $name = "$name.dll";
 	}
 	$targets{$name}=1;
       }
@@ -684,9 +678,6 @@
 	foreach my $target (split /,/,$target_list) {
 	  $target =~ s+^\s*++;
 	  $target =~ s+\s*$++;
-	  # Also accept .exe and .dll as a courtesy
-	  $target =~ s+(.*)\.dll$+lib$1.so+;
-	  $target =~ s+\.exe$++;
 	  $targets{$target}=1;
 	}
       }
@@ -757,22 +748,21 @@
   my @exe_list=();
   foreach my $target_name (sort { $b cmp $a } keys %targets) {
     # Create the target...
-    my $basename;
     my $target=[];
     target_init($target);
     @$target[$T_NAME]=$target_name;
     @$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
-    if ($target_name =~ /^lib(.*)\.so$/) {
+    if ($target_name =~ /\.dll$/) {
       @$target[$T_TYPE]=$TT_DLL;
       @$target[$T_INIT]=get_default_init($TT_DLL);
       @$target[$T_FLAGS]&=~$TF_WRAP;
-      $basename=$1;
-      push @local_depends,$target_name;
-      push @local_dlls,$basename;
+      push @local_depends,"$target_name.so";
+      push @local_dlls,$target_name;
     } else {
       @$target[$T_TYPE]=$opt_target_type;
       @$target[$T_INIT]=get_default_init($opt_target_type);
-      $basename=$target_name;
       push @exe_list,$target;
     }
+    my $basename=$target_name;
+    $basename=~ s/\.(dll|exe)$//i;
     # This is the default link list of Visual Studio, except odbccp32
@@ -913,11 +902,7 @@
   if (@local_dlls > 0 and @exe_list > 0) {
     foreach my $target (@exe_list) {
       push @{@$target[$T_DLL_PATH]},"-L.";
-      push @{@$target[$T_DLLS]},map { "$_.dll" } @local_dlls;
-      # Also link in the Unix sense since none of the functions
-      # will be exported.
-      push @{@$target[$T_LIBRARY_PATH]},"-L.";
-      push @{@$target[$T_LIBRARIES]},@local_dlls;
+      push @{@$target[$T_DLLS]},@local_dlls;
       push @{@$target[$T_DEPENDS]},@local_depends;
     }
   }
@@ -932,11 +917,7 @@
     # Create the main target
     my $main_target=[];
     target_init($main_target);
-    if ($opt_target_type == $TT_DLL) {
-      @$main_target[$T_NAME]="lib$opt_single_target.so";
-    } else {
-      @$main_target[$T_NAME]="$opt_single_target";
-    }
+    @$main_target[$T_NAME]=$opt_single_target;
     @$main_target[$T_TYPE]=$opt_target_type;
 
     # Add it to the list
@@ -985,7 +966,8 @@
 	if (defined $index) {
 	  splice(@{@$target[$T_SOURCES_C]},$index,1);
 	}
-	@$target[$T_NAME]="lib@$target[$T_NAME].so";
+	@$target[$T_NAME]=@$target[$T_NAME];
+	@$target[$T_NAME]=~ s/.exe$/.dll/;
 	@$target[$T_TYPE]=$TT_DLL;
 
 	push @{@$project[$P_TARGETS]},$wrapper;
@@ -1593,23 +1575,16 @@
 # Generates a target's .spec file
 sub generate_spec_file($$$)
 {
-  if ($opt_no_generated_specs) {
-    return;
-  }
+  return if ($opt_no_generated_specs);
+
   my $path=$_[0];
   my $target=$_[1];
   my $project_settings=$_[2];
 
   my $basename=@$target[$T_NAME];
-  $basename =~ s+\.so$++;
-  if (@$target[$T_FLAGS] & $TF_WRAP) {
-    $basename =~ s+^lib++;
-  } elsif (@$target[$T_FLAGS] & $TF_WRAPPER) {
+  if (@$target[$T_FLAGS] & $TF_WRAPPER) {
     $basename.="_wrapper";
   }
-  if (@$target[$T_TYPE] != $TT_DLL) {
-      $basename .= '.exe';
-  }
 
   if (!open(FILEO,">$path$basename.spec")) {
     print STDERR "error: could not open \"$path$basename.spec\" for writing\n";
@@ -1762,7 +1725,7 @@
 		  });
     generate_list("EXES",1,\@exe_list,sub
 		  {
-		    return "@{$_[0]}[$T_NAME].exe";
+		    return "@{$_[0]}[$T_NAME]";
 		  });
     print FILEO "\n\n\n";
 
@@ -1823,14 +1760,8 @@
       generate_list("${canon}_C_SRCS",1,@$target[$T_SOURCES_C]);
       generate_list("${canon}_CXX_SRCS",1,@$target[$T_SOURCES_CXX]);
       generate_list("${canon}_RC_SRCS",1,@$target[$T_SOURCES_RC]);
-      my $basename=@$target[$T_NAME];
-      $basename =~ s+\.so$++;
-      if (@$target[$T_FLAGS] & $TF_WRAP) {
-	$basename =~ s+^lib++;
-      } elsif (@$target[$T_FLAGS] & $TF_WRAPPER) {
-	$basename.="_wrapper";
-      }
-      generate_list("${canon}_SPEC_SRCS",1,[ "$basename.exe.spec" ]);
+      generate_list("${canon}_SPEC_SRCS",1,[ (@$target[$T_TYPE] == $TT_DLL?"@$target[$T_NAME].spec":"") ]);
+      print FILEO "\n";
       generate_list("${canon}_DLL_PATH",1,@$target[$T_DLL_PATH]);
       generate_list("${canon}_DLLS",1,@$target[$T_DLLS]);
       generate_list("${canon}_LIBRARY_PATH",1,@$target[$T_LIBRARY_PATH]);
@@ -1880,6 +1811,6 @@
     print FILEO " \$(SUBDIRS)";
   }
   if (@{@$project[$P_TARGETS]} > 0) {
-    print FILEO " \$(DLLS) \$(EXES:%=%.so)";
+    print FILEO " \$(DLLS:%=%.so) \$(EXES:%=%.so)";
   }
   print FILEO "\n\n";
@@ -1920,29 +1848,24 @@
     print FILEO "### Target specific build rules\n\n";
     foreach my $target (@{@$project[$P_TARGETS]}) {
       my $canon=canonize("@$target[$T_NAME]");
-      my $mode;
 
-      $canon =~ s/_so$//;
+      my $mode;
       if (@$target[$T_TYPE] == $TT_GUIEXE) {
-	  $mode = '-m gui';
+	  $mode = "-m gui -exe @$target[$T_NAME]";
       } elsif (@$target[$T_TYPE] == $TT_CUIEXE) {
-	  $mode = '-m cui';
+	  $mode = "-m cui -exe @$target[$T_NAME]";
       } else {
-	  $mode = '';
+	  $mode = "";
       }
 
-      print FILEO "\$(${canon}_SPEC_SRCS:.spec=.spec.c): \$(${canon}_SPEC_SRCS) \$(${canon}_OBJS) \$(${canon}_RC_SRCS:.rc=.res)\n";
-      print FILEO "\t\$(LD_PATH) \$(WINEBUILD) -fPIC \$(${canon}_DLL_PATH) \$(WINE_DLL_PATH) \$(${canon}_DLLS:%=-l%) \$(${canon}_RC_SRCS:%.rc=-res %.res) $mode \$(${canon}_OBJS) -o \$\@ -spec \$(SRCDIR)/\$(${canon}_SPEC_SRCS)\n";
+      print FILEO "@$target[$T_NAME].spec.c: \$(${canon}_SPEC_SRCS) \$(${canon}_RC_SRCS:.rc=.res) \$(${canon}_OBJS)\n";
+      print FILEO "\t\$(LD_PATH) \$(WINEBUILD) -fPIC -o \$\@ \$(${canon}_SPEC_SRCS:%=-spec %) \$(${canon}_RC_SRCS:%.rc=-res %.res) \$(${canon}_DLL_PATH) \$(WINE_DLL_PATH) \$(GLOBAL_DLL_PATH) \$(${canon}_DLLS:%=-l%) \$(GLOBAL_DLLS:%=-l%) $mode \$(${canon}_OBJS)\n";
       print FILEO "\n";
-      my $t_name=@$target[$T_NAME];
-      if (@$target[$T_TYPE]!=$TT_DLL) {
-        $t_name.=".exe.so";
-      }
-      print FILEO "$t_name: \$(${canon}_SPEC_SRCS:.spec=.spec.o) \$(${canon}_OBJS) \$(${canon}_DEPENDS) \n";
+      print FILEO "@$target[$T_NAME].so: @$target[$T_NAME].spec.o \$(${canon}_OBJS) \$(${canon}_DEPENDS) \n";
       if (@{@$target[$T_SOURCES_CXX]} > 0 or @{@$project_settings[$T_SOURCES_CXX]} > 0) {
         print FILEO "\t\$(LDXXSHARED)";
       } else {
         print FILEO "\t\$(LDSHARED)";
       }
-      print FILEO " \$(LDDLLFLAGS) -o \$\@ \$(${canon}_OBJS) \$(${canon}_SPEC_SRCS:.spec=.spec.o) \$(${canon}_LIBRARY_PATH) \$(${canon}_LIBRARIES:%=-l%) \$(DLL_LINK) \$(LIBS)\n";
+      print FILEO " \$(LDDLLFLAGS) -o \$\@ \$(${canon}_OBJS) @$target[$T_NAME].spec.o \$(${canon}_LIBRARY_PATH) \$(${canon}_LIBRARIES:%=-l%) \$(DLL_LINK) \$(LIBS)\n";
       if (@$target[$T_TYPE] ne $TT_DLL) {
@@ -1968,9 +1879,8 @@
   close(FILEO);
 
   foreach my $target (@{@$project[$P_TARGETS]}) {
-    generate_spec_file(@$project[$P_PATH],$target,$project_settings);
-    if (@$target[$T_FLAGS] & $TF_WRAPPER) {
-      generate_wrapper_file(@$project[$P_PATH],$target);
+    if (@$target[$T_TYPE] eq $TT_DLL) {
+      generate_spec_file(@$project[$P_PATH],$target,$project_settings);
     }
   }
 }
@@ -3073,7 +3078,7 @@
 	-cd `dirname $@` && $(RM) $(CLEAN_FILES)
 
 clean:: $(SUBDIRS:%=%/__clean__) $(EXTRASUBDIRS:%=%/__clean__)
-	$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES) $(EXES:%=%.so) $(DLLS)
+	$(RM) $(CLEAN_FILES) $(RC_SRCS:.rc=.res) $(OBJS) $(EXES:%.exe=%) $(EXES:%=%.so) $(EXES:%=%.spec.o) $(DLLS:%=%.so) $(DLLS:%=%.spec.o)
 
 # Rules for installing
 
@@ -3157,8 +3160,8 @@
 #define      APP_TYPE      ##WINEMAKER_APP_TYPE##
 
 /**
- * This is the application library's base name, i.e. 'hello' if the
- * library is called 'libhello.so'.
+ * This is the name of the library containing the application,
+ * e.g. 'hello.dll' if the application is called 'hello.exe'.
  */
 static char* appName     = ##WINEMAKER_APP_NAME##;
 
@@ -3208,14 +3211,14 @@
     int retcode;
 
     /* Load the application's library */
-    libName=(char*)malloc(strlen(appName)+5+3+1);
+    libName=(char*)malloc(strlen(appName)+2+3+1);
     /* FIXME: we should get the wrapper's path and use that as the base for
      * the library
      */
-    sprintf(libName,"./lib%s.so",appName);
+    sprintf(libName,"./%s.so",appName);
     appLibrary=dlopen(libName,RTLD_NOW);
     if (appLibrary==NULL) {
-        sprintf(libName,"lib%s.so",appName);
+        sprintf(libName,"%s.so",appName);
         appLibrary=dlopen(libName,RTLD_NOW);
     }
     if (appLibrary==NULL) {

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux