[src/check-*] Pickup $(NM), $(OBJDUMP), $(LDD), $(OTOOL) Fixes https://github.com/harfbuzz/harfbuzz/issues/3019
diff --git a/src/Makefile.am b/src/Makefile.am index 7a0ca29..f405331 100644 --- a/src/Makefile.am +++ b/src/Makefile.am
@@ -410,6 +410,10 @@ MAKE="$(MAKE) $(AM_MAKEFLAGS)" \ HBSOURCES="$(HBSOURCES)" \ HBHEADERS="$(HBHEADERS)" \ + LDD="$(LDD)" \ + NM="$(NM)" \ + OBJDUMP="$(OBJDUMP)" \ + OTOOL="$(OTOOL)" \ $(NULL) if HAVE_INTROSPECTION
diff --git a/src/check-libstdc++.py b/src/check-libstdc++.py index 200c683..85b7265 100755 --- a/src/check-libstdc++.py +++ b/src/check-libstdc++.py
@@ -6,13 +6,11 @@ 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 @@ 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
diff --git a/src/check-static-inits.py b/src/check-static-inits.py index 1c88f22..813295d 100755 --- a/src/check-static-inits.py +++ b/src/check-static-inits.py
@@ -5,7 +5,7 @@ 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 @@ 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):
diff --git a/src/check-symbols.py b/src/check-symbols.py index c366dc0..8050e1b 100755 --- a/src/check-symbols.py +++ b/src/check-symbols.py
@@ -11,7 +11,7 @@ '__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 @@ 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:
diff --git a/src/gen-ragel-artifacts.py b/src/gen-ragel-artifacts.py index b60ec3b..d22e03a 100755 --- a/src/gen-ragel-artifacts.py +++ b/src/gen-ragel-artifacts.py
@@ -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 @@ 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))