winegcc: Improve heuristics for -m32/-m64 options in get_lib_dir.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
3fa12ba3a5
commit
ce4dde3e9a
@ -448,8 +448,12 @@ static char *get_lib_dir( struct options *opts )
|
|||||||
{
|
{
|
||||||
static const char *stdlibpath[] = { LIBDIR, "/usr/lib", "/usr/local/lib", "/lib" };
|
static const char *stdlibpath[] = { LIBDIR, "/usr/lib", "/usr/local/lib", "/lib" };
|
||||||
static const char libwine[] = "/libwine.so";
|
static const char libwine[] = "/libwine.so";
|
||||||
|
const char *bit_suffix, *other_bit_suffix;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
|
bit_suffix = opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64 ? "64" : "32";
|
||||||
|
other_bit_suffix = opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64 ? "32" : "64";
|
||||||
|
|
||||||
for (i = 0; i < sizeof(stdlibpath)/sizeof(stdlibpath[0]); i++)
|
for (i = 0; i < sizeof(stdlibpath)/sizeof(stdlibpath[0]); i++)
|
||||||
{
|
{
|
||||||
char *p, *buffer = xmalloc( strlen(stdlibpath[i]) + strlen("/arm-linux-gnueabi") + strlen(libwine) + 1 );
|
char *p, *buffer = xmalloc( strlen(stdlibpath[i]) + strlen("/arm-linux-gnueabi") + strlen(libwine) + 1 );
|
||||||
@ -464,18 +468,9 @@ static char *get_lib_dir( struct options *opts )
|
|||||||
strcpy( p, libwine );
|
strcpy( p, libwine );
|
||||||
if (check_platform( opts, buffer )) goto found;
|
if (check_platform( opts, buffer )) goto found;
|
||||||
}
|
}
|
||||||
if (opts->target_cpu != CPU_x86_64 && opts->target_cpu != CPU_ARM64)
|
strcpy( p, bit_suffix );
|
||||||
{
|
strcat( p, libwine );
|
||||||
strcpy( p, "32" );
|
if (check_platform( opts, buffer )) goto found;
|
||||||
strcat( p, libwine );
|
|
||||||
if (check_platform( opts, buffer )) goto found;
|
|
||||||
}
|
|
||||||
if (opts->target_cpu == CPU_x86_64 || opts->target_cpu == CPU_ARM64)
|
|
||||||
{
|
|
||||||
strcpy( p, "64" );
|
|
||||||
strcat( p, libwine );
|
|
||||||
if (check_platform( opts, buffer )) goto found;
|
|
||||||
}
|
|
||||||
switch(opts->target_cpu)
|
switch(opts->target_cpu)
|
||||||
{
|
{
|
||||||
case CPU_x86: strcpy( p, "/i386-linux-gnu" ); break;
|
case CPU_x86: strcpy( p, "/i386-linux-gnu" ); break;
|
||||||
@ -488,6 +483,34 @@ static char *get_lib_dir( struct options *opts )
|
|||||||
}
|
}
|
||||||
strcat( p, libwine );
|
strcat( p, libwine );
|
||||||
if (check_platform( opts, buffer )) goto found;
|
if (check_platform( opts, buffer )) goto found;
|
||||||
|
|
||||||
|
strcpy( buffer, stdlibpath[i] );
|
||||||
|
p = buffer + strlen(buffer);
|
||||||
|
while (p > buffer && p[-1] == '/') p--;
|
||||||
|
strcpy( p, libwine );
|
||||||
|
|
||||||
|
/* try to fixup each parent dirs named lib, lib32 or lib64 with target bitness suffix */
|
||||||
|
while (p > buffer)
|
||||||
|
{
|
||||||
|
p--;
|
||||||
|
while (p > buffer && *p != '/') p--;
|
||||||
|
if (*p != '/') break;
|
||||||
|
if (memcmp( p + 1, "lib", 3 )) continue;
|
||||||
|
if (p[4] == '/')
|
||||||
|
{
|
||||||
|
memmove( p + 6, p + 4, strlen( p + 4 ) + 1 );
|
||||||
|
memcpy( p + 4, bit_suffix, 2 );
|
||||||
|
if (check_platform( opts, buffer )) goto found;
|
||||||
|
memmove( p + 4, p + 6, strlen( p + 6 ) + 1 );
|
||||||
|
}
|
||||||
|
else if (!memcmp( p + 4, other_bit_suffix, 2 ) && p[6] == '/')
|
||||||
|
{
|
||||||
|
memcpy( p + 4, bit_suffix, 2 );
|
||||||
|
if (check_platform( opts, buffer )) goto found;
|
||||||
|
memcpy( p + 4, other_bit_suffix, 2 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free( buffer );
|
free( buffer );
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user