diff options
Diffstat (limited to 'build/mac')
-rwxr-xr-x | build/mac/dump_app_syms | 31 | ||||
-rwxr-xr-x | build/mac/strip_save_dsym | 27 |
2 files changed, 42 insertions, 16 deletions
diff --git a/build/mac/dump_app_syms b/build/mac/dump_app_syms index 044e172..cd6e626 100755 --- a/build/mac/dump_app_syms +++ b/build/mac/dump_app_syms @@ -30,19 +30,32 @@ FULL_VERSION="${MAJOR}.${MINOR}.${BUILD}.${PATCH}" SRC_APP_PATH="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}.app" # Created by the build/mac/strip_from_xcode script. UNSTRIPPED_APP="${SRC_APP_PATH}.dSYM/Contents/Resources/DWARF/${SRC_APP_NAME}" -SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}-${FULL_VERSION}-i386.breakpad" +APP_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_APP_NAME}-${FULL_VERSION}-i386.breakpad" # Only run dump_syms if the file has changed since we last did a dump. -if [ "${UNSTRIPPED_APP}" -nt "${SYMBOL_FILE}" ] ; then - "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${SYMBOL_FILE}" +if [ "${UNSTRIPPED_APP}" -nt "${APP_SYMBOL_FILE}" ] ; then + "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_APP}" > "${APP_SYMBOL_FILE}" fi +APP_DSYM_NAME="${SRC_APP_NAME}.app.dSYM" -DSYM_NAME="${SRC_APP_NAME}.app.dSYM" -DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${DSYM_NAME}.tar.bz2" +# Do the same thing for chrome_dll. + +SRC_DYLIB_NAME="${SRC_APP_NAME} Framework" +SRC_DYLIB_PATH="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}.framework" +UNSTRIPPED_DYLIB="${SRC_DYLIB_PATH}.dSYM/Contents/Resources/DWARF/${SRC_DYLIB_NAME}" +DYLIB_SYMBOL_FILE="${BUILT_PRODUCTS_DIR}/${SRC_DYLIB_NAME}-${FULL_VERSION}-i386.breakpad" +if [ "${UNSTRIPPED_DYLIB}" -nt "${DYLIB_SYMBOL_FILE}" ] ; then + "${BREAKPAD_DUMP_SYMS}" -a i386 "${UNSTRIPPED_DYLIB}" > "${DYLIB_SYMBOL_FILE}" +fi +DYLIB_DSYM_NAME="${SRC_DYLIB_NAME}.framework.dSYM" + +DSYM_TAR_PATH="${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}.tar.bz2" # Make a .tar.bz2 out of the .dSYM -if [ "${BUILT_PRODUCTS_DIR}/${DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ; then - # we do a cd so when building the tar, we don't include the build dir in the - # tar paths. - (cd "${BUILT_PRODUCTS_DIR}" && tar -jcf "${DSYM_TAR_PATH}" "${DSYM_NAME}") +if [ "${BUILT_PRODUCTS_DIR}/${APP_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] || + [ "${BUILT_PRODUCTS_DIR}/${DYLIB_DSYM_NAME}" -nt "${DSYM_TAR_PATH}" ] ; then + # Change directory so when building the tar, we don't include the build dir + # in the tar paths. + (cd "${BUILT_PRODUCTS_DIR}" && + tar -jcf "${DSYM_TAR_PATH}" "${APP_DSYM_NAME}" "${DYLIB_DSYM_NAME}") fi diff --git a/build/mac/strip_save_dsym b/build/mac/strip_save_dsym index 0e54b93..42d16cf 100755 --- a/build/mac/strip_save_dsym +++ b/build/mac/strip_save_dsym @@ -43,13 +43,18 @@ import time # architecture. On error, returns an empty list. Determines the architecture # list by calling file. def macho_archs(macho): + macho_types = ["executable", + "dynamically linked shared library", + "bundle"] + macho_types_re = "Mach-O (?:64-bit )?(?:" + "|".join(macho_types) + ")" + file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "--", macho], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE) archs = [] type_line = file_cmd.stdout.readline() - type_match = re.match("^Mach-O executable (.*)$", type_line) + type_match = re.match("^%s (.*)$" % macho_types_re, type_line) if type_match: archs.append(type_match.group(1)) return [type_match.group(1)] @@ -60,7 +65,7 @@ def macho_archs(macho): for i in range(0, int(type_match.group(1))): arch_line = file_cmd.stdout.readline() arch_match = re.match( - "^.* \(for architecture (.*)\):\tMach-O executable .*$", + "^.* \(for architecture (.*)\):\t%s .*$" % macho_types_re, arch_line) if arch_match: archs.append(arch_match.group(1)) @@ -68,6 +73,9 @@ def macho_archs(macho): if file_cmd.wait() != 0: archs = [] + if len(archs) == 0: + print >> sys.stderr, "No architectures in %s" % macho + return archs # Returns a dictionary mapping architectures contained in the file as returned @@ -75,9 +83,11 @@ def macho_archs(macho): # Architectures with no LC_UUID load command are omitted from the dictionary. # Determines the UUID value by calling otool. def macho_uuids(macho): - archs = macho_archs(macho) + uuids = {} - uuids = {} + archs = macho_archs(macho) + if len(archs) == 0: + return uuids for arch in archs: if arch == "": @@ -85,7 +95,7 @@ def macho_uuids(macho): otool_cmd = subprocess.Popen(["/usr/bin/otool", "-arch", arch, "-l", "-", macho], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + stdout=subprocess.PIPE) # state 0 is when nothing UUID-related has been seen yet. State 1 is # entered after a load command begins, but it may not be an LC_UUID load # command. States 2, 3, and 4 are intermediate states while reading an @@ -138,6 +148,9 @@ def macho_uuids(macho): if state == 5: uuids[arch] = uuid.upper() + if len(uuids) == 0: + print >> sys.stderr, "No UUIDs in %s" % macho + return uuids # Given a path to a Mach-O file and possible information from the environment, @@ -309,5 +322,5 @@ def main(argv=None): return 0 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main(sys.argv)) |