--- matplotlib-3.3.4/setupext.py.orig	2021-01-28 09:30:28.000000000 +0100
+++ matplotlib-3.3.4/setupext.py	2021-02-07 12:11:03.590667300 +0100
@@ -20,6 +20,7 @@
 
 _log = logging.getLogger(__name__)
 
+MSYS = "MSYSTEM" in os.environ
 
 def _get_xdg_cache_dir():
     """
@@ -146,9 +147,9 @@
 options = {
     'backend': config.get('rc_options', 'backend', fallback=None),
     'system_freetype': config.getboolean(
-        'libs', 'system_freetype', fallback=sys.platform.startswith('aix')),
+        'libs', 'system_freetype', fallback=sys.platform.startswith('aix') or MSYS),
     'system_qhull': config.getboolean('libs', 'system_qhull',
-                                      fallback=False),
+                                      fallback=False or MSYS),
 }
 
 
@@ -171,7 +172,7 @@
     """
     Get path to pkg-config and set up the PKG_CONFIG environment variable.
     """
-    if sys.platform == 'win32':
+    if sys.platform == 'win32' and not MSYS:
         return None
     pkg_config = os.environ.get('PKG_CONFIG', 'pkg-config')
     if shutil.which(pkg_config) is None:
@@ -223,7 +224,7 @@
 
     # conda Windows header and library paths.
     # https://github.com/conda/conda/issues/2312 re: getting the env dir.
-    if sys.platform == 'win32':
+    if sys.platform == 'win32' and not MSYS:
         conda_env_path = (os.getenv('CONDA_PREFIX')  # conda >= 4.1
                           or os.getenv('CONDA_DEFAULT_ENV'))  # conda < 4.1
         if conda_env_path and os.path.isdir(conda_env_path):
