Bug 1862332 [wpt PR 42877] - WebKit export of https://bugs.webkit.org/show_bug.cgi...
[gecko.git] / gfx / harfbuzz / src / check-libstdc++.py
blobe70d5f80b23d4a8961aebb009fe4421f89b7aa01
1 #!/usr/bin/env python3
3 import sys, os, shutil, subprocess
5 os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
7 libs = os.getenv ('libs', '.libs')
9 ldd = os.getenv ('LDD', shutil.which ('ldd'))
10 if not ldd:
11 otool = os.getenv ('OTOOL', shutil.which ('otool'))
12 if otool:
13 ldd = otool + ' -L'
14 else:
15 print ('check-libstdc++.py: \'ldd\' not found; skipping test')
16 sys.exit (77)
18 stat = 0
19 tested = False
21 # harfbuzz-icu links to libstdc++ because icu does.
22 for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-gobject', 'harfbuzz-cairo']:
23 for suffix in ['so', 'dylib']:
24 so = os.path.join (libs, 'lib%s.%s' % (soname, suffix))
25 if not os.path.exists (so): continue
27 print ('Checking that we are not linking to libstdc++ or libc++ in %s' % so)
28 ldd_result = subprocess.check_output (ldd.split() + [so])
29 if (b'libstdc++' in ldd_result) or (b'libc++' in ldd_result):
30 print ('Ouch, %s is linked to libstdc++ or libc++' % so)
31 stat = 1
33 tested = True
35 if not tested:
36 print ('check-libstdc++.py: libharfbuzz shared library not found; skipping test')
37 sys.exit (77)
39 sys.exit (stat)