mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-10 03:47:29 -03:00
contrib: use env_flags in get_arch
Otherwise we fail to link when trying to use lld.
This commit is contained in:
parent
ceb1e078f8
commit
e6aba463ad
1 changed files with 7 additions and 5 deletions
|
@ -27,22 +27,24 @@ def clean_files(source, executable):
|
|||
os.remove(source)
|
||||
os.remove(executable)
|
||||
|
||||
def call_security_check(cc: str, source: str, executable: str, options) -> tuple:
|
||||
def env_flags() -> list[str]:
|
||||
# This should behave the same as AC_TRY_LINK, so arrange well-known flags
|
||||
# in the same order as autoconf would.
|
||||
#
|
||||
# See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for
|
||||
# reference.
|
||||
env_flags: list[str] = []
|
||||
flags: list[str] = []
|
||||
for var in ['CFLAGS', 'CPPFLAGS', 'LDFLAGS']:
|
||||
env_flags += filter(None, os.environ.get(var, '').split(' '))
|
||||
flags += filter(None, os.environ.get(var, '').split(' '))
|
||||
return flags
|
||||
|
||||
subprocess.run([*cc,source,'-o',executable] + env_flags + options, check=True)
|
||||
def call_security_check(cc: str, source: str, executable: str, options) -> tuple:
|
||||
subprocess.run([*cc,source,'-o',executable] + env_flags() + options, check=True)
|
||||
p = subprocess.run([os.path.join(os.path.dirname(__file__), 'security-check.py'), executable], stdout=subprocess.PIPE, text=True)
|
||||
return (p.returncode, p.stdout.rstrip())
|
||||
|
||||
def get_arch(cc, source, executable):
|
||||
subprocess.run([*cc, source, '-o', executable], check=True)
|
||||
subprocess.run([*cc, source, '-o', executable] + env_flags(), check=True)
|
||||
binary = lief.parse(executable)
|
||||
arch = binary.abstract.header.architecture
|
||||
os.remove(executable)
|
||||
|
|
Loading…
Reference in a new issue