Commit 13850a3e authored by Alexandre Julliard's avatar Alexandre Julliard

winegcc: Forward the -B options to winebuild.

parent ab871dc4
......@@ -297,6 +297,22 @@ file_type get_lib_type(enum target_platform platform, strarray* path, const char
return file_na;
}
const char *find_binary( const strarray* prefix, const char *name )
{
unsigned int i;
if (!prefix) return name;
if (strchr( name, '/' )) return name;
for (i = 0; i < prefix->size; i++)
{
struct stat st;
char *prog = strmake( "%s/%s%s", prefix->base[i], name, EXEEXT );
if (stat( prog, &st ) == 0 && S_ISREG( st.st_mode ) && (st.st_mode & 0111)) return prog;
}
return name;
}
int spawn(const strarray* prefix, const strarray* args, int ignore_errors)
{
unsigned int i;
......@@ -307,26 +323,7 @@ int spawn(const strarray* prefix, const strarray* args, int ignore_errors)
strarray_add(arr, NULL);
argv = arr->base;
if (prefix)
{
const char *p = strrchr(argv[0], '/');
if (!p) p = argv[0];
else p++;
for (i = 0; i < prefix->size; i++)
{
struct stat st;
free( prog );
prog = strmake("%s/%s%s", prefix->base[i], p, EXEEXT);
if (stat(prog, &st) == 0 && S_ISREG(st.st_mode) && (st.st_mode & 0111))
{
argv[0] = prog;
break;
}
}
}
argv[0] = find_binary( prefix, argv[0] );
if (verbose)
{
......
......@@ -83,6 +83,7 @@ void create_file(const char* name, int mode, const char* fmt, ...);
file_type get_file_type(const char* filename);
file_type get_lib_type(enum target_platform platform, strarray* path, const char *library,
const char *suffix, char** file);
const char *find_binary( const strarray* prefix, const char *name );
int spawn(const strarray* prefix, const strarray* arr, int ignore_errors);
extern int verbose;
......@@ -300,7 +300,7 @@ static char* get_temp_file(const char* prefix, const char* suffix)
return tmp;
}
static char* build_tool_name(struct options *opts, const char* base, const char* deflt)
static const char* build_tool_name(struct options *opts, const char* base, const char* deflt)
{
char* str;
......@@ -318,12 +318,12 @@ static char* build_tool_name(struct options *opts, const char* base, const char*
}
else
str = xstrdup(deflt);
return str;
return find_binary( opts->prefix, str );
}
static const strarray* get_translator(struct options *opts)
{
char *str = NULL;
const char *str = NULL;
strarray *ret;
switch(opts->processor)
......@@ -342,7 +342,6 @@ static const strarray* get_translator(struct options *opts)
assert(0);
}
ret = strarray_fromstring( str, " " );
free(str);
if (opts->force_pointer_size)
strarray_add( ret, strmake("-m%u", 8 * opts->force_pointer_size ));
return ret;
......@@ -847,9 +846,10 @@ static strarray *get_winebuild_args(struct options *opts)
{
const char* winebuild = getenv("WINEBUILD");
strarray *spec_args = strarray_alloc();
unsigned int i;
if (!winebuild) winebuild = "winebuild";
strarray_add( spec_args, winebuild );
strarray_add( spec_args, find_binary( opts->prefix, winebuild ));
if (verbose) strarray_add( spec_args, "-v" );
if (keep_generated) strarray_add( spec_args, "--save-temps" );
if (opts->target)
......@@ -857,6 +857,14 @@ static strarray *get_winebuild_args(struct options *opts)
strarray_add( spec_args, "--target" );
strarray_add( spec_args, opts->target );
}
if (opts->prefix)
{
for (i = 0; i < opts->prefix->size; i++)
{
if (strendswith( opts->prefix->base[i], "/tools/winebuild" )) continue;
strarray_add( spec_args, strmake( "-B%s", opts->prefix->base[i] ));
}
}
if (!opts->use_msvcrt) strarray_add( spec_args, "-munix" );
if (opts->unwind_tables) strarray_add( spec_args, "-fasynchronous-unwind-tables" );
else strarray_add( spec_args, "-fno-asynchronous-unwind-tables" );
......
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