[src/check-*] Pickup $(NM), $(OBJDUMP), $(LDD), $(OTOOL)

Fixes https://github.com/harfbuzz/harfbuzz/issues/3019
This commit is contained in:
Behdad Esfahbod 2021-06-12 11:00:19 -06:00
parent c61ce962cf
commit 13c6ad980f
5 changed files with 17 additions and 15 deletions

View File

@ -410,6 +410,10 @@ TESTS_ENVIRONMENT = \
MAKE="$(MAKE) $(AM_MAKEFLAGS)" \
HBSOURCES="$(HBSOURCES)" \
HBHEADERS="$(HBHEADERS)" \
LDD="$(LDD)" \
NM="$(NM)" \
OBJDUMP="$(OBJDUMP)" \
OTOOL="$(OTOOL)" \
$(NULL)
if HAVE_INTROSPECTION

View File

@ -6,13 +6,11 @@ os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
libs = os.getenv ('libs', '.libs')
ldd = shutil.which ('ldd')
if ldd:
ldd = [ldd]
else:
ldd = shutil.which ('otool')
if ldd:
ldd = [ldd, '-L'] # otool -L
ldd = os.getenv ('LDD', shutil.which ('ldd'))
if not ldd:
otool = os.getenv ('OTOOL', shutil.which ('otool'))
if otool:
ldd = otool + ' -L'
else:
print ('check-libstdc++.py: \'ldd\' not found; skipping test')
sys.exit (77)
@ -27,7 +25,7 @@ for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-gobject']:
if not os.path.exists (so): continue
print ('Checking that we are not linking to libstdc++ or libc++ in %s' % so)
ldd_result = subprocess.check_output (ldd + [so])
ldd_result = subprocess.check_output (ldd.split() + [so])
if (b'libstdc++' in ldd_result) or (b'libc++' in ldd_result):
print ('Ouch, %s is linked to libstdc++ or libc++' % so)
stat = 1

View File

@ -5,7 +5,7 @@ import sys, os, shutil, subprocess, glob, re
builddir = os.getenv ('builddir', os.path.dirname (__file__))
libs = os.getenv ('libs', '.libs')
objdump = shutil.which ('objdump')
objdump = os.getenv ('OBJDUMP', shutil.which ('objdump'))
if not objdump:
print ('check-static-inits.py: \'ldd\' not found; skipping test')
sys.exit (77)
@ -22,7 +22,7 @@ if not OBJS:
stat = 0
for obj in OBJS:
result = subprocess.check_output ([objdump, '-t', obj]).decode ('utf-8')
result = subprocess.check_output (objdump.split () + ['-t', obj]).decode ('utf-8')
# Checking that no object file has static initializers
for l in re.findall (r'^.*\.[cd]tors.*$', result, re.MULTILINE):

View File

@ -11,7 +11,7 @@ IGNORED_SYMBOLS = '|'.join(['_fini', '_init', '_fdata', '_ftext', '_fbss',
'__bss_start', '__bss_start__', '__bss_end__', '_edata', '_end', '_bss_end__',
'__end__', '__gcov_.*', 'llvm_.*', 'flush_fn_list', 'writeout_fn_list', 'mangle_path'])
nm = shutil.which ('nm')
nm = os.getenv ('NM', shutil.which ('nm'))
if not nm:
print ('check-symbols.py: \'nm\' not found; skipping test')
sys.exit (77)
@ -30,8 +30,8 @@ for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-icu', 'harfbuzz-gobject'
symprefix = '_' if suffix == 'dylib' else ''
EXPORTED_SYMBOLS = [s.split ()[2]
for s in re.findall (r'^.+ [BCDGIRST] .+$', subprocess.check_output ([nm, so]).decode ('utf-8'), re.MULTILINE)
if not re.match (r'.* %s(%s)\b' % (symprefix, IGNORED_SYMBOLS), s)]
for s in re.findall (r'^.+ [BCDGIRST] .+$', subprocess.check_output (nm.split() + [so]).decode ('utf-8'), re.MULTILINE)
if not re.match (r'.* %s(%s)\b' % (symprefix, IGNORED_SYMBOLS), s)]
# run again c++flit also if is available
if cxxflit:

View File

@ -4,7 +4,7 @@
import os, os.path, sys, subprocess, shutil
ragel = shutil.which ('ragel')
ragel = os.getenv ('RAGEL', shutil.which ('ragel'))
if not ragel:
sys.exit ('You have to install ragel if you are going to develop HarfBuzz itself')
@ -19,7 +19,7 @@ outdir = os.path.dirname (OUTPUT)
shutil.copy (INPUT, outdir)
rl = os.path.basename (INPUT)
hh = rl.replace ('.rl', '.hh')
subprocess.Popen ([ragel, '-e', '-F1', '-o', hh, rl], cwd=outdir).wait ()
subprocess.Popen (ragel.split() + ['-e', '-F1', '-o', hh, rl], cwd=outdir).wait ()
# copy it also to src/
shutil.copyfile (os.path.join (outdir, hh), os.path.join (CURRENT_SOURCE_DIR, hh))