qt: skip multimedia when ~opengl (#23989)

* qt: skip multimedia when ~opengl

On 5.9 on macOS the multimedia option causes build errors; on other
platforms and versions it should probably be assumed inoperative anyway.

* qt: Omit flags when disabling multimedia

```
ERROR: Unknown command line option '-no-pulseaudio'.
```

* Work around another qt@5.9 error

* qt: Fix build error on darwin
This commit is contained in:
Seth R. Johnson 2021-05-29 14:53:25 -04:00 committed by GitHub
parent 6f534acbef
commit 9936182f60
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -199,7 +199,7 @@ class Qt(Package):
conflicts('+framework', conflicts('+framework',
msg="QT cannot be built as a framework except on macOS.") msg="QT cannot be built as a framework except on macOS.")
else: else:
conflicts('platform=darwin', when='@4.8.6', conflicts('platform=darwin', when='@:4.8.6',
msg="QT 4 for macOS is only patched for 4.8.7") msg="QT 4 for macOS is only patched for 4.8.7")
use_xcode = True use_xcode = True
@ -413,6 +413,13 @@ def patch(self):
with open(conf_file, 'a') as f: with open(conf_file, 'a') as f:
f.write("QMAKE_CXXFLAGS += -std=gnu++98\n") f.write("QMAKE_CXXFLAGS += -std=gnu++98\n")
@when('@5.9 platform=darwin')
def patch(self):
# 'javascriptcore' is in the include path, so its file named 'version'
# interferes with the standard library
os.unlink(join_path(self.stage.source_path,
'qtscript/src/3rdparty/javascriptcore/version'))
@property @property
def common_config_args(self): def common_config_args(self):
spec = self.spec spec = self.spec
@ -575,13 +582,14 @@ def configure(self, spec, prefix):
]) ])
if MACOS_VERSION: if MACOS_VERSION:
config_args.extend([ if version < Version('5.9'):
'-no-xcb-xlib', config_args.append('-no-xcb-xlib')
'-no-pulseaudio',
'-no-alsa',
])
if version < Version('5.12'): if version < Version('5.12'):
config_args.append('-no-xinput2') config_args.append('-no-xinput2')
if spec.satisfies('@5.9'):
# Errors on bluetooth even when bluetooth is disabled...
# at least on apple-clang%12
config_args.extend(['-skip', 'connectivity'])
elif version < Version('5.15') and '+gui' in spec: elif version < Version('5.15') and '+gui' in spec:
# Linux-only QT5 dependencies # Linux-only QT5 dependencies
config_args.append('-system-xcb') config_args.append('-system-xcb')
@ -602,6 +610,7 @@ def configure(self, spec, prefix):
config_args.extend(['-skip', 'wayland']) config_args.extend(['-skip', 'wayland'])
if '~opengl' in spec: if '~opengl' in spec:
config_args.extend(['-skip', 'multimedia'])
if version >= Version('5.10'): if version >= Version('5.10'):
config_args.extend([ config_args.extend([
'-skip', 'webglplugin', '-skip', 'webglplugin',
@ -613,6 +622,14 @@ def configure(self, spec, prefix):
if version >= Version('5.15'): if version >= Version('5.15'):
config_args.extend(['-skip', 'qtlocation']) config_args.extend(['-skip', 'qtlocation'])
elif MACOS_VERSION:
# These options are only valid if 'multimedia' is enabled, i.e.
# +opengl is selected. Force them to be off on macOS, but let other
# platforms decide for themselves.
config_args.extend([
'-no-pulseaudio',
'-no-alsa',
])
configure(*config_args) configure(*config_args)