diff options
author | Andrew Morrow <acm@mongodb.com> | 2018-10-17 22:21:05 -0400 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2018-10-30 13:03:33 -0400 |
commit | 212a562116854d1cad0aa5089efa49787fe77be5 (patch) | |
tree | bd71bca782036248ececa35178d04f783131c857 /src | |
parent | 19b42b261fd82dc37d7de0aa6a3344e2fbe53384 (diff) | |
download | mongo-212a562116854d1cad0aa5089efa49787fe77be5.tar.gz |
SERVER-37488 SERVER-37596 Manage debug info and symbol maps info for embedded builds
(cherry picked from commit 6d475fdb5a76acab760ce4b6709b60a4c8c9aec6)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/SConscript | 25 | ||||
-rw-r--r-- | src/mongo/embedded/mongo_embedded/SConscript | 30 | ||||
-rw-r--r-- | src/mongo/embedded/mongo_embedded/mongo_embedded.podspec.in | 6 | ||||
-rw-r--r-- | src/mongo/embedded/mongoc_embedded/SConscript | 26 | ||||
-rw-r--r-- | src/mongo/embedded/mongoc_embedded/mongoc_embedded.podspec.in | 3 |
5 files changed, 69 insertions, 21 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index 42e951a7009..4c32ec627d1 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -552,6 +552,10 @@ def failMissingObjCopy(env, target, source): env.FatalError("Generating debug symbols requires objcopy, please set the OBJCOPY variable.") def installBinary( e, name ): + + if hygienic: + return + debug_sym_name = name name = add_exe( name ) @@ -576,8 +580,7 @@ def installBinary( e, name ): name, debug_sym_cmd ) - if not hygienic: - e.Install("#/", debug_sym) + e.Install("#/", debug_sym) e.Alias('debugsymbols', debug_sym) distDebugSymbols.append(debug_sym) @@ -591,24 +594,26 @@ def installBinary( e, name ): else: distBinaries.append(name) - if not hygienic: - inst = e.Install( "$INSTALL_DIR/bin", name ) + inst = e.Install( "$INSTALL_DIR/bin", name ) - if env.TargetOSIs('posix'): - e.AddPostAction( inst, 'chmod 755 $TARGET' ) + if env.TargetOSIs('posix'): + e.AddPostAction( inst, 'chmod 755 $TARGET' ) def installExternalBinary( e, name_str ): + + if hygienic: + return + name = env.File("#/%s" % add_exe(name_str)) if not name.isfile(): env.FatalError("ERROR: external binary not found: {0}", name) distBinaries.append(name) - if not hygienic: - inst = e.Install( "$INSTALL_DIR/bin", name ) + inst = e.Install( "$INSTALL_DIR/bin", name ) - if env.TargetOSIs('posix'): - e.AddPostAction( inst, 'chmod 755 $TARGET' ) + if env.TargetOSIs('posix'): + e.AddPostAction( inst, 'chmod 755 $TARGET' ) # "--use-new-tools" adds dependencies for rewritten (Go) tools # It is required for "dist" but optional for "install" diff --git a/src/mongo/embedded/mongo_embedded/SConscript b/src/mongo/embedded/mongo_embedded/SConscript index 79cd14899db..fc5a86e75ed 100644 --- a/src/mongo/embedded/mongo_embedded/SConscript +++ b/src/mongo/embedded/mongo_embedded/SConscript @@ -62,7 +62,7 @@ if mongoEmbeddedEnv.TargetOSIs('darwin'): ) -mongoEmbeddedEnv.Library( +mongoEmbeddedTargets = mongoEmbeddedEnv.Library( target='mongo_embedded', source=[ 'mongo_embedded.cpp', @@ -124,8 +124,6 @@ if get_option('link-model') != 'dynamic-sdk': if get_option('link-model') != 'dynamic-sdk' or get_option('install-mode') != 'hygienic' or not env.TargetOSIs('darwin') or env.TargetOSIs('macOS'): Return() -installHeaderRoot = env.Dir('$INSTALL_DIR/include/mongo_embedded/v1/mongo_embedded') - frameworkDir = env.Dir('$INSTALL_DIR/Frameworks/mongo_embedded.framework') env.Alias('install-embedded-dev', frameworkDir) @@ -147,7 +145,7 @@ env.Install( env.Install( target=frameworkDir.Dir('Headers'), - source=installHeaderRoot.File('mongo_embedded.h') + source=env.File('mongo_embedded.h') ) env.InstallAs( @@ -174,10 +172,30 @@ env.Install( mongoEmbeddedFwLib = env.InstallAs( target=frameworkDir.File('mongo_embedded'), - source='$INSTALL_DIR/lib/libmongo_embedded.dylib', + source=mongoEmbeddedTargets[0], ) env.AddPostAction( files=mongoEmbeddedFwLib, - action="install_name_tool -id @rpath/mongo_embedded.framework/mongo_embedded $TARGET", + action=[ + "install_name_tool -delete_rpath @loader_path/../lib $TARGET", + "install_name_tool -id @rpath/mongo_embedded.framework/mongo_embedded $TARGET", + ] ) + +mongoEmbeddedDSYM = getattr(mongoEmbeddedTargets[0].attributes, "separate_debug_file", None) +if mongoEmbeddedDSYM: + frameworkDSYMDir = '$INSTALL_DIR/Frameworks/mongo_embedded.framework.dSYM' + env.Alias('install-embedded-dev', frameworkDSYMDir) + + env.InstallAs( + target=frameworkDSYMDir, + source=mongoEmbeddedDSYM, + ) + +mongoEmbeddedBCSymbolMap = getattr(mongoEmbeddedTargets[0].attributes, "bcsymbolmap_file", None) +if mongoEmbeddedBCSymbolMap: + env.Install( + target=frameworkDir.Dir('BCSymbolMaps'), + source=mongoEmbeddedBCSymbolMap, + ) diff --git a/src/mongo/embedded/mongo_embedded/mongo_embedded.podspec.in b/src/mongo/embedded/mongo_embedded/mongo_embedded.podspec.in index 875ced84dc1..943b5862014 100644 --- a/src/mongo/embedded/mongo_embedded/mongo_embedded.podspec.in +++ b/src/mongo/embedded/mongo_embedded/mongo_embedded.podspec.in @@ -23,4 +23,10 @@ Pod::Spec.new do |s| s.watchos.vendored_frameworks = "WatchOS/Frameworks/mongo_embedded.framework" s.tvos.vendored_frameworks = "AppleTVOS/Frameworks/mongo_embedded.framework" + # My current best understanding is that apple uses these to inject + # back in when running dsymutil on their side after regenerating a + # binary from the bitcode slices. So we need to keep these available + # in the pod so they get archived into end user application. + s.preserve_path = '**/*.bcsymbolmap' + end diff --git a/src/mongo/embedded/mongoc_embedded/SConscript b/src/mongo/embedded/mongoc_embedded/SConscript index 2bccef55ee3..63633e8220a 100644 --- a/src/mongo/embedded/mongoc_embedded/SConscript +++ b/src/mongo/embedded/mongoc_embedded/SConscript @@ -63,7 +63,7 @@ if mongocEmbeddedEnv.TargetOSIs('darwin'): ], ) -mongocEmbeddedEnv.Library( +mongocEmbeddedTargets = mongocEmbeddedEnv.Library( target='mongoc_embedded', source=[ 'mongoc_embedded.cpp', @@ -121,8 +121,6 @@ if get_option('link-model') != 'dynamic-sdk': if get_option('link-model') != 'dynamic-sdk' or get_option('install-mode') != 'hygienic' or not env.TargetOSIs('darwin') or env.TargetOSIs('macOS'): Return() -installHeaderRoot = env.Dir('$INSTALL_DIR/include/mongoc_embedded/v1/mongoc_embedded') - frameworkDir = env.Dir('$INSTALL_DIR/Frameworks/mongoc_embedded.framework') env.Alias('install-embedded-dev', frameworkDir) @@ -143,7 +141,7 @@ env.Install( env.Install( target=frameworkDir.Dir('Headers'), - source=installHeaderRoot.File('mongoc_embedded.h'), + source=env.File('mongoc_embedded.h'), ) env.InstallAs( @@ -170,13 +168,31 @@ env.Install( mongocEmbeddedFwLib = env.InstallAs( target=frameworkDir.File('mongoc_embedded'), - source='$INSTALL_DIR/lib/libmongoc_embedded.dylib', + source=mongocEmbeddedTargets[0], ) env.AddPostAction( files=mongocEmbeddedFwLib, action=[ + "install_name_tool -delete_rpath @loader_path/../lib $TARGET", "install_name_tool -id @rpath/mongoc_embedded.framework/mongoc_embedded $TARGET", "install_name_tool -change @rpath/libmongo_embedded.dylib @rpath/mongo_embedded.framework/mongo_embedded $TARGET", ], ) + +mongocEmbeddedDSYM = getattr(mongocEmbeddedTargets[0].attributes, "separate_debug_file", None) +if mongocEmbeddedDSYM: + frameworkDSYMDir = '$INSTALL_DIR/Frameworks/mongoc_embedded.framework.dSYM' + env.Alias('install-embedded-dev', frameworkDSYMDir) + + env.InstallAs( + target=frameworkDSYMDir, + source=mongocEmbeddedDSYM, + ) + +mongocEmbeddedBCSymbolMap = getattr(mongocEmbeddedTargets[0].attributes, "bcsymbolmap_file", None) +if mongocEmbeddedBCSymbolMap: + env.Install( + target=frameworkDir.Dir('BCSymbolMaps'), + source=mongocEmbeddedBCSymbolMap, + ) diff --git a/src/mongo/embedded/mongoc_embedded/mongoc_embedded.podspec.in b/src/mongo/embedded/mongoc_embedded/mongoc_embedded.podspec.in index 2787777a60d..cb94dab5bc6 100644 --- a/src/mongo/embedded/mongoc_embedded/mongoc_embedded.podspec.in +++ b/src/mongo/embedded/mongoc_embedded/mongoc_embedded.podspec.in @@ -26,4 +26,7 @@ Pod::Spec.new do |s| s.dependency "mongo_embedded", "~> 4.0" s.dependency "mongo-c-driver", "~> 1.13" + # See notes in mongo_embedded.podspec.in. + s.preserve_path = '**/*.bcsymbolmap' + end |