diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index 29cd997b961..65493ec37fb 100644 --- a/tools/winebuild/build.h +++ b/tools/winebuild/build.h @@ -303,7 +303,7 @@ extern void output_get_pc_thunk(void); extern void output_module( DLLSPEC *spec ); extern void output_stubs( DLLSPEC *spec ); extern void output_imports( DLLSPEC *spec ); -extern void output_import_lib( DLLSPEC *spec, char **argv ); +extern void output_static_lib( DLLSPEC *spec, char **argv ); extern void output_exports( DLLSPEC *spec ); extern int load_res32_file( const char *name, DLLSPEC *spec ); extern void output_resources( DLLSPEC *spec ); diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index c4dc31957d9..04ab433dd65 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1539,16 +1539,16 @@ static void build_unix_import_lib( DLLSPEC *spec ) } /* output an import library for a Win32 module and additional object files */ -void output_import_lib( DLLSPEC *spec, char **argv ) +void output_static_lib( DLLSPEC *spec, char **argv ) { if (target_platform == PLATFORM_WINDOWS) { - build_windows_import_lib( spec ); - if (argv[0]) build_library( output_file_name, argv, 0 ); + if (spec) build_windows_import_lib( spec ); + if (argv[0] || !spec) build_library( output_file_name, argv, !spec ); } else { - build_unix_import_lib( spec ); + if (spec) build_unix_import_lib( spec ); build_library( output_file_name, argv, 1 ); } } diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c index e30ecdd4b5d..81f7678eaea 100644 --- a/tools/winebuild/main.c +++ b/tools/winebuild/main.c @@ -113,6 +113,7 @@ enum exec_mode_values MODE_EXE, MODE_DEF, MODE_IMPLIB, + MODE_STATICLIB, MODE_BUILTIN, MODE_RESOURCES }; @@ -299,6 +300,7 @@ static const char usage_str[] = " --def Build a .def file from a .spec file\n" " --exe Build an executable from object files\n" " --implib Build an import library\n" +" --staticlib Build a static library\n" " --builtin Mark a library as a Wine builtin\n" " --resources Build a .o or .res file for the resource files\n\n" "The mode options are mutually exclusive; you must specify one and only one.\n\n"; @@ -320,6 +322,7 @@ enum long_options_values LONG_OPT_NXCOMPAT, LONG_OPT_RESOURCES, LONG_OPT_SAVE_TEMPS, + LONG_OPT_STATICLIB, LONG_OPT_SUBSYSTEM, LONG_OPT_VERSION }; @@ -332,6 +335,7 @@ static const struct option long_options[] = { "def", 0, 0, LONG_OPT_DEF }, { "exe", 0, 0, LONG_OPT_EXE }, { "implib", 0, 0, LONG_OPT_IMPLIB }, + { "staticlib", 0, 0, LONG_OPT_STATICLIB }, { "builtin", 0, 0, LONG_OPT_BUILTIN }, { "as-cmd", 1, 0, LONG_OPT_ASCMD }, { "cc-cmd", 1, 0, LONG_OPT_CCCMD }, @@ -501,6 +505,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec ) case LONG_OPT_IMPLIB: set_exec_mode( MODE_IMPLIB ); break; + case LONG_OPT_STATICLIB: + set_exec_mode( MODE_STATICLIB ); + break; case LONG_OPT_BUILTIN: set_exec_mode( MODE_BUILTIN ); break; @@ -685,7 +692,10 @@ int main(int argc, char **argv) case MODE_IMPLIB: if (!spec_file_name) fatal_error( "missing .spec file\n" ); if (!parse_input_file( spec )) break; - output_import_lib( spec, argv ); + output_static_lib( spec, argv ); + break; + case MODE_STATICLIB: + output_static_lib( NULL, argv ); break; case MODE_BUILTIN: if (!argv[0]) fatal_error( "missing file argument for --builtin option\n" ); diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in index 4da48ffa813..29a17484ada 100644 --- a/tools/winebuild/winebuild.man.in +++ b/tools/winebuild/winebuild.man.in @@ -51,6 +51,9 @@ Build a .a import library from a spec file. The .spec file is specified via the \fB-E\fR option. If the output library name ends in .delay.a, a delayed import library is built. .TP +.BI \--staticlib +Build a .a static library from object files. +.TP .BI \--builtin Mark a PE module as a Wine builtin module, by adding the "Wine builtin DLL" signature string after the DOS header.