From d96bd363de3b94dccbe4e685796c5fd482fac63d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?=
 <alexey.pawlow@gmail.com>
Date: Thu, 17 Jun 2021 18:51:22 +0530
Subject: [PATCH 013/N] MINGW compiler enable new dtags
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Алексей <alexey.pawlow@gmail.com>
---
 Lib/distutils/unixccompiler.py | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Lib/distutils/unixccompiler.py b/Lib/distutils/unixccompiler.py
index f0792de..60776bc 100644
--- a/Lib/distutils/unixccompiler.py
+++ b/Lib/distutils/unixccompiler.py
@@ -248,9 +248,13 @@ class UnixCCompiler(CCompiler):
                 # -Wl whenever gcc was used in the past it is probably
                 # safest to keep doing so.
                 if sysconfig.get_config_var("GNULD") == "yes":
-                    # GNU ld needs an extra option to get a RUNPATH
+                    # GNU ELF ld needs an extra option to get a RUNPATH
                     # instead of just an RPATH.
-                    return "-Wl,--enable-new-dtags,-R" + dir
+                    if sys.platform in ["win32", "cygwin"] or \
+                       "mingw" in compiler:
+                        return []
+                    else:
+                        return "-Wl,--enable-new-dtags,-R" + dir
                 else:
                     return "-Wl,-R" + dir
             else:
-- 
2.32.0

