[PATCH] winegcc: don't rely on PATH to find winebuild.

Alexandre Julliard julliard at winehq.org
Sat Nov 24 10:25:31 CST 2018


Andre Heider <a.heider at gmail.com> writes:

> On 23/11/2018 21:02, Alexandre Julliard wrote:
>> Andre Heider <a.heider at gmail.com> writes:
>>
>>> This also avoids mixing binaries of multiple WINE installations.
>>>
>>> Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=40245
>>> Signed-off-by: Andre Heider <a.heider at gmail.com>
>>> ---
>>>   tools/winegcc/Makefile.in | 1 +
>>>   tools/winegcc/winegcc.c   | 2 +-
>>>   2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> Using the path of winegcc from argv[0] may be a better choice.
>
> That may get too fragile, distros do some crazy stuff.
>
> On debian, winegcc looks like this:
>
> /usr/bin/winegcc -> /etc/alternatives/winegcc
> /etc/alternatives/winegcc -> /usr/bin/winegcc-stable
> cat /usr/bin/winegcc-stable
>> #!/bin/sh -e
>>
>> name=$(basename $0 | cut -d- -f1)
>>
>> # wineg++ fails to find winebuild in Wine's bindir
>> # See https://bugs.winehq.org/show_bug.cgi?id=40245
>> if test -z "$WINEBUILD"; then
>>     export WINEBUILD="/usr/lib/wine/winebuild"
>> fi
>>
>> exec /usr/lib/wine/$name $@
>
> winebuild is similar, just without the wrapper script.
>
> So there's `winegcc` using debian's alternatives system, but you can
> use `winegcc-stable` or `winegcc-development` too.
>
> Picturing a patch which works in those cases too won't win a beauty
> contest :)

Obviously it can't work in all cases, it just seems to me that it's more
likely to do the right thing. If winegcc is installed in bindir both are
equivalent, and if it's installed somewhere else, using bindir would be
worse. You could also try argv[0] first and then fall back to bindir.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list