winegcc: support winebuild options

Dimitrie O. Paun dpaun at rogers.com
Mon Mar 1 23:28:16 CST 2004


ChangeLog
    Add support for passing options to winebuild via -Wb
    Generate only the loader script when given just the .exe.so
    Add function to delete element from a strarray.

Index: tools/winegcc/utils.c
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/utils.c,v
retrieving revision 1.6
diff -u -r1.6 utils.c
--- tools/winegcc/utils.c	2 Mar 2004 02:23:26 -0000	1.6
+++ tools/winegcc/utils.c	2 Mar 2004 02:39:36 -0000
@@ -118,6 +118,13 @@
     arr->base[arr->size++] = str;
 }
 
+void strarray_del(strarray* arr, int i)
+{
+    if (i < 0 || i >= arr->size) error("Invalid index i=%d", i);
+    memmove(&arr->base[i], &arr->base[i + 1], (arr->size - i - 1) * sizeof(arr->base[0]));
+    arr->size--;
+}
+
 void strarray_addall(strarray* arr, const strarray* from)
 {
     int i;
Index: tools/winegcc/utils.h
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/utils.h,v
retrieving revision 1.5
diff -u -r1.5 utils.h
--- tools/winegcc/utils.h	2 Mar 2004 02:23:26 -0000	1.5
+++ tools/winegcc/utils.h	2 Mar 2004 02:39:47 -0000
@@ -48,6 +48,7 @@
 strarray* strarray_dup(const strarray* arr);
 void strarray_free(strarray* arr);
 void strarray_add(strarray* arr, const char* str);
+void strarray_del(strarray* arr, int i);
 void strarray_addall(strarray* arr, const strarray* from);
 strarray* strarray_fromstring(const char* str, const char* delim);
 char* strarray_tostring(const strarray* arr, const char* sep);
Index: tools/winegcc/winegcc.c
===================================================================
RCS file: /var/cvs/wine/tools/winegcc/winegcc.c,v
retrieving revision 1.10
diff -u -r1.10 winegcc.c
--- tools/winegcc/winegcc.c	2 Mar 2004 05:00:17 -0000	1.10
+++ tools/winegcc/winegcc.c	2 Mar 2004 05:25:21 -0000
@@ -165,6 +165,7 @@
     strarray* lib_dirs;
     strarray *linker_args;
     strarray *compiler_args;
+    strarray* winebuild_args;
     strarray* files;
 };
 
@@ -336,8 +337,8 @@
     char *spec_c_name, *spec_o_name, *base_file, *base_name;
     const char* output_name;
     const char *winebuild = getenv("WINEBUILD");
-    int j;
     int generate_app_loader = 1;
+    int j;
 
     if (!winebuild) winebuild = "winebuild";
 
@@ -361,6 +362,9 @@
     if ((base_name = strrchr(base_file, '/'))) base_name++;
     else base_name = base_file;
 
+    if (opts->files->size == 1 && strendswith(opts->files->base[0], ".exe.so"))
+	goto only_app_loader;
+
     /* prepare the linking path */
     lib_dirs = strarray_dup(opts->lib_dirs);
     for ( j = 0; j < sizeof(stdlibpath)/sizeof(stdlibpath[0]);j++ )
@@ -444,6 +448,9 @@
     strarray_add(spec_args, strmake("%s.exe", base_name));
     strarray_add(spec_args, opts->gui_app ? "-mgui" : "-mcui");
 
+    for ( j = 0 ; j < opts->winebuild_args->size ; j++ ) 
+        strarray_add(spec_args, opts->winebuild_args->base[j]);
+
     for ( j = 0; j < lib_paths->size; j++ )
 	strarray_add(spec_args, lib_paths->base[j]);
 
@@ -504,6 +511,7 @@
     spawn(link_args);
 
     /* create the loader script */
+only_app_loader:
     if (generate_app_loader)
     {
         create_file(base_file, app_loader_template, base_name);
@@ -614,6 +622,7 @@
     opts.files = strarray_alloc();
     opts.linker_args = strarray_alloc();
     opts.compiler_args = strarray_alloc();
+    opts.winebuild_args = strarray_alloc();
 
     /* determine the processor type */
     if (strendswith(argv[0], "winecpp")) opts.processor = proc_pp;
@@ -749,6 +758,12 @@
                         if (strstr(argv[i], "-static"))
                             linking = -1;
                     }
+		    else if (strncmp("-Wb,", argv[i], 4) == 0)
+		    {
+			strarray* Wb = strarray_fromstring(argv[i] + 4, ",");
+			strarray_addall(opts.winebuild_args, Wb);
+			strarray_free(Wb);
+		    }
                     break;
                 case '-':
                     if (strcmp("-static", argv[i]+1) == 0)


-- 
Dimi.




More information about the wine-patches mailing list