Commit 7c909489 authored by Alexandre Julliard's avatar Alexandre Julliard

winegcc: Pass the same winebuild args to all winebuild invocations.

parent 16c03e47
...@@ -986,8 +986,7 @@ static strarray *get_winebuild_args(struct options *opts) ...@@ -986,8 +986,7 @@ static strarray *get_winebuild_args(struct options *opts)
for (i = 0; i < opts->prefix->size; i++) for (i = 0; i < opts->prefix->size; i++)
strarray_add( spec_args, strmake( "-B%s", opts->prefix->base[i] )); strarray_add( spec_args, strmake( "-B%s", opts->prefix->base[i] ));
} }
if (opts->use_msvcrt) strarray_add( spec_args, "-mno-cygwin" ); strarray_addall( spec_args, opts->winebuild_args );
if (opts->unix_lib) strarray_add( spec_args, "-munix" );
if (opts->unwind_tables) strarray_add( spec_args, "-fasynchronous-unwind-tables" ); if (opts->unwind_tables) strarray_add( spec_args, "-fasynchronous-unwind-tables" );
else strarray_add( spec_args, "-fno-asynchronous-unwind-tables" ); else strarray_add( spec_args, "-fno-asynchronous-unwind-tables" );
return spec_args; return spec_args;
...@@ -1266,8 +1265,6 @@ static void build(struct options* opts) ...@@ -1266,8 +1265,6 @@ static void build(struct options* opts)
spec_o_name = get_temp_file(output_name, ".spec.o"); spec_o_name = get_temp_file(output_name, ".spec.o");
if (opts->force_pointer_size) if (opts->force_pointer_size)
strarray_add(spec_args, strmake("-m%u", 8 * opts->force_pointer_size )); strarray_add(spec_args, strmake("-m%u", 8 * opts->force_pointer_size ));
if(opts->unicode_app)
strarray_add(spec_args, "-municode");
strarray_add(spec_args, "-D_REENTRANT"); strarray_add(spec_args, "-D_REENTRANT");
if (opts->pic && !is_pe) strarray_add(spec_args, "-fPIC"); if (opts->pic && !is_pe) strarray_add(spec_args, "-fPIC");
strarray_add(spec_args, opts->shared ? "--dll" : "--exe"); strarray_add(spec_args, opts->shared ? "--dll" : "--exe");
...@@ -1287,7 +1284,6 @@ static void build(struct options* opts) ...@@ -1287,7 +1284,6 @@ static void build(struct options* opts)
strarray_add(spec_args, "-E"); strarray_add(spec_args, "-E");
strarray_add(spec_args, spec_file); strarray_add(spec_args, spec_file);
} }
if (opts->win16_app) strarray_add(spec_args, "-m16");
if (!opts->shared) if (!opts->shared)
{ {
...@@ -1315,9 +1311,6 @@ static void build(struct options* opts) ...@@ -1315,9 +1311,6 @@ static void build(struct options* opts)
for ( j = 0; j < lib_dirs->size; j++ ) for ( j = 0; j < lib_dirs->size; j++ )
strarray_add(spec_args, strmake("-L%s", lib_dirs->base[j])); strarray_add(spec_args, strmake("-L%s", lib_dirs->base[j]));
for ( j = 0 ; j < opts->winebuild_args->size ; j++ )
strarray_add(spec_args, opts->winebuild_args->base[j]);
if (!is_pe) if (!is_pe)
{ {
for (j = 0; j < opts->delayimports->size; j++) for (j = 0; j < opts->delayimports->size; j++)
...@@ -1485,7 +1478,6 @@ static void build(struct options* opts) ...@@ -1485,7 +1478,6 @@ static void build(struct options* opts)
strarray_add(implib_args, opts->out_implib); strarray_add(implib_args, opts->out_implib);
strarray_add(implib_args, "--export"); strarray_add(implib_args, "--export");
strarray_add(implib_args, spec_file); strarray_add(implib_args, spec_file);
strarray_addall(implib_args, opts->winebuild_args);
spawn(opts->prefix, implib_args, 0); spawn(opts->prefix, implib_args, 0);
strarray_free (implib_args); strarray_free (implib_args);
...@@ -1636,7 +1628,7 @@ static int is_option( struct options *opts, int i, const char *option, const cha ...@@ -1636,7 +1628,7 @@ static int is_option( struct options *opts, int i, const char *option, const cha
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int i, c, next_is_arg = 0, linking = 1; int i, c, next_is_arg = 0, linking = 1;
int raw_compiler_arg, raw_linker_arg; int raw_compiler_arg, raw_linker_arg, raw_winebuild_arg;
const char* option_arg; const char* option_arg;
struct options opts; struct options opts;
char* lang = 0; char* lang = 0;
...@@ -1782,6 +1774,7 @@ int main(int argc, char **argv) ...@@ -1782,6 +1774,7 @@ int main(int argc, char **argv)
/* determine what options go 'as is' to the linker & the compiler */ /* determine what options go 'as is' to the linker & the compiler */
raw_linker_arg = is_linker_arg(opts.args->base[i]); raw_linker_arg = is_linker_arg(opts.args->base[i]);
raw_compiler_arg = !raw_linker_arg; raw_compiler_arg = !raw_linker_arg;
raw_winebuild_arg = 0;
/* do a bit of semantic analysis */ /* do a bit of semantic analysis */
switch (opts.args->base[i][1]) switch (opts.args->base[i][1])
...@@ -1840,7 +1833,7 @@ int main(int argc, char **argv) ...@@ -1840,7 +1833,7 @@ int main(int argc, char **argv)
{ {
opts.use_msvcrt = 1; opts.use_msvcrt = 1;
raw_compiler_arg = 0; raw_compiler_arg = 0;
strarray_add( opts.winebuild_args, opts.args->base[i] ); raw_winebuild_arg = 1;
} }
else if (strcmp("-mwindows", opts.args->base[i]) == 0) else if (strcmp("-mwindows", opts.args->base[i]) == 0)
{ {
...@@ -1856,6 +1849,7 @@ int main(int argc, char **argv) ...@@ -1856,6 +1849,7 @@ int main(int argc, char **argv)
{ {
opts.unicode_app = 1; opts.unicode_app = 1;
raw_compiler_arg = 0; raw_compiler_arg = 0;
raw_winebuild_arg = 1;
} }
else if (strcmp("-mthreads", opts.args->base[i]) == 0) else if (strcmp("-mthreads", opts.args->base[i]) == 0)
{ {
...@@ -1865,11 +1859,13 @@ int main(int argc, char **argv) ...@@ -1865,11 +1859,13 @@ int main(int argc, char **argv)
{ {
opts.unix_lib = 1; opts.unix_lib = 1;
raw_compiler_arg = 0; raw_compiler_arg = 0;
raw_winebuild_arg = 1;
} }
else if (strcmp("-m16", opts.args->base[i]) == 0) else if (strcmp("-m16", opts.args->base[i]) == 0)
{ {
opts.win16_app = 1; opts.win16_app = 1;
raw_compiler_arg = 0; raw_compiler_arg = 0;
raw_winebuild_arg = 1;
} }
else if (strcmp("-m32", opts.args->base[i]) == 0) else if (strcmp("-m32", opts.args->base[i]) == 0)
{ {
...@@ -1891,14 +1887,14 @@ int main(int argc, char **argv) ...@@ -1891,14 +1887,14 @@ int main(int argc, char **argv)
} }
else if (!strcmp("-marm", opts.args->base[i] ) || !strcmp("-mthumb", opts.args->base[i] )) else if (!strcmp("-marm", opts.args->base[i] ) || !strcmp("-mthumb", opts.args->base[i] ))
{ {
strarray_add(opts.winebuild_args, opts.args->base[i]);
raw_linker_arg = 1; raw_linker_arg = 1;
raw_winebuild_arg = 1;
} }
else if (!strncmp("-mcpu=", opts.args->base[i], 6) || else if (!strncmp("-mcpu=", opts.args->base[i], 6) ||
!strncmp("-mfpu=", opts.args->base[i], 6) || !strncmp("-mfpu=", opts.args->base[i], 6) ||
!strncmp("-march=", opts.args->base[i], 7) || !strncmp("-march=", opts.args->base[i], 7) ||
!strncmp("-mfloat-abi=", opts.args->base[i], 12)) !strncmp("-mfloat-abi=", opts.args->base[i], 12))
strarray_add(opts.winebuild_args, opts.args->base[i]); raw_winebuild_arg = 1;
break; break;
case 'n': case 'n':
if (strcmp("-nostdinc", opts.args->base[i]) == 0) if (strcmp("-nostdinc", opts.args->base[i]) == 0)
...@@ -2073,6 +2069,12 @@ int main(int argc, char **argv) ...@@ -2073,6 +2069,12 @@ int main(int argc, char **argv)
if (next_is_arg && (i + 1 < opts.args->size)) if (next_is_arg && (i + 1 < opts.args->size))
strarray_add( opts.compiler_args, opts.args->base[i + 1] ); strarray_add( opts.compiler_args, opts.args->base[i + 1] );
} }
if (raw_winebuild_arg)
{
strarray_add( opts.winebuild_args, opts.args->base[i] );
if (next_is_arg && (i + 1 < opts.args->size))
strarray_add( opts.winebuild_args, opts.args->base[i + 1] );
}
/* skip the next token if it's an argument */ /* skip the next token if it's an argument */
if (next_is_arg) i++; if (next_is_arg) i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment