--- goxel-0.15.1.orig/SConstruct	2024-10-02 19:06:19.126876200 +0300
+++ goxel-0.15.1/SConstruct	2024-10-02 20:45:05.594228100 +0300
@@ -29,7 +29,7 @@
     PathVariable('config_file', 'Config file to use', 'src/config.h'),
 )
 
-target_os = str(Platform())
+target_os = 'msys'
 
 if target_os == 'posix':
     vars.AddVariables(
@@ -38,7 +38,7 @@
     )
 
 
-env = Environment(variables=vars, ENV=os.environ)
+env = Environment(tools=['mingw'], variables=vars, ENV=os.environ)
 conf = env.Configure()
 
 if env['mode'] == 'analyze':
@@ -116,13 +116,11 @@
     env.Append(CXXFLAGS=['-Wno-attributes', '-Wno-unused-variable',
                          '-Wno-unused-function'])
     env.Append(CCFLAGS=['-Wno-error=address']) # To remove if possible.
-    env.Append(LIBS=['glfw3', 'opengl32', 'z', 'tre', 'gdi32', 'Comdlg32',
-                     'ole32', 'uuid', 'shell32'],
-               LINKFLAGS='--static')
-    sources += glob.glob('ext_src/glew/glew.c')
+    env.Append(LIBS=['pthread', 'opengl32', 'z', 'tre', 'gdi32', 'Comdlg32',
+                     'ole32', 'uuid', 'shell32'])
     sources.append('ext_src/nfd/nfd_win.cpp')
-    env.Append(CPPPATH=['ext_src/glew'])
-    env.Append(CPPDEFINES=['GLEW_STATIC', 'FREE_WINDOWS'])
+    env.ParseConfig('pkg-config --cflags --libs glfw3 glew')
+    env.Append(CPPDEFINES=['FREE_WINDOWS'])
 
 # OSX Compilation support.
 if target_os == 'darwin':
