Alexandre Julliard : winebuild: Add possibility to generate a global resource file without running it through windres .
Alexandre Julliard
julliard at winehq.org
Mon Jun 22 09:04:13 CDT 2009
Module: wine
Branch: master
Commit: 6cf96bf9400c320a77581066abb698b32f683d98
URL: http://source.winehq.org/git/wine.git/?a=commit;h=6cf96bf9400c320a77581066abb698b32f683d98
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Jun 22 11:46:33 2009 +0200
winebuild: Add possibility to generate a global resource file without running it through windres.
---
tools/winebuild/main.c | 2 +-
tools/winebuild/res32.c | 35 +++++++++++++++++++++++------------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 9419231..77cfc45 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -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";
diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c
index ed902bb..93d9c3c 100644
--- a/tools/winebuild/res32.c
+++ b/tools/winebuild/res32.c
@@ -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 */
}
More information about the wine-cvs
mailing list