@@ -27,22 +27,24 @@ def clean_files(source, executable):
27
27
os .remove (source )
28
28
os .remove (executable )
29
29
30
- def call_security_check ( cc : str , source : str , executable : str , options ) -> tuple :
30
+ def env_flags ( ) -> list [ str ] :
31
31
# This should behave the same as AC_TRY_LINK, so arrange well-known flags
32
32
# in the same order as autoconf would.
33
33
#
34
34
# See the definitions for ac_link in autoconf's lib/autoconf/c.m4 file for
35
35
# reference.
36
- env_flags : list [str ] = []
36
+ flags : list [str ] = []
37
37
for var in ['CFLAGS' , 'CPPFLAGS' , 'LDFLAGS' ]:
38
- env_flags += filter (None , os .environ .get (var , '' ).split (' ' ))
38
+ flags += filter (None , os .environ .get (var , '' ).split (' ' ))
39
+ return flags
39
40
40
- subprocess .run ([* cc ,source ,'-o' ,executable ] + env_flags + options , check = True )
41
+ def call_security_check (cc : str , source : str , executable : str , options ) -> tuple :
42
+ subprocess .run ([* cc ,source ,'-o' ,executable ] + env_flags () + options , check = True )
41
43
p = subprocess .run ([os .path .join (os .path .dirname (__file__ ), 'security-check.py' ), executable ], stdout = subprocess .PIPE , text = True )
42
44
return (p .returncode , p .stdout .rstrip ())
43
45
44
46
def get_arch (cc , source , executable ):
45
- subprocess .run ([* cc , source , '-o' , executable ], check = True )
47
+ subprocess .run ([* cc , source , '-o' , executable ] + env_flags () , check = True )
46
48
binary = lief .parse (executable )
47
49
arch = binary .abstract .header .architecture
48
50
os .remove (executable )
0 commit comments