Changeset View
Changeset View
Standalone View
Standalone View
bin/utils.py
Show First 20 Lines • Show All 981 Lines • ▼ Show 20 Line(s) | |||||
982 | 982 | | |||
983 | 983 | | |||
984 | def strip(fileName, symbolDest=None): | 984 | def strip(fileName, symbolDest=None): | ||
985 | """strip debugging informations from shared libraries and executables - mingw only!!! """ | 985 | """strip debugging informations from shared libraries and executables - mingw only!!! """ | ||
986 | if CraftCore.compiler.isMSVC() or not CraftCore.compiler.isGCCLike(): | 986 | if CraftCore.compiler.isMSVC() or not CraftCore.compiler.isGCCLike(): | ||
987 | CraftCore.log.warning(f"Skipping stripping of {fileName} -- either disabled or unsupported with this compiler") | 987 | CraftCore.log.warning(f"Skipping stripping of {fileName} -- either disabled or unsupported with this compiler") | ||
988 | return True | 988 | return True | ||
989 | 989 | | |||
990 | if OsUtils.isMac(): | 990 | if CraftCore.compiler.isMacOS: | ||
991 | CraftCore.log.debug(f"Skipping stripping of files on macOS -- not implemented") | 991 | symFile = Path(symbolDest) / f"{os.path.basename(fileName)}.dSym" | ||
992 | else: | ||||
993 | symFile = Path(symbolDest) / f"{os.path.basename(fileName)}.sym" | ||||
994 | | ||||
995 | if symFile.exists(): | ||||
992 | return True | 996 | return True | ||
993 | 997 | | |||
994 | if not symbolDest: | 998 | if CraftCore.compiler.isMacOS: | ||
995 | return system(["strip", "-s", fileName]) | 999 | return (system(["dsymutil", fileName, "-o", symFile]) and | ||
1000 | system(["strip", "-x", "-S", fileName])) | ||||
996 | else: | 1001 | else: | ||
997 | symFile = Path(symbolDest) /f"{os.path.basename(fileName)}.sym" | 1002 | if not symbolDest: | ||
998 | if symFile.exists(): | 1003 | return system(["strip", "-s", fileName]) | ||
999 | return True | 1004 | else: | ||
1000 | return (system(["objcopy", "--only-keep-debug", fileName, symFile]) and | 1005 | return (system(["objcopy", "--only-keep-debug", fileName, symFile]) and | ||
1001 | system(["strip", "--strip-debug", "--strip-unneeded", fileName]) and | 1006 | system(["strip", "--strip-debug", "--strip-unneeded", fileName]) and | ||
1002 | system(["objcopy", "--add-gnu-debuglink", symFile, fileName])) | 1007 | system(["objcopy", "--add-gnu-debuglink", symFile, fileName])) | ||
1003 | return True | |