mpv
mpv copied to clipboard
disable fork usage when building for tvOS
This fixes builds for tvOS which are currently broken because fork
is unavailable.
See https://github.com/mpv-player/mpv/issues/5331
Looks good but please make sure the commit message matches the contribution guidelines. Also I don't know if building for tvOS is possible with meson currently but you may want to make the change there too.
meson doesn't have a tvOS detection because it literally was unused in waf. I think when wm4 made some changes to subprocesses and all that he nuked all usage of the tvOS detection but never actually removed the option so it always just did nothing.
Anyways as for implementing this in meson, ideally you could just use host_machine.system()
like android does, but unfortunately, it looks like that will return darwin
for all apple OSes (macOS, iOS, or tvOS; see https://github.com/mesonbuild/meson/issues/6361 and https://github.com/mesonbuild/meson/issues/7944). So you'll just have to use the same kind of custom check like waf currently use.
@rcombs' version might be cleaner:
https://github.com/plexinc/mpv/commit/0c17d248116fc8647a1638e059f6e07bb238c8fd
cc https://github.com/mpv-player/mpv/issues/9171#issuecomment-981809660
@Dudemanguy host_machine.system()
is not really the proper way to do this tbh, it is kind of a mistake people started to use it for iOS imho which results in a quite messed up situation that some projects expect it to be darwin
and some expect ios
in there. Hopefully eventually this will be properly cleaned up with API changes in meson to handle it properly…
For now the best way to do this is manually by leveraging TargetConditionals.h
:
#include <TargetConditionals.h>
#if TARGET_OS_TV
// Compiling for tvOS
#endif
so in meson you could do:
if host_machine.system() == 'darwin'
# Check if compiling for iOS
have_ios = cc.get_define('TARGET_OS_IPHONE',
prefix: '#include <TargetConditionals.h>') == '1'
# Check if compiling for tvOS
have_tvos = cc.get_define('TARGET_OS_TV',
prefix: '#include <TargetConditionals.h>') == '1'
# If none of the above, assume compiling for macOS
have_osx = not have_ios and not have_tvos
else
have_ios = false
have_tvos = false
have_osx = false
endif
host_machine.system() is not really the proper way to do this tbh
That's why I said "ideally".