2020-05-29 10:04:30 +02:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import sys, os, shutil, subprocess
|
|
|
|
|
2020-07-04 11:42:55 +02:00
|
|
|
os.chdir (os.getenv ('srcdir', os.path.dirname (__file__)))
|
2020-05-29 10:04:30 +02:00
|
|
|
|
2020-07-04 11:42:55 +02:00
|
|
|
libs = os.getenv ('libs', '.libs')
|
2020-05-29 10:04:30 +02:00
|
|
|
|
2021-06-12 19:00:19 +02:00
|
|
|
ldd = os.getenv ('LDD', shutil.which ('ldd'))
|
|
|
|
if not ldd:
|
|
|
|
otool = os.getenv ('OTOOL', shutil.which ('otool'))
|
|
|
|
if otool:
|
|
|
|
ldd = otool + ' -L'
|
2020-05-29 10:04:30 +02:00
|
|
|
else:
|
|
|
|
print ('check-libstdc++.py: \'ldd\' not found; skipping test')
|
|
|
|
sys.exit (77)
|
|
|
|
|
|
|
|
stat = 0
|
|
|
|
tested = False
|
|
|
|
|
|
|
|
# harfbuzz-icu links to libstdc++ because icu does.
|
2022-12-27 00:54:31 +01:00
|
|
|
for soname in ['harfbuzz', 'harfbuzz-subset', 'harfbuzz-gobject', 'harfbuzz-cairo']:
|
2020-05-29 10:04:30 +02:00
|
|
|
for suffix in ['so', 'dylib']:
|
|
|
|
so = os.path.join (libs, 'lib%s.%s' % (soname, suffix))
|
|
|
|
if not os.path.exists (so): continue
|
|
|
|
|
|
|
|
print ('Checking that we are not linking to libstdc++ or libc++ in %s' % so)
|
2021-06-12 19:00:19 +02:00
|
|
|
ldd_result = subprocess.check_output (ldd.split() + [so])
|
2020-05-29 10:04:30 +02:00
|
|
|
if (b'libstdc++' in ldd_result) or (b'libc++' in ldd_result):
|
|
|
|
print ('Ouch, %s is linked to libstdc++ or libc++' % so)
|
|
|
|
stat = 1
|
|
|
|
|
|
|
|
tested = True
|
|
|
|
|
|
|
|
if not tested:
|
|
|
|
print ('check-libstdc++.py: libharfbuzz shared library not found; skipping test')
|
|
|
|
sys.exit (77)
|
|
|
|
|
|
|
|
sys.exit (stat)
|