def darwin_get_object_archs(objpath): ''' For a specific object (executable, static library, dylib, etc), run `lipo` to fetch the list of archs supported by it. Supports both thin objects and 'fat' objects. ''' _, stdo, stderr = Popen_safe(['lipo', '-info', objpath]) if not stdo: mlog.debug('lipo {}: {}'.format(objpath, stderr)) return None stdo = stdo.rsplit(': ', 1)[1] # Convert from lipo-style archs to meson-style CPUs stdo = stdo.replace('i386', 'x86') stdo = stdo.replace('arm64', 'aarch64') # Add generic name for armv7 and armv7s if 'armv7' in stdo: stdo += ' arm' return stdo.split()