Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Oct 19, 2021
2 parents 3dd1af0 + 42f0cf2 commit 46591cf
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 20 deletions.
4 changes: 2 additions & 2 deletions setuptools/_distutils/tests/test_unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ def gcv(v):
elif v == 'GNULD':
return 'yes'
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-R/foo')
self.assertEqual(self.cc.rpath_foo(), '-Wl,--enable-new-dtags,-R/foo')

# non-GCC non-GNULD
sys.platform = 'bar'
Expand All @@ -187,7 +187,7 @@ def gcv(v):
elif v == 'GNULD':
return 'no'
sysconfig.get_config_var = gcv
self.assertEqual(self.cc.rpath_foo(), '-R/foo')
self.assertEqual(self.cc.rpath_foo(), '-Wl,-R/foo')

@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
def test_cc_overrides_ldshared(self):
Expand Down
25 changes: 9 additions & 16 deletions setuptools/_distutils/unixccompiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,23 +245,16 @@ def runtime_library_dir_option(self, dir):
if self._is_gcc(compiler):
return ["-Wl,+s", "-L" + dir]
return ["+s", "-L" + dir]

# For all compilers, `-Wl` is the presumed way to
# pass a compiler option to the linker and `-R` is
# the way to pass an RPATH.
if sysconfig.get_config_var("GNULD") == "yes":
# GNU ld needs an extra option to get a RUNPATH
# instead of just an RPATH.
return "-Wl,--enable-new-dtags,-R" + dir
else:
if self._is_gcc(compiler):
# gcc on non-GNU systems does not need -Wl, but can
# use it anyway. Since distutils has always passed in
# -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
# instead of just an RPATH.
return "-Wl,--enable-new-dtags,-R" + dir
else:
return "-Wl,-R" + dir
else:
# No idea how --enable-new-dtags would be passed on to
# ld if this system was using GNU ld. Don't know if a
# system like this even exists.
return "-R" + dir
return "-Wl,-R" + dir

def library_option(self, lib):
return "-l" + lib
Expand Down
4 changes: 2 additions & 2 deletions setuptools/_distutils/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ def get_macosx_target_ver():
"""Return the version of macOS for which we are building.
The target version defaults to the version in sysconfig latched at time
the Python interpreter was built, unless overriden by an environment
the Python interpreter was built, unless overridden by an environment
variable. If neither source has a value, then None is returned"""

syscfg_ver = get_macosx_target_ver_from_syscfg()
env_ver = os.environ.get(MACOSX_VERSION_VAR)

if env_ver:
# Validate overriden version against sysconfig version, if have both.
# Validate overridden version against sysconfig version, if have both.
# Ensure that the deployment target of the build process is not less
# than 10.3 if the interpreter was built for 10.3 or later. This
# ensures extension modules are built with correct compatibility
Expand Down

0 comments on commit 46591cf

Please sign in to comment.