Skip to content

Commit

Permalink
Prefer sysroot matching subdir when there are multiple
Browse files Browse the repository at this point in the history
  • Loading branch information
isuruf committed Jul 11, 2024
1 parent 0c136f5 commit a3127e4
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion conda_build/post.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@
"linux": (elffile,),
}

GNU_ARCH_MAP = {
"ppc64le": "powerpc64le",
"32": "i686",
"64": "x86_64",
}


def fix_shebang(f, prefix, build_python, osx_is_app=False):
path = join(prefix, f)
Expand Down Expand Up @@ -1406,8 +1412,19 @@ def check_overlinking_impl(
list(diffs)[1:3],
)
sysroots_files[srs] = sysroot_files

def sysroot_matches_subdir(path):
if path.endswith("/"):
path = os.path.dirname(path)
triplet = os.path.basename(os.path.dirname(path))
subdir_arch = subdir.split("-")[-1]
return triplet.split("-")[0] == GNU_ARCH_MAP.get(subdir_arch, subdir_arch)

sysroots_files = OrderedDict(
sorted(sysroots_files.items(), key=lambda x: -len(x[1]))
sorted(
sysroots_files.items(),
key=lambda x: (not sysroot_matches_subdir(x[0]), -len(x[1])),
)
)

all_needed_dsos, needed_dsos_for_file = _collect_needed_dsos(
Expand Down

0 comments on commit a3127e4

Please sign in to comment.