.so dependancies in winegcc

Warren_Baird/CSI at cimmetry.com Warren_Baird/CSI at cimmetry.com
Tue Oct 12 09:30:15 CDT 2004


Pierre d'Herbemont <stegefin at free.fr> wrote on 10/10/2004 01:50:39 PM:

> Warren,
> 
> On Mac OS X/Darwin .so and .dylib extensions are both used. In fact 
> .dylib extension is used for dynamic libraries (libwine*.dylib) whereas 
> dll.so and exe.so extensions are used for the dlls and the exe. So your 
> patch would break winegcc on Mac OS X.'

Hi Pierre,

Thanks for the info - I didn't realize how that worked on the mac.   I've 
redone my changes so that SHLIBSUFFIX and EXESUFFIX stay .so and .exe.so 
on MacOSX, and I've left the special cases for .dylib in place.   Let me 
know if you think this looks more reasonable.

I've attached my re-worked patch.

Warren

--
Warren Baird, Technical Group Leader       warren_baird at cimmetry.com
Cimmetry System Inc.                       514 735 3219 x148


-------------- next part --------------
diff -ur clean/wine-20040914/tools/winegcc/utils.c wine-20040914/tools/winegcc/utils.c
--- clean/wine-20040914/tools/winegcc/utils.c	2004-03-22 19:14:54.000000000 -0500
+++ wine-20040914/tools/winegcc/utils.c	2004-10-12 10:20:55.000000000 -0400
@@ -219,7 +219,7 @@
     if (strendswith(filename, ".o")) return file_obj;
     if (strendswith(filename, ".a")) return file_arh;
     if (strendswith(filename, ".res")) return file_res;
-    if (strendswith(filename, ".so")) return file_so;
+    if (strendswith(filename, SHLIBSUFFIX)) return file_so;
     if (strendswith(filename, ".dylib")) return file_so;
     if (strendswith(filename, ".def")) return file_def;
     if (strendswith(filename, ".spec")) return file_spec;
@@ -247,7 +247,7 @@
 static file_type guess_lib_type(const char* dir, const char* library, char** file)
 {
     /* Unix shared object */
-    if ((*file = try_lib_path(dir, "lib", library, ".so", file_so)))
+    if ((*file = try_lib_path(dir, "lib", library, SHLIBSUFFIX, file_so)))
 	return file_so;
 	
     /* Mach-O (Darwin/Mac OS X) Dynamic Library behaves mostly like .so */
diff -ur clean/wine-20040914/tools/winegcc/utils.h wine-20040914/tools/winegcc/utils.h
--- clean/wine-20040914/tools/winegcc/utils.h	2004-03-22 19:14:54.000000000 -0500
+++ wine-20040914/tools/winegcc/utils.h	2004-10-12 10:10:38.000000000 -0400
@@ -65,3 +65,12 @@
 void spawn(const strarray* prefix, const strarray* arr);
 
 extern int verbose;
+
+#ifdef __hpux
+#define EXESUFFIX    ".exe.sl"
+#define SHLIBSUFFIX  ".sl"
+#else
+#define EXESUFFIX    ".exe.so"
+#define SHLIBSUFFIX  ".so"
+#endif
+
diff -ur clean/wine-20040914/tools/winegcc/winegcc.c wine-20040914/tools/winegcc/winegcc.c
--- clean/wine-20040914/tools/winegcc/winegcc.c	2004-08-18 21:20:45.000000000 -0400
+++ wine-20040914/tools/winegcc/winegcc.c	2004-10-12 10:10:07.000000000 -0400
@@ -354,7 +354,7 @@
      *    -lxxx:  xxx is an unsorted library
      *    -oxxx:  xxx is an object (.o)
      *    -rxxx:  xxx is a resource (.res)
-     *    -sxxx:  xxx is a shared lib (.so)
+     *    -sxxx:  xxx is a shared lib (.so or .sl)
      *    -xlll:  lll is the language (c, c++, etc.)
      */
 
@@ -363,19 +363,20 @@
     output_file = strdup( opts->output_name ? opts->output_name : "a.out" );
 
     /* 'winegcc -o app xxx.exe.so' only creates the load script */
-    if (opts->files->size == 1 && strendswith(opts->files->base[0], ".exe.so"))
+    if (opts->files->size == 1 && strendswith(opts->files->base[0], EXESUFFIX))
     {
 	create_file(output_file, 0755, app_loader_template, opts->files->base[0]);
 	return;
     }
 
     /* generate app loader only for .exe */
-    if (opts->shared || strendswith(output_file, ".exe.so"))
+    if (opts->shared || strendswith(output_file, EXESUFFIX))
 	generate_app_loader = 0;
 
-    /* normalize the filename a bit: strip .so, ensure it has proper ext */
-    if (strendswith(output_file, ".so")) 
-	output_file[strlen(output_file) - 3] = 0;
+    /* normalize the filename a bit: strip shared lib extension 
+       (.so or .sl) and  ensure it has proper ext */
+    if (strendswith(output_file, SHLIBSUFFIX)) 
+      output_file[strlen(output_file) - strlen(SHLIBSUFFIX)] = 0;
     if (opts->shared)
     {
 	if ((output_name = strrchr(output_file, '/'))) output_name++;
@@ -545,7 +546,7 @@
     strarray_addall(link_args, strarray_fromstring(LDDLLFLAGS, " "));
 
     strarray_add(link_args, "-o");
-    strarray_add(link_args, strmake("%s.so", output_file));
+    strarray_add(link_args, strmake("%s%s", output_file, SHLIBSUFFIX));
 
     for ( j = 0 ; j < opts->linker_args->size ; j++ ) 
         strarray_add(link_args, opts->linker_args->base[j]);
@@ -584,7 +585,7 @@
     if (generate_app_loader)
     {
         if (strendswith(output_file, ".exe")) output_file[strlen(output_file) - 4] = 0;
-        create_file(output_file, 0755, app_loader_template, strmake("%s.exe.so", output_name));
+        create_file(output_file, 0755, app_loader_template, strmake("%s%s", output_name, EXESUFFIX));
     }
 }
 


More information about the wine-devel mailing list