| 1039 | |
| 1040 | |
| 1041 | def copylibs_function(soname, objs_paths, extra_link_dirs=None, env=None): |
| 1042 | if extra_link_dirs is None: |
| 1043 | extra_link_dirs = [] |
| 1044 | print('objs_paths are', objs_paths) |
| 1045 | |
| 1046 | re_needso = re.compile(r'^.*\(NEEDED\)\s+Shared library: \[lib(.*)\.so\]\s*$') |
| 1047 | blacklist_libs = ( |
| 1048 | 'c', |
| 1049 | 'stdc++', |
| 1050 | 'dl', |
| 1051 | 'python2.7', |
| 1052 | 'sdl', |
| 1053 | 'sdl_image', |
| 1054 | 'sdl_ttf', |
| 1055 | 'z', |
| 1056 | 'm', |
| 1057 | 'GLESv2', |
| 1058 | 'jpeg', |
| 1059 | 'png', |
| 1060 | 'log', |
| 1061 | |
| 1062 | # bootstrap takes care of sdl2 libs (if applicable) |
| 1063 | 'SDL2', |
| 1064 | 'SDL2_ttf', |
| 1065 | 'SDL2_image', |
| 1066 | 'SDL2_mixer', |
| 1067 | 'SDL3', |
| 1068 | 'SDL3_ttf', |
| 1069 | 'SDL3_image', |
| 1070 | 'SDL3_mixer', |
| 1071 | ) |
| 1072 | found_libs = [] |
| 1073 | sofiles = [] |
| 1074 | if env and 'READELF' in env: |
| 1075 | readelf = env['READELF'] |
| 1076 | elif 'READELF' in os.environ: |
| 1077 | readelf = os.environ['READELF'] |
| 1078 | else: |
| 1079 | readelf = shutil.which('readelf').strip() |
| 1080 | readelf = sh.Command(readelf).bake('-d') |
| 1081 | |
| 1082 | dest = dirname(soname) |
| 1083 | |
| 1084 | for directory in objs_paths: |
| 1085 | for fn in os.listdir(directory): |
| 1086 | fn = join(directory, fn) |
| 1087 | |
| 1088 | if not fn.endswith('.libs'): |
| 1089 | continue |
| 1090 | |
| 1091 | dirfn = fn[:-1] + 'dirs' |
| 1092 | if not exists(dirfn): |
| 1093 | continue |
| 1094 | |
| 1095 | with open(fn) as f: |
| 1096 | libs = f.read().strip().split(' ') |
| 1097 | needed_libs = [lib for lib in libs |
| 1098 | if lib and |