winegcc: Add --wine-objdir and --winebuild options for the Wine build.
This avoids overloading the meaning of the -B and --sysroot options. Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cb010cd6ec
commit
08956bc9bb
|
@ -2321,8 +2321,13 @@ static struct strarray get_source_defines( struct makefile *make, struct incl_fi
|
||||||
static void output_winegcc_command( struct makefile *make )
|
static void output_winegcc_command( struct makefile *make )
|
||||||
{
|
{
|
||||||
output( "\t%s -o $@", tools_path( make, "winegcc" ));
|
output( "\t%s -o $@", tools_path( make, "winegcc" ));
|
||||||
output_filename( strmake( "-B%s", tools_dir_path( make, "winebuild" )));
|
output_filename( "--wine-objdir" );
|
||||||
if (tools_dir) output_filename( strmake( "--sysroot=%s", top_obj_dir_path( make, "" )));
|
output_filename( top_obj_dir_path( make, "" ));
|
||||||
|
if (tools_dir)
|
||||||
|
{
|
||||||
|
output_filename( "--winebuild" );
|
||||||
|
output_filename( tools_path( make, "winebuild" ));
|
||||||
|
}
|
||||||
if (make->is_cross)
|
if (make->is_cross)
|
||||||
{
|
{
|
||||||
output_filename( "-b" );
|
output_filename( "-b" );
|
||||||
|
|
|
@ -210,6 +210,7 @@ struct options
|
||||||
int strip;
|
int strip;
|
||||||
int pic;
|
int pic;
|
||||||
const char* wine_objdir;
|
const char* wine_objdir;
|
||||||
|
const char* winebuild;
|
||||||
const char* output_name;
|
const char* output_name;
|
||||||
const char* image_base;
|
const char* image_base;
|
||||||
const char* section_align;
|
const char* section_align;
|
||||||
|
@ -845,11 +846,17 @@ static const char* compile_to_object(struct options* opts, const char* file, con
|
||||||
static strarray *get_winebuild_args(struct options *opts)
|
static strarray *get_winebuild_args(struct options *opts)
|
||||||
{
|
{
|
||||||
const char* winebuild = getenv("WINEBUILD");
|
const char* winebuild = getenv("WINEBUILD");
|
||||||
|
const char *binary = NULL;
|
||||||
strarray *spec_args = strarray_alloc();
|
strarray *spec_args = strarray_alloc();
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
if (!winebuild) winebuild = "winebuild";
|
if (opts->winebuild)
|
||||||
strarray_add( spec_args, find_binary( opts->prefix, winebuild ));
|
binary = opts->winebuild;
|
||||||
|
else if (opts->wine_objdir)
|
||||||
|
binary = strmake( "%s/tools/winebuild/winebuild%s", opts->wine_objdir, EXEEXT );
|
||||||
|
else
|
||||||
|
binary = find_binary( opts->prefix, winebuild ? winebuild : "winebuild" );
|
||||||
|
strarray_add( spec_args, binary );
|
||||||
if (verbose) strarray_add( spec_args, "-v" );
|
if (verbose) strarray_add( spec_args, "-v" );
|
||||||
if (keep_generated) strarray_add( spec_args, "--save-temps" );
|
if (keep_generated) strarray_add( spec_args, "--save-temps" );
|
||||||
if (opts->target)
|
if (opts->target)
|
||||||
|
@ -860,10 +867,7 @@ static strarray *get_winebuild_args(struct options *opts)
|
||||||
if (opts->prefix)
|
if (opts->prefix)
|
||||||
{
|
{
|
||||||
for (i = 0; i < opts->prefix->size; i++)
|
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] ));
|
strarray_add( spec_args, strmake( "-B%s", opts->prefix->base[i] ));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!opts->use_msvcrt) strarray_add( spec_args, "-munix" );
|
if (!opts->use_msvcrt) strarray_add( spec_args, "-munix" );
|
||||||
if (opts->unwind_tables) strarray_add( spec_args, "-fasynchronous-unwind-tables" );
|
if (opts->unwind_tables) strarray_add( spec_args, "-fasynchronous-unwind-tables" );
|
||||||
|
@ -1352,6 +1356,22 @@ static void parse_target_option( struct options *opts, const char *target )
|
||||||
opts->target = xstrdup( target );
|
opts->target = xstrdup( target );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int is_option( char **argv, int i, const char *option, const char **option_arg )
|
||||||
|
{
|
||||||
|
if (!strcmp( argv[i], option ))
|
||||||
|
{
|
||||||
|
if (!argv[i + 1]) error( "option %s requires an argument\n", argv[i] );
|
||||||
|
*option_arg = argv[i + 1];
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if (!strncmp( argv[i], option, strlen(option) ) && argv[i][strlen(option)] == '=')
|
||||||
|
{
|
||||||
|
*option_arg = argv[i] + strlen(option) + 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, c, next_is_arg = 0, linking = 1;
|
int i, c, next_is_arg = 0, linking = 1;
|
||||||
|
@ -1438,6 +1458,8 @@ int main(int argc, char **argv)
|
||||||
next_is_arg = (strcmp("--param", argv[i]) == 0 ||
|
next_is_arg = (strcmp("--param", argv[i]) == 0 ||
|
||||||
strcmp("--sysroot", argv[i]) == 0 ||
|
strcmp("--sysroot", argv[i]) == 0 ||
|
||||||
strcmp("--target", argv[i]) == 0 ||
|
strcmp("--target", argv[i]) == 0 ||
|
||||||
|
strcmp("--wine-objdir", argv[i]) == 0 ||
|
||||||
|
strcmp("--winebuild", argv[i]) == 0 ||
|
||||||
strcmp("--lib-suffix", argv[i]) == 0);
|
strcmp("--lib-suffix", argv[i]) == 0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1474,19 +1496,6 @@ int main(int argc, char **argv)
|
||||||
case 'B':
|
case 'B':
|
||||||
str = strdup(option_arg);
|
str = strdup(option_arg);
|
||||||
if (strendswith(str, "/")) str[strlen(str) - 1] = 0;
|
if (strendswith(str, "/")) str[strlen(str) - 1] = 0;
|
||||||
if (strendswith(str, "/tools/winebuild"))
|
|
||||||
{
|
|
||||||
char *objdir = strdup(str);
|
|
||||||
objdir[strlen(objdir) - sizeof("/tools/winebuild") + 1] = 0;
|
|
||||||
opts.wine_objdir = objdir;
|
|
||||||
/* don't pass it to the compiler, this generates warnings */
|
|
||||||
raw_compiler_arg = raw_linker_arg = 0;
|
|
||||||
}
|
|
||||||
else if (!strcmp(str, "tools/winebuild"))
|
|
||||||
{
|
|
||||||
opts.wine_objdir = ".";
|
|
||||||
raw_compiler_arg = raw_linker_arg = 0;
|
|
||||||
}
|
|
||||||
if (!opts.prefix) opts.prefix = strarray_alloc();
|
if (!opts.prefix) opts.prefix = strarray_alloc();
|
||||||
strarray_add(opts.prefix, str);
|
strarray_add(opts.prefix, str);
|
||||||
break;
|
break;
|
||||||
|
@ -1659,22 +1668,26 @@ int main(int argc, char **argv)
|
||||||
case '-':
|
case '-':
|
||||||
if (strcmp("-static", argv[i]+1) == 0)
|
if (strcmp("-static", argv[i]+1) == 0)
|
||||||
linking = -1;
|
linking = -1;
|
||||||
else if (!strncmp("--sysroot", argv[i], 9))
|
else if (is_option( argv, i, "--sysroot", &option_arg ))
|
||||||
|
opts.sysroot = option_arg;
|
||||||
|
else if (is_option( argv, i, "--target", &option_arg ))
|
||||||
{
|
{
|
||||||
if (argv[i][9] == '=') opts.sysroot = argv[i] + 10;
|
parse_target_option( &opts, option_arg );
|
||||||
else opts.sysroot = argv[i + 1];
|
|
||||||
if (opts.wine_objdir) raw_compiler_arg = raw_linker_arg = 0;
|
|
||||||
}
|
|
||||||
else if (!strncmp("--target", argv[i], 8))
|
|
||||||
{
|
|
||||||
if (argv[i][8] == '=') parse_target_option( &opts, argv[i] + 9 );
|
|
||||||
else parse_target_option( &opts, argv[i + 1] );
|
|
||||||
raw_compiler_arg = raw_linker_arg = 0;
|
raw_compiler_arg = raw_linker_arg = 0;
|
||||||
}
|
}
|
||||||
else if (!strncmp("--lib-suffix", argv[i], 12) && opts.wine_objdir)
|
else if (is_option( argv, i, "--wine-objdir", &option_arg ))
|
||||||
{
|
{
|
||||||
if (argv[i][12] == '=') opts.lib_suffix = argv[i] + 13;
|
opts.wine_objdir = option_arg;
|
||||||
else opts.lib_suffix = argv[i + 1];
|
raw_compiler_arg = raw_linker_arg = 0;
|
||||||
|
}
|
||||||
|
else if (is_option( argv, i, "--winebuild", &option_arg ))
|
||||||
|
{
|
||||||
|
opts.winebuild = option_arg;
|
||||||
|
raw_compiler_arg = raw_linker_arg = 0;
|
||||||
|
}
|
||||||
|
else if (is_option( argv, i, "--lib-suffix", &option_arg ))
|
||||||
|
{
|
||||||
|
opts.lib_suffix = option_arg;
|
||||||
raw_compiler_arg = raw_linker_arg = 0;
|
raw_compiler_arg = raw_linker_arg = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1703,7 +1716,6 @@ int main(int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opts.wine_objdir && opts.sysroot) opts.wine_objdir = opts.sysroot;
|
|
||||||
if (opts.processor == proc_cpp) linking = 0;
|
if (opts.processor == proc_cpp) linking = 0;
|
||||||
if (linking == -1) error("Static linking is not supported\n");
|
if (linking == -1) error("Static linking is not supported\n");
|
||||||
|
|
||||||
|
|
|
@ -26,18 +26,17 @@ the gcc manual for more information on those options.
|
||||||
.B gcc options:
|
.B gcc options:
|
||||||
All gcc options are supported, and are passed along to the backend
|
All gcc options are supported, and are passed along to the backend
|
||||||
compiler.
|
compiler.
|
||||||
.IP "\fB-B\fIprefix\fR"
|
|
||||||
This option specifies where to find the executables, libraries,
|
|
||||||
include files, and data files of the compiler itself. This is a
|
|
||||||
standard gcc option that has been extended to recognize a
|
|
||||||
\fIprefix\fR ending with '/tools/winebuild', in which case winegcc
|
|
||||||
enters a special mode for building Wine itself. Developers should
|
|
||||||
avoid prefixes ending with the magic suffix, or if that is not
|
|
||||||
possible, simply express it differently, such as '/tools/winebuild/',
|
|
||||||
to avoid the special behaviour.
|
|
||||||
.IP "\fB-b,--target \fItarget\fR"
|
.IP "\fB-b,--target \fItarget\fR"
|
||||||
Specify the target architecture triplet for cross-compiling. winegcc
|
Specify the target architecture triplet for cross-compiling. winegcc
|
||||||
will then invoke \fItarget\fR-gcc instead of gcc.
|
will then invoke \fItarget\fR-gcc instead of gcc.
|
||||||
|
.IP "\fB--wine-objdir \fIdir\fR"
|
||||||
|
Specify the Wine object directory. This is used when building Wine
|
||||||
|
itself, to use the includes and libraries from inside the build tree.
|
||||||
|
.IP "\fB--winebuild \fIname\fR"
|
||||||
|
Specifies the path and name of the \fBwinebuild\fR binary that will be
|
||||||
|
launched automatically by \fBwinegcc\fR. If not set, \fBwinegcc\fR
|
||||||
|
will look for a file named \fIwinebuild\fR in the path. This takes
|
||||||
|
precedence over the \fBWINEBUILD\fR environment variable.
|
||||||
.IP \fB-fno-short-wchar\fR
|
.IP \fB-fno-short-wchar\fR
|
||||||
Override the underlying type for wchar_t to be the default for the
|
Override the underlying type for wchar_t to be the default for the
|
||||||
target, instead of using short unsigned int, which is the default
|
target, instead of using short unsigned int, which is the default
|
||||||
|
@ -74,9 +73,8 @@ commas, it is split into multiple options at the commas.
|
||||||
.TP
|
.TP
|
||||||
.B WINEBUILD
|
.B WINEBUILD
|
||||||
Specifies the path and name of the \fBwinebuild\fR binary that will be
|
Specifies the path and name of the \fBwinebuild\fR binary that will be
|
||||||
launched automatically by \fBwinegcc\fR.
|
launched automatically by \fBwinegcc\fR. If not set, \fBwinegcc\fR
|
||||||
If not set, \fBwinegcc\fR will look for a file named \fIwinebuild\fR
|
will look for a file named \fIwinebuild\fR in the path.
|
||||||
in the path.
|
|
||||||
.SH DEFINES
|
.SH DEFINES
|
||||||
winegcc defines __WINE__, for code that needs to know when it is
|
winegcc defines __WINE__, for code that needs to know when it is
|
||||||
being compiled under Wine. It also defines WIN32, _WIN32, __WIN32,
|
being compiled under Wine. It also defines WIN32, _WIN32, __WIN32,
|
||||||
|
|
Loading…
Reference in New Issue