Changeset View
Changeset View
Standalone View
Standalone View
head/graphics/mesa-dri/files/patch-meson.build
- Do not define GLX_USE_TLS, this doesn't work on all FreeBSD version | --- meson.build.orig 2020-10-06 07:15:26 UTC | ||||
Later mesa version rename this to USE_ELF_TLS and make it conditional | |||||
on some platform, but for now simply comment it here. | |||||
See https://github.com/dumbbell/test-tls-initial-exec for more info | |||||
- Add dependency on libxv for xvmc, this is fixed in later mesa version. | |||||
- Define _GNU_SOURCE on FreeBSD, adapted from | |||||
https://gitlab.freedesktop.org/mesa/mesa/commit/b4f508ab5990 | |||||
- sys/sysctl.h needs sys/types.h to be properly detected, adapted from | |||||
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5462/diffs | |||||
--- meson.build.orig 2020-06-14 07:52:34 UTC | |||||
+++ meson.build | +++ meson.build | ||||
@@ -25,7 +25,7 @@ project( | @@ -1108,9 +1108,9 @@ else | ||||
[find_program('python', 'python2', 'python3'), 'bin/meson_get_version.py'] | |||||
).stdout(), | |||||
license : 'MIT', | |||||
- meson_version : '>= 0.45', | |||||
+ meson_version : '>= 0.46', | |||||
default_options : ['buildtype=debugoptimized', 'b_ndebug=if-release', 'c_std=c99', 'cpp_std=c++11'] | |||||
) | |||||
@@ -336,7 +336,7 @@ if with_egl and not (with_platform_drm or with_platfor | |||||
endif | endif | ||||
endif | |||||
-pre_args += '-DGLX_USE_TLS' | # Check for GCC style atomics | ||||
+#pre_args += '-DGLX_USE_TLS' | -dep_atomic = null_dep | ||||
if with_glx != 'disabled' | +dep_atomic = cc.find_library('atomic', required : false) | ||||
if not (with_platform_x11 and with_any_opengl) | |||||
error('Cannot build GLX support without X11 platform support and at least one OpenGL API') | |||||
@@ -458,7 +458,8 @@ dep_xvmc = null_dep | |||||
with_gallium_xvmc = false | |||||
if _xvmc != 'false' | |||||
dep_xvmc = dependency('xvmc', version : '>= 1.0.6', required : _xvmc == 'true') | |||||
- with_gallium_xvmc = dep_xvmc.found() | |||||
+ dep_xv = dependency('xv', required: _xvmc == 'true') | |||||
+ with_gallium_xvmc = dep_xvmc.found() and dep_xv.found() | |||||
endif | |||||
xvmc_drivers_path = get_option('xvmc-libs-path') | -if cc.compiles('''#include <stdint.h> | ||||
@@ -792,7 +793,7 @@ if cc.compiles('int foo(void) __attribute__((__noretur | +if cc.links('''#include <stdint.h> | ||||
endif | int main() { | ||||
struct { | |||||
uint64_t *v; | |||||
@@ -1119,26 +1119,9 @@ if cc.compiles('''#include <stdint.h> | |||||
(int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); | |||||
# TODO: this is very incomplete | }''', | ||||
-if ['linux', 'cygwin', 'gnu'].contains(host_machine.system()) | + dependencies : dep_atomic, | ||||
+if ['linux', 'cygwin', 'gnu', 'freebsd', 'gnu/kfreebsd'].contains(host_machine.system()) | name : 'GCC atomic builtins') | ||||
pre_args += '-D_GNU_SOURCE' | pre_args += '-DUSE_GCC_ATOMIC_BUILTINS' | ||||
- | |||||
- # Not all atomic calls can be turned into lock-free instructions, in which | |||||
- # GCC will make calls into the libatomic library. Check whether we need to | |||||
- # link with -latomic. | |||||
- # | |||||
- # This can happen for 64-bit atomic operations on 32-bit architectures such | |||||
- # as ARM. | |||||
- if not cc.links('''#include <stdint.h> | |||||
- int main() { | |||||
- struct { | |||||
- uint64_t *v; | |||||
- } x; | |||||
- return (int)__atomic_load_n(x.v, __ATOMIC_ACQUIRE) & | |||||
- (int)__atomic_add_fetch(x.v, (uint64_t)1, __ATOMIC_ACQ_REL); | |||||
- }''', | |||||
- name : 'GCC atomic builtins required -latomic') | |||||
- dep_atomic = cc.find_library('atomic') | |||||
- endif | |||||
endif | endif | ||||
if not cc.links('''#include <stdint.h> | |||||
@@ -977,7 +978,14 @@ elif cc.has_header_symbol('sys/mkdev.h', 'major') | uint64_t v; | ||||
pre_args += '-DMAJOR_IN_MKDEV' | |||||
endif | |||||
-foreach h : ['xlocale.h', 'sys/sysctl.h', 'linux/futex.h', 'endian.h', 'dlfcn.h'] | |||||
+if not ['linux'].contains(host_machine.system()) | |||||
+ # Deprecated on Linux and requires <sys/types.h> on FreeBSD and OpenBSD | |||||
+ if cc.check_header('sys/sysctl.h', prefix : '#include <sys/types.h>') | |||||
+ pre_args += '-DHAVE_SYS_SYSCTL_H' | |||||
+ endif | |||||
+endif | |||||
+ | |||||
+foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h'] | |||||
if cc.compiles('#include <@0@>'.format(h), name : '@0@'.format(h)) | |||||
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) | |||||
endif |