Running cross-compiled binaries may be possible, but the runtime environment must be configured correctly. In some configurations, an exe_wrapper needs to be used, and in all cases, the library path must be set correctly for the given binary. Fortunately, Meson handles all of this if cross-compilation is configured correctly. Fix this by having Meson run the mpv binary directly, instead of as a subprocess of a Python script. This ensures that the environment is properly set for running host binaries, if possible.
Unified · Split
| @@ -21,7 +21,6 @@ · 20 unmodified lines | |||
| 21 | # | 21 | # |
| 22 | 22 | ||
| 23 | import sys | 23 | import sys |
| 24 | from subprocess import check_output | ||
| 25 | 24 | ||
| 26 | if __name__ == "__main__": | 25 | if __name__ == "__main__": |
| 27 | with open(sys.argv[1], encoding="UTF-8") as f: | 26 | with open(sys.argv[1], encoding="UTF-8") as f: |
| @@ -31,15 +30,13 @@ if __name__ == "__main__": · 3 unmodified lines | |||
| 31 | if not mpv_desktop["X-KDE-Protocols"]: | 30 | if not mpv_desktop["X-KDE-Protocols"]: |
| 32 | raise ValueError("Missing X-KDE-Protocols entry in mpv.desktop file") | 31 | raise ValueError("Missing X-KDE-Protocols entry in mpv.desktop file") |
| 33 | 32 | ||
| 34 | mpv_protocols = check_output( | 33 | with open(sys.argv[2], encoding="UTF-8") as mpv_protocols: |
| 35 | [sys.argv[2], "--no-config", "--list-protocols"], | 34 | mpv_protocols = { |
| 36 | encoding="UTF-8", | 35 | line.strip(" :/") |
| 37 | ) | 36 | for line in mpv_protocols.read().splitlines() |
| 38 | mpv_protocols = { | 37 | if "://" in line |
| 39 | line.strip(" :/") | 38 | } |
| 40 | for line in mpv_protocols.splitlines() | 39 | |
| 41 | if "://" in line | ||
| 42 | } | ||
| 43 | if len(mpv_protocols) == 0: | 40 | if len(mpv_protocols) == 0: |
| 44 | raise ValueError("Unable to parse any protocols from mpv '--list-protocols'") | 41 | raise ValueError("Unable to parse any protocols from mpv '--list-protocols'") |
| 45 | 42 | ||
| @@ -1815,11 +1815,16 @@ if get_option('cplayer') · 1814 unmodified lines | |||
| 1815 | 1815 | ||
| 1816 | if not win32 and not darwin | 1816 | if not win32 and not darwin |
| 1817 | if meson.can_run_host_binaries() | 1817 | if meson.can_run_host_binaries() |
| 1818 | mpv_protocols = custom_target('mpv_protocols', | ||
| 1819 | output: 'mpv_protocols', | ||
| 1820 | command: [mpv, '--no-config','--list-protocols'], | ||
| 1821 | capture: true, | ||
| 1822 | ) | ||
| 1818 | mpv_desktop_path = join_paths(source_root, 'etc', 'mpv.desktop') | 1823 | mpv_desktop_path = join_paths(source_root, 'etc', 'mpv.desktop') |
| 1819 | custom_target('mpv.desktop', | 1824 | custom_target('mpv.desktop', |
| 1820 | depends: mpv, | 1825 | input: mpv_protocols, |
| 1821 | output: 'mpv.desktop', | 1826 | output: 'mpv.desktop', |
| 1822 | command: [mpv_desktop, mpv_desktop_path, mpv.full_path(), '@OUTPUT@'], | 1827 | command: [mpv_desktop, mpv_desktop_path, '@INPUT@', '@OUTPUT@'], |
| 1823 | install: true, | 1828 | install: true, |
| 1824 | install_dir: join_paths(datadir, 'applications'), | 1829 | install_dir: join_paths(datadir, 'applications'), |
| 1825 | ) | 1830 | ) |