- remove hardcoded -O2, found by bcallah@
- add sndio
- enable joydev
- disable template binaries (requires GNU ld but is broken on GCC-arches)

Index: platform/x11/detect.py
--- platform/x11/detect.py.orig
+++ platform/x11/detect.py
@@ -90,29 +90,6 @@ def get_flags():
 def configure(env):
     ## Build type
 
-    if env["target"] == "release":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O3"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "release_debug":
-        if env["optimize"] == "speed":  # optimize for speed (default)
-            env.Prepend(CCFLAGS=["-O2"])
-        elif env["optimize"] == "size":  # optimize for size
-            env.Prepend(CCFLAGS=["-Os"])
-
-        if env["debug_symbols"]:
-            env.Prepend(CCFLAGS=["-g2"])
-
-    elif env["target"] == "debug":
-        env.Prepend(CCFLAGS=["-ggdb"])
-        env.Prepend(CCFLAGS=["-g3"])
-        env.Append(LINKFLAGS=["-rdynamic"])
-
     ## Architecture
 
     is64 = sys.maxsize > 2**32
@@ -363,6 +340,10 @@ def configure(env):
     else:
         print("Warning: ALSA libraries not found. Disabling the ALSA audio driver.")
 
+    print("Enabling sndio")
+    env.Append(CPPDEFINES=["SNDIO_ENABLED"])
+    env.Append(LINKFLAGS=["-lsndio"])
+
     if env["pulseaudio"]:
         if os.system("pkg-config --exists libpulse") == 0:  # 0 means found
             env.Append(CPPDEFINES=["PULSEAUDIO_ENABLED"])
@@ -381,6 +362,9 @@ def configure(env):
     else:
         env["udev"] = False  # Linux specific
 
+    if platform.system() == "OpenBSD":
+        env.Append(CPPDEFINES=["JOYDEV_ENABLED"])
+
     # Linkflags below this line should typically stay the last ones
     if not env["builtin_zlib"]:
         env.ParseConfig("pkg-config zlib --cflags --libs")
@@ -413,11 +397,6 @@ def configure(env):
             print(
                 "Warning: Creating template binaries enabled for PCK embedding is currently only supported with GNU ld, not gold or LLD."
             )
-        else:
-            if float(gnu_ld_version.group(1)) >= 2.30:
-                env.Append(LINKFLAGS=["-T", "platform/x11/pck_embed.ld"])
-            else:
-                env.Append(LINKFLAGS=["-T", "platform/x11/pck_embed.legacy.ld"])
 
     ## Cross-compilation
 
