Commit 6cf96bf9 authored by Alexandre Julliard's avatar Alexandre Julliard

winebuild: Add possibility to generate a global resource file without running it through windres.

parent 43f6c4cb
......@@ -244,7 +244,7 @@ static const char usage_str[] =
" --def Build a .def file from a .spec file\n"
" --exe Build a .c file for an executable\n"
" --relay16 Build the 16-bit relay assembly routines\n"
" --relay32 Build the 32-bit relay assembly routines\n\n"
" --relay32 Build the 32-bit relay assembly routines\n"
" --resources Build a .o file for the resource files\n\n"
"The mode options are mutually exclusive; you must specify one and only one.\n\n";
......
......@@ -541,8 +541,7 @@ void output_res_o_file( DLLSPEC *spec )
{
unsigned int i, total_size;
unsigned char *data;
char *res_file, *cmd;
const char *prog;
char *res_file = NULL;
int fd, err;
if (!spec->nb_resources) fatal_error( "--resources mode needs at least one resource file as input\n" );
......@@ -593,20 +592,32 @@ void output_res_o_file( DLLSPEC *spec )
}
assert( file_out_pos == file_out_end );
res_file = get_temp_file_name( output_file_name, ".res" );
if ((fd = open( res_file, O_WRONLY|O_CREAT|O_TRUNC, 0600 )) == -1)
fatal_error( "Cannot create %s\n", res_file );
/* if the output file name is a .res too, don't run the results through windres */
if (strendswith( output_file_name, ".res"))
{
if ((fd = open( output_file_name, O_WRONLY|O_CREAT|O_TRUNC, 0666 )) == -1)
fatal_error( "Cannot create %s\n", output_file_name );
}
else
{
res_file = get_temp_file_name( output_file_name, ".res" );
if ((fd = open( res_file, O_WRONLY|O_CREAT|O_TRUNC, 0600 )) == -1)
fatal_error( "Cannot create %s\n", res_file );
}
if (write( fd, data, total_size ) != total_size)
fatal_error( "Error writing to %s\n", res_file );
close( fd );
free( data );
prog = get_windres_command();
cmd = xmalloc( strlen(prog) + strlen(res_file) + strlen(output_file_name) + 9 );
sprintf( cmd, "%s -i %s -o %s", prog, res_file, output_file_name );
if (verbose) fprintf( stderr, "%s\n", cmd );
err = system( cmd );
if (err) fatal_error( "%s failed with status %d\n", prog, err );
free( cmd );
if (res_file)
{
const char *prog = get_windres_command();
char *cmd = xmalloc( strlen(prog) + strlen(res_file) + strlen(output_file_name) + 9 );
sprintf( cmd, "%s -i %s -o %s", prog, res_file, output_file_name );
if (verbose) fprintf( stderr, "%s\n", cmd );
err = system( cmd );
if (err) fatal_error( "%s failed with status %d\n", prog, err );
free( cmd );
}
output_file_name = NULL; /* so we don't try to assemble it */
}
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