qmake: Add support for separate debug info on Apple platforms.

This makes the -separate-debug-info configure optional functional, which
generates dSYM debug info bundles for Qt libraries on Apple platforms.

Task-number: QTBUG-37952
Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: Ia247674740bf450130a15db926df07fa9007e2ca
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
This commit is contained in:
Jake Petroules 2016-04-06 20:37:44 -07:00 committed by Jake Petroules
parent 62ad5abe06
commit ab599a3931
12 changed files with 230 additions and 17 deletions

2
configure vendored
View File

@ -4362,7 +4362,7 @@ fi
#-------------------------------------------------------------------------------
# Detect objcopy support
if [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
if [ "$XPLATFORM_MAC" = "no" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "yes" ]; then
if ! compileTest unix/objcopy "objcopy"; then
echo "ERROR: -separate-debug-info was requested but this binutils does not support it."
echo "Re-run configure with -v for more information"

View File

@ -29,6 +29,9 @@ QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_OPENGL = -framework OpenGL -framework AGL
QMAKE_LIBS_THREAD =
QMAKE_DSYMUTIL = dsymutil
QMAKE_STRIP = strip
QMAKE_AR = ar cq
QMAKE_RANLIB = ranlib -s
QMAKE_NM = nm -P

View File

@ -1,29 +1,77 @@
have_target:!static:!isEmpty(QMAKE_OBJCOPY) {
qnx {
debug_info_suffix = sym
debug_info_keep = --keep-file-symbols
debug_info_strip = --strip-debug -R.ident
have_target:!static:if(darwin|!isEmpty(QMAKE_OBJCOPY)) {
darwin {
debug_info_copy_bin = $$QMAKE_DSYMUTIL
debug_info_strip_bin = $$QMAKE_STRIP
debug_info_suffix = dSYM
debug_info_out = --flat -o
debug_info_strip = -S
} else {
debug_info_suffix = debug
debug_info_keep = --only-keep-debug
debug_info_strip = --strip-debug
debug_info_copy_bin = $$QMAKE_OBJCOPY
debug_info_strip_bin = $$QMAKE_OBJCOPY
qnx {
debug_info_suffix = sym
debug_info_keep = --keep-file-symbols
debug_info_strip = --strip-debug -R.ident
} else {
debug_info_suffix = debug
debug_info_keep = --only-keep-debug
debug_info_strip = --strip-debug
}
}
load(resolve_target)
QMAKE_TARGET_DEBUG_INFO = $${QMAKE_RESOLVED_TARGET}.$$debug_info_suffix
debug_info_target = $$QMAKE_RESOLVED_TARGET
darwin {
!isEmpty(QMAKE_RESOLVED_BUNDLE) {
debug_info_target = $$QMAKE_RESOLVED_BUNDLE
CONFIG += any_bundle
}
debug_info_target_dir = $${debug_info_target}.$$debug_info_suffix/Contents/Resources/DWARF
!isEmpty(QMAKE_RESOLVED_BUNDLE): \
QMAKE_TARGET_DEBUG_INFO = $$debug_info_target_dir/$$TARGET
else: \
QMAKE_TARGET_DEBUG_INFO = $$debug_info_target_dir/$$section(QMAKE_RESOLVED_TARGET, /, -1, -1)
if(any_bundle:!build_pass)|if(!any_bundle:if(build_pass|isEmpty(BUILDS))) {
equals(TEMPLATE, lib):lib_bundle:!isEmpty(QMAKE_FRAMEWORK_BUNDLE_NAME): \
BUNDLEIDENTIFIER = $$replace(QMAKE_FRAMEWORK_BUNDLE_NAME, \\.framework$, )
else: equals(TEMPLATE, app):app_bundle:!isEmpty(QMAKE_APPLICATION_BUNDLE_NAME): \
BUNDLEIDENTIFIER = $$replace(QMAKE_APPLICATION_BUNDLE_NAME, \\.app$, )
else: \
BUNDLEIDENTIFIER = $${TARGET}
!isEmpty(QMAKE_TARGET_BUNDLE_PREFIX): \
BUNDLEIDENTIFIER = $$replace(QMAKE_TARGET_BUNDLE_PREFIX, \\.$, ).$${BUNDLEIDENTIFIER}
else: \
BUNDLEIDENTIFIER = com.yourcompany.$${BUNDLEIDENTIFIER}
BUNDLEIDENTIFIER ~= s,_,-,
debug_info_plist.input = $$QMAKESPEC/Info.plist.dSYM.in
debug_info_plist.output = $${debug_info_target}.$$debug_info_suffix/Contents/Info.plist
QMAKE_SUBSTITUTES += debug_info_plist
}
} else {
QMAKE_TARGET_DEBUG_INFO = $${QMAKE_RESOLVED_TARGET}.$$debug_info_suffix
}
shell_target = $$shell_quote($$relative_path($$QMAKE_RESOLVED_TARGET, $$OUT_PWD))
shell_target_debug_info = $$shell_quote($$relative_path($$QMAKE_TARGET_DEBUG_INFO, $$OUT_PWD))
copy_debug_info = $$QMAKE_OBJCOPY $$debug_info_keep $$shell_target $$shell_target_debug_info
strip_debug_info = $$QMAKE_OBJCOPY $$debug_info_strip $$shell_target
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
chmod_debug_info = chmod -x $$shell_target_debug_info
copy_debug_info = $$debug_info_copy_bin $$debug_info_keep $$shell_target $$debug_info_out $$shell_target_debug_info
strip_debug_info = $$debug_info_strip_bin $$debug_info_strip $$shell_target
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info && $$chmod_debug_info $$QMAKE_POST_LINK
darwin {
mkdir_debug_info = $$QMAKE_MKDIR $$shell_quote($$debug_info_target_dir)
QMAKE_POST_LINK = $$mkdir_debug_info && $$copy_debug_info && $$strip_debug_info $$QMAKE_POST_LINK
} else {
link_debug_info = $$QMAKE_OBJCOPY --add-gnu-debuglink=$$shell_target_debug_info $$shell_target
chmod_debug_info = chmod -x $$shell_target_debug_info
QMAKE_POST_LINK = $$copy_debug_info && $$strip_debug_info && $$link_debug_info && $$chmod_debug_info $$QMAKE_POST_LINK
}
silent:QMAKE_POST_LINK = @echo creating $@.$$debug_info_suffix && $$QMAKE_POST_LINK
target.targets += $$QMAKE_TARGET_DEBUG_INFO
QMAKE_DISTCLEAN += $$QMAKE_TARGET_DEBUG_INFO
}

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>

View File

@ -0,0 +1,18 @@
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">
<plist version=\"1.0\">
<dict>
<key>CFBundleIdentifier</key>
<string>com.apple.xcode.dsym.$${BUNDLEIDENTIFIER}</string>
<key>CFBundlePackageType</key>
<string>dSYM</string>
<key>CFBundleSignature</key>
<string>????</string>
!!IF !isEmpty(VERSION)
<key>CFBundleShortVersionString</key>
<string>$${VER_MAJ}.$${VER_MIN}</string>
<key>CFBundleVersion</key>
<string>$${VER_MAJ}.$${VER_MIN}.$${VER_PAT}</string>
!!ENDIF
</dict>
</plist>