Alexandre Julliard : winebuild: Add an option to use the C compiler to assemble files.

Alexandre Julliard julliard at winehq.org
Mon Jun 10 15:12:44 CDT 2013


Module: wine
Branch: master
Commit: 98e6a0da73ef87dacdcf0bcf0ca58c0091799968
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=98e6a0da73ef87dacdcf0bcf0ca58c0091799968

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Jun 10 13:19:29 2013 +0200

winebuild: Add an option to use the C compiler to assemble files.

---

 tools/winebuild/build.h          |    1 +
 tools/winebuild/main.c           |    7 +++++++
 tools/winebuild/utils.c          |   18 +++++++-----------
 tools/winebuild/winebuild.man.in |    4 ++++
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index e943762..fa92764 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -358,6 +358,7 @@ extern const char *output_file_name;
 extern char **lib_path;
 
 extern struct strarray *as_command;
+extern struct strarray *cc_command;
 extern struct strarray *ld_command;
 extern struct strarray *nm_command;
 extern char *cpu_option;
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index de526a9..a848a0c 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -85,6 +85,7 @@ static const char *output_file_source_name;
 static int fake_module;
 
 struct strarray *as_command = NULL;
+struct strarray *cc_command = NULL;
 struct strarray *ld_command = NULL;
 struct strarray *nm_command = NULL;
 char *cpu_option = NULL;
@@ -241,6 +242,7 @@ static const char usage_str[] =
 "Options:\n"
 "       --as-cmd=AS           Command to use for assembling (default: as)\n"
 "   -b, --target=TARGET       Specify target CPU and platform for cross-compiling\n"
+"       --cc-cmd=CC           C compiler to use for assembling (default: fall back to --as-cmd)\n"
 "   -d, --delay-lib=LIB       Import the specified library in delayed mode\n"
 "   -D SYM                    Ignored for C flags compatibility\n"
 "   -e, --entry=FUNC          Set the DLL entry point function (default: DllMain)\n"
@@ -286,6 +288,7 @@ enum long_options_values
     LONG_OPT_EXE,
     LONG_OPT_IMPLIB,
     LONG_OPT_ASCMD,
+    LONG_OPT_CCCMD,
     LONG_OPT_EXTERNAL_SYMS,
     LONG_OPT_FAKE_MODULE,
     LONG_OPT_LARGE_ADDRESS_AWARE,
@@ -307,6 +310,7 @@ static const struct option long_options[] =
     { "exe",           0, 0, LONG_OPT_EXE },
     { "implib",        0, 0, LONG_OPT_IMPLIB },
     { "as-cmd",        1, 0, LONG_OPT_ASCMD },
+    { "cc-cmd",        1, 0, LONG_OPT_CCCMD },
     { "external-symbols", 0, 0, LONG_OPT_EXTERNAL_SYMS },
     { "fake-module",   0, 0, LONG_OPT_FAKE_MODULE },
     { "large-address-aware", 0, 0, LONG_OPT_LARGE_ADDRESS_AWARE },
@@ -476,6 +480,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
         case LONG_OPT_ASCMD:
             as_command = strarray_fromstring( optarg, " " );
             break;
+        case LONG_OPT_CCCMD:
+            cc_command = strarray_fromstring( optarg, " " );
+            break;
         case LONG_OPT_FAKE_MODULE:
             fake_module = 1;
             break;
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index d064572..2028b05 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -373,13 +373,15 @@ struct strarray *find_tool( const char *name, const char * const *names )
 
 struct strarray *get_as_command(void)
 {
-    static int as_is_clang = 0;
     struct strarray *args;
 
-    if (!as_command)
+    if (cc_command)
     {
-        as_command = find_tool( "clang", NULL );
-        if (as_command) as_is_clang = 1;
+        args = strarray_copy( cc_command );
+        strarray_add( args, "-xassembler", "-c", NULL );
+        if (force_pointer_size)
+            strarray_add_one( args, (force_pointer_size == 8) ? "-m64" : "-m32" );
+        return args;
     }
 
     if (!as_command)
@@ -393,13 +395,7 @@ struct strarray *get_as_command(void)
 
     args = strarray_copy( as_command );
 
-    if (as_is_clang)
-    {
-        strarray_add( args, "-xassembler", "-c", NULL );
-        if (force_pointer_size)
-            strarray_add_one( args, (force_pointer_size == 8) ? "-m64" : "-m32" );
-    }
-    else if (force_pointer_size)
+    if (force_pointer_size)
     {
         switch (target_platform)
         {
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index 59debd4..3762b74 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -67,6 +67,10 @@ Specify the target CPU and platform on which the generated code will
 be built. The target specification is in the standard autoconf format
 as returned by config.sub.
 .TP
+.BI \--cc-cmd= cc-command
+Specify the C compiler to use to compile assembly files; the default
+is to instead use the assembler specified with \fB--as-cmd\fR.
+.TP
 .BI \-d,\ --delay-lib= name
 Set the delayed import mode for the specified library, which must be
 one of the libraries imported with the \fB-l\fR option. Delayed mode




More information about the wine-cvs mailing list