Bug 1834446 - Move install-name-tool detection to python configure. r=firefox-build-system-reviewers,andi

At the same time, fix the sole use of the tool to actually use what's
found by configure, and only enable that configure check when building
Spidermonkey standalone.

And while we're here, add llvm-install-name-tool to the list.

Differential Revision: https://phabricator.services.mozilla.com/D178749
This commit is contained in:
Mike Hommey 2023-05-24 21:27:03 +00:00
parent 95ed7c89c4
commit 6bd39b79a5
3 changed files with 23 additions and 20 deletions

View File

@ -80,7 +80,6 @@ AC_PROG_CC
AC_PROG_CXX
AC_CHECK_PROGS(OTOOL, "${TOOLCHAIN_PREFIX}otool", :)
AC_CHECK_PROGS(INSTALL_NAME_TOOL, "${TOOLCHAIN_PREFIX}install_name_tool", :)
PATH=$_SAVE_PATH
])

View File

@ -80,7 +80,7 @@ endif
ifneq (,$(SHARED_LIBRARY))
$(SYSINSTALL) $(SHARED_LIBRARY) $(DESTDIR)$(libdir)
ifeq ($(OS_ARCH),Darwin)
install_name_tool -id $(abspath $(libdir)/$(SHARED_LIBRARY)) $(DESTDIR)$(libdir)/$(SHARED_LIBRARY)
$(INSTALL_NAME_TOOL) -id $(abspath $(libdir)/$(SHARED_LIBRARY)) $(DESTDIR)$(libdir)/$(SHARED_LIBRARY)
endif
endif
ifneq (,$(IMPORT_LIBRARY))

View File

@ -696,6 +696,26 @@ check_prog(
)
@template
def plain_llvm_or_prefixed(name):
@depends(llvm_tool(f"llvm-{name}"), toolchain_prefix)
def plain_llvm_or_prefixed(llvm_tool, toolchain_prefix):
commands = [llvm_tool[0], name]
for prefix in toolchain_prefix or ():
commands.insert(1, f"{prefix}{name}")
return tuple(commands)
return plain_llvm_or_prefixed
check_prog(
"INSTALL_NAME_TOOL",
plain_llvm_or_prefixed("llvm-install-name-tool"),
when=compile_environment & target_is_darwin & js_standalone,
paths=clang_search_path,
)
llvm_objdump = check_prog(
"LLVM_OBJDUMP",
llvm_tool("llvm-objdump"),
@ -707,14 +727,6 @@ llvm_objdump = check_prog(
add_old_configure_assignment("LLVM_OBJDUMP", llvm_objdump)
@depends(llvm_tool("llvm-readelf"), toolchain_prefix)
def readelf(llvm_readelf, toolchain_prefix):
commands = [llvm_readelf[0], "readelf"]
for prefix in toolchain_prefix or ():
commands.insert(1, "%sreadelf" % prefix)
return tuple(commands)
def validate_readelf(path):
# llvm-readelf from llvm < 8 doesn't support the GNU binutils-compatible `-d`
# flag. We could try running `$path -d $some_binary` but we might be cross
@ -735,21 +747,13 @@ def readelf_when(compile_env, target, host):
check_prog(
"READELF",
readelf,
plain_llvm_or_prefixed("readelf"),
when=readelf_when,
paths=clang_search_path,
validate=validate_readelf,
)
@depends(llvm_tool("llvm-objcopy"), toolchain_prefix)
def objcopy(llvm_objcopy, toolchain_prefix):
commands = [llvm_objcopy[0], "objcopy"]
for prefix in toolchain_prefix or ():
commands.insert(1, "%sreadelf" % prefix)
return tuple(commands)
def validate_objcopy(path):
if "llvm-objcopy" not in path:
return True
@ -762,7 +766,7 @@ def validate_objcopy(path):
check_prog(
"OBJCOPY",
objcopy,
plain_llvm_or_prefixed("objcopy"),
when=readelf_when,
paths=clang_search_path,
validate=validate_objcopy,