[Mesa-dev] [PATCH v2 1/4] meson: fix BSD build

Eric Engestrom eric.engestrom at imgtec.com
Fri Jan 19 13:30:07 UTC 2018


On Wednesday, 2018-01-17 23:54:15 +0300, Greg V wrote:
> Reviewed-by: Dylan Baker <dylan at pnwbakers.com>

A couple questions and a nit-pick for the error messages, but with that:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

> ---
>  meson.build | 44 +++++++++++++++++++++++---------------------
>  1 file changed, 23 insertions(+), 21 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index f3179c3806..32cd5dffa4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -202,18 +202,20 @@ if with_dri_i915 or with_gallium_i915
>    dep_libdrm_intel = dependency('libdrm_intel', version : '>= 2.4.75')
>  endif
>  
> +system_has_kms_drm = ['openbsd', 'netbsd', 'freebsd', 'dragonfly', 'linux'].contains(host_machine.system())
> +
>  if host_machine.system() == 'darwin'
>    with_dri_platform = 'apple'
>  elif ['windows', 'cygwin'].contains(host_machine.system())
>    with_dri_platform = 'windows'
> -elif host_machine.system() == 'linux'
> -  # FIXME: This should include BSD and possibly other systems
> +elif system_has_kms_drm
>    with_dri_platform = 'drm'
>  else
>    # FIXME: haiku doesn't use dri, and xlib doesn't use dri, probably should
>    # assert here that one of those cases has been met.
>    # FIXME: GNU (hurd) ends up here as well, but meson doesn't officially
>    # support Hurd at time of writing (2017/11)
> +  # FIXME: illumos ends up here as well
>    with_dri_platform = 'none'
>  endif
>  
> @@ -225,7 +227,7 @@ with_platform_surfaceless = false
>  egl_native_platform = ''
>  _platforms = get_option('platforms')
>  if _platforms == 'auto'
> -  if ['linux'].contains(host_machine.system())
> +  if system_has_kms_drm
>      _platforms = 'x11,wayland,drm,surfaceless'

Are we sure we want all those on *BSD?

>    else
>      error('Unknown OS, no platforms enabled. Patches gladly accepted to fix this.')
> @@ -272,9 +274,9 @@ endif
>  
>  with_gbm = get_option('gbm')
>  if with_gbm == 'auto' and with_dri  # TODO: or gallium
> -  with_gbm = host_machine.system() == 'linux'
> +  with_gbm = system_has_kms_drm
>  elif with_gbm == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('GBM only supports unix-like platforms')

Change the error message to something like this?
  GBM only supports DRM/KMS OSs

>    endif
>    with_gbm = true
> @@ -351,7 +353,7 @@ endif
>  with_dri2 = (with_dri or with_any_vk) and with_dri_platform == 'drm'
>  with_dri3 = get_option('dri3')
>  if with_dri3 == 'auto'
> -  if host_machine.system() == 'linux' and with_dri2
> +  if system_has_kms_drm and with_dri2
>      with_dri3 = true
>    else
>      with_dri3 = false
> @@ -374,7 +376,7 @@ endif
>  dep_vdpau = []
>  _vdpau = get_option('gallium-vdpau')
>  if _vdpau == 'auto'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      with_gallium_vdpau = false
>    elif not with_platform_x11
>      with_gallium_vdpau = false
> @@ -386,7 +388,7 @@ if _vdpau == 'auto'
>      with_gallium_vdpau = dep_vdpau.found()
>    endif
>  elif _vdpau == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('VDPAU state tracker can only be build on unix-like OSes.')

ditto, s,unix-like,DRM/KMS,

>    elif not with_platform_x11
>      error('VDPAU state tracker requires X11 support.')
> @@ -417,7 +419,7 @@ endif
>  dep_xvmc = []
>  _xvmc = get_option('gallium-xvmc')
>  if _xvmc == 'auto'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      with_gallium_xvmc = false
>    elif not with_platform_x11
>      with_gallium_xvmc = false
> @@ -428,7 +430,7 @@ if _xvmc == 'auto'
>      with_gallium_xvmc = dep_xvmc.found()
>    endif
>  elif _xvmc == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('XVMC state tracker can only be build on unix-like OSes.')

ditto

>    elif not with_platform_x11
>      error('XVMC state tracker requires X11 support.')
> @@ -455,7 +457,7 @@ endif
>  dep_omx = []
>  _omx = get_option('gallium-omx')
>  if _omx == 'auto'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      with_gallium_omx = false
>    elif not with_platform_x11
>      with_gallium_omx = false
> @@ -466,7 +468,7 @@ if _omx == 'auto'
>      with_gallium_omx = dep_omx.found()
>    endif
>  elif _omx == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('OMX state tracker can only be built on unix-like OSes.')

ditto

>    elif not (with_platform_x11 or with_platform_drm)
>      error('OMX state tracker requires X11 or drm platform support.')
> @@ -513,7 +515,7 @@ endif
>  dep_va = []
>  _va = get_option('gallium-va')
>  if _va == 'auto'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      with_gallium_va = false
>    elif not with_platform_x11
>      with_gallium_va = false
> @@ -524,7 +526,7 @@ if _va == 'auto'
>      with_gallium_va = dep_va.found()
>    endif
>  elif _va == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('VA state tracker can only be built on unix-like OSes.')

ditto

>    elif not (with_platform_x11 or with_platform_drm)
>      error('VA state tracker requires X11 or drm or wayland platform support.')
> @@ -550,7 +552,7 @@ endif
>  
>  _xa = get_option('gallium-xa')
>  if _xa == 'auto'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      with_gallium_xa = false
>    elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915
>              or with_gallium_svga)
> @@ -559,7 +561,7 @@ if _xa == 'auto'
>      with_gallium_xa = true
>    endif
>  elif _xa == 'true'
> -  if not ['linux', 'bsd'].contains(host_machine.system())
> +  if not system_has_kms_drm
>      error('XA state tracker can only be built on unix-like OSes.')

ditto

>    elif not (with_gallium_nouveau or with_gallium_freedreno or with_gallium_i915
>              or with_gallium_svga)
> @@ -711,7 +713,7 @@ if cc.compiles('int foo(void) __attribute__((__noreturn__));',
>  endif
>  
>  # TODO: this is very incomplete
> -if ['linux', 'cygwin'].contains(host_machine.system())
> +if system_has_kms_drm or host_machine.system() == 'cygwin'
>    pre_args += '-D_GNU_SOURCE'

Do *BSD use _GNU_SOURCE ?

>  endif
>  
> @@ -820,23 +822,23 @@ with_asm_arch = ''
>  if with_asm
>    # TODO: SPARC and PPC
>    if host_machine.cpu_family() == 'x86'
> -    if ['linux', 'bsd'].contains(host_machine.system()) # FIXME: hurd?
> +    if system_has_kms_drm
>        with_asm_arch = 'x86'
>        pre_args += ['-DUSE_X86_ASM', '-DUSE_MMX_ASM', '-DUSE_3DNOW_ASM',
>                     '-DUSE_SSE_ASM']
>      endif
>    elif host_machine.cpu_family() == 'x86_64'
> -    if host_machine.system() == 'linux'
> +    if system_has_kms_drm
>        with_asm_arch = 'x86_64'
>        pre_args += ['-DUSE_X86_64_ASM']
>      endif
>    elif host_machine.cpu_family() == 'arm'
> -    if host_machine.system() == 'linux'
> +    if system_has_kms_drm
>        with_asm_arch = 'arm'
>        pre_args += ['-DUSE_ARM_ASM']
>      endif
>    elif host_machine.cpu_family() == 'aarch64'
> -    if host_machine.system() == 'linux'
> +    if system_has_kms_drm
>        with_asm_arch = 'aarch64'
>        pre_args += ['-DUSE_AARCH64_ASM']
>      endif
> -- 
> 2.15.1
> 


More information about the mesa-dev mailing list