$OpenBSD: patch-setup_py,v 1.5 2021/11/15 20:02:44 rsadowski Exp $

remove -O3 and -march=native optimizations
fix man directory
disable wayland

Index: setup.py
--- setup.py.orig
+++ setup.py
@@ -293,7 +293,6 @@ def init_env(
         df += ' -Og'
         float_conversion = '-Wfloat-conversion'
     fortify_source = '' if sanitize and is_macos else '-D_FORTIFY_SOURCE=2'
-    optimize = df if debug or sanitize else '-O3'
     sanitize_args = get_sanitize_args(cc, ccver) if sanitize else set()
     cppflags_ = os.environ.get(
         'OVERRIDE_CPPFLAGS', '-D{}DEBUG'.format('' if debug else 'N'),
@@ -304,12 +303,11 @@ def init_env(
     werror = '' if ignore_compiler_warnings else '-pedantic-errors -Werror'
     std = '' if is_openbsd else '-std=c11'
     sanitize_flag = ' '.join(sanitize_args)
-    march = '-march=native' if native_optimizations else ''
     cflags_ = os.environ.get(
         'OVERRIDE_CFLAGS', (
             f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {std}'
-            f' {werror} {optimize} {sanitize_flag} -fwrapv {stack_protector} {missing_braces}'
-            f' -pipe {march} -fvisibility=hidden {fortify_source}'
+            f' {werror} {sanitize_flag} -fwrapv {stack_protector} {missing_braces}'
+            f' -pipe -fvisibility=hidden {fortify_source}'
         )
     )
     cflags = shlex.split(cflags_) + shlex.split(
@@ -317,7 +315,7 @@ def init_env(
     )
     ldflags_ = os.environ.get(
         'OVERRIDE_LDFLAGS',
-        '-Wall ' + ' '.join(sanitize_args) + ('' if debug else ' -O3')
+        '-Wall ' + ' '.join(sanitize_args)
     )
     ldflags = shlex.split(ldflags_)
     ldflags.append('-shared')
@@ -700,7 +698,7 @@ def find_c_files() -> Tuple[List[str], List[str]]:
 
 
 def compile_glfw(compilation_database: CompilationDatabase) -> None:
-    modules = 'cocoa' if is_macos else 'x11 wayland'
+    modules = 'cocoa' if is_macos else 'x11'
     for module in modules.split():
         try:
             genv = glfw.init_env(env, pkg_config, pkg_version, at_least_version, test_compile, module)
@@ -805,8 +803,6 @@ def build_launcher(args: Options, launcher_dir: str = 
             cflags.append('-g')
         if args.profile:
             libs.append('-lprofiler')
-    else:
-        cflags.append('-O3')
     if bundle_type.endswith('-freeze'):
         cppflags.append('-DFOR_BUNDLE')
         cppflags.append('-DPYVER="{}"'.format(sysconfig.get_python_version()))
@@ -845,7 +841,7 @@ def build_launcher(args: Options, launcher_dir: str = 
 
 
 def copy_man_pages(ddir: str) -> None:
-    mandir = os.path.join(ddir, 'share', 'man')
+    mandir = os.path.join(ddir, 'man')
     safe_makedirs(mandir)
     man_levels = '15'
     with suppress(FileNotFoundError):
