$OpenBSD: patch-meson_build,v 1.2 2021/09/03 23:04:49 sthen Exp $

- Fix curses build on OpenBSD
- sndio module
- Remove hardcoding of optimization

Index: meson.build
--- meson.build.orig
+++ meson.build
@@ -441,6 +441,11 @@ jack = not_found
 if 'CONFIG_LIBJACK' in config_host
   jack = declare_dependency(link_args: config_host['JACK_LIBS'].split())
 endif
+sndio = not_found
+if 'CONFIG_SNDIO' in config_host
+  sndio = declare_dependency(compile_args: config_host['SNDIO_CFLAGS'].split(),
+                             link_args: config_host['SNDIO_LIBS'].split())
+endif
 spice = not_found
 spice_headers = not_found
 spice_protocol = not_found
@@ -596,7 +601,7 @@ if have_system and not get_option('curses').disabled()
     endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
-  curses_compile_args = ['-DNCURSES_WIDECHAR']
+  curses_compile_args = ['-D_XOPEN_SOURCE_EXTENDED -DNCURSES_WIDECHAR']
   if curses.found()
     if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
       curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
@@ -2907,11 +2912,9 @@ if targetos == 'windows'
   endif
 endif
 summary_info += {'CFLAGS':            ' '.join(get_option('c_args')
-                                               + ['-O' + get_option('optimization')]
                                                + (get_option('debug') ? ['-g'] : []))}
 if link_language == 'cpp'
   summary_info += {'CXXFLAGS':        ' '.join(get_option('cpp_args')
-                                               + ['-O' + get_option('optimization')]
                                                + (get_option('debug') ? ['-g'] : []))}
 endif
 link_args = get_option(link_language + '_link_args')
