Index: platform/x11/detect.py
--- platform/x11/detect.py.orig
+++ platform/x11/detect.py
@@ -89,29 +89,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"])
-
     if env["debug_symbols"]:
         # Adding dwarf-4 explicitly makes stacktraces work with clang builds,
         # otherwise addr2line doesn't understand them
@@ -371,6 +348,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"])
@@ -398,6 +379,9 @@ def configure(env):
                 print("Warning: libudev development libraries not found. Disabling controller hotplugging support.")
     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"]:
