Commit 07af19f3 authored by Alexandre Julliard's avatar Alexandre Julliard

winegcc: Add support for specifying a custom static library suffix.

parent cce43871
......@@ -259,7 +259,7 @@ static char* try_lib_path(const char* dir, const char* pre,
}
static file_type guess_lib_type(enum target_platform platform, const char* dir,
const char* library, char** file)
const char* library, const char *suffix, char** file)
{
if (platform != PLATFORM_WINDOWS)
{
......@@ -277,19 +277,21 @@ static file_type guess_lib_type(enum target_platform platform, const char* dir,
}
/* static archives */
if ((*file = try_lib_path(dir, "lib", library, ".a", file_arh)))
if ((*file = try_lib_path(dir, "lib", library, suffix, file_arh)))
return file_arh;
return file_na;
}
file_type get_lib_type(enum target_platform platform, strarray* path, const char* library, char** file)
file_type get_lib_type(enum target_platform platform, strarray* path, const char *library,
const char *suffix, char** file)
{
unsigned int i;
if (!suffix) suffix = ".a";
for (i = 0; i < path->size; i++)
{
file_type type = guess_lib_type(platform, path->base[i], library, file);
file_type type = guess_lib_type(platform, path->base[i], library, suffix, file);
if (type != file_na) return type;
}
return file_na;
......
......@@ -72,7 +72,8 @@ typedef enum {
char* get_basename(const char* file);
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, char** file);
file_type get_lib_type(enum target_platform platform, strarray* path, const char *library,
const char *suffix, char** file);
void spawn(const strarray* prefix, const strarray* arr, int ignore_errors);
extern int verbose;
......@@ -199,6 +199,7 @@ struct options
const char* output_name;
const char* image_base;
const char* section_align;
const char* lib_suffix;
strarray* prefix;
strarray* lib_dirs;
strarray* linker_args;
......@@ -520,7 +521,7 @@ static void add_library( struct options *opts, strarray *lib_dirs, strarray *fil
{
char *static_lib, *fullname = 0;
switch(get_lib_type(opts->target_platform, lib_dirs, library, &fullname))
switch(get_lib_type(opts->target_platform, lib_dirs, library, opts->lib_suffix, &fullname))
{
case file_arh:
strarray_add(files, strmake("-a%s", fullname));
......@@ -1333,6 +1334,12 @@ int main(int argc, char **argv)
else opts.wine_objdir = argv[++i];
raw_compiler_arg = raw_linker_arg = 0;
}
else if (!strncmp("--lib-suffix", argv[i], 12) && opts.wine_objdir)
{
if (argv[i][12] == '=') opts.lib_suffix = argv[i] + 13;
else opts.lib_suffix = argv[++i];
raw_compiler_arg = raw_linker_arg = 0;
}
break;
}
......
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