From: Brendan Shanks bshanks@codeweavers.com
--- tools/winebuild/utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 9f51a60c01f..dec11d5ce2c 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -229,6 +229,7 @@ struct strarray find_tool( const char *name, const char * const *names ) struct strarray ret = empty_strarray; const char *file; const char *alt_names[2]; + const char * const *orig_names;
if (!names) { @@ -236,6 +237,7 @@ struct strarray find_tool( const char *name, const char * const *names ) alt_names[1] = NULL; names = alt_names; } + orig_names = names;
while (*names) { @@ -253,6 +255,20 @@ struct strarray find_tool( const char *name, const char * const *names ) file = find_clang_tool( clang, strmake( "llvm-%s", name )); } } + + /* macOS does not prefix tools like ar and ranlib, search for + * them un-prefixed before failing. + */ + if (!file && target.platform == PLATFORM_APPLE) + { + names = orig_names; + while (*names) + { + if ((file = find_binary( NULL, *names ))) break; + names++; + } + } + if (!file) fatal_error( "cannot find the '%s' tool\n", name );
strarray_add( &ret, file );