diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2019-07-11 16:12:34 -0400 |
---|---|---|
committer | Mathew Robinson <chasinglogic@gmail.com> | 2019-08-12 15:52:46 -0400 |
commit | 780afd77baf061879b05e07b4022a81ab2470af7 (patch) | |
tree | fe86b68bdd92d2ddccf67f2534c72a20018c6265 /SConstruct | |
parent | a13bd1716fa21b756b3b380027aefa53b6099db0 (diff) | |
download | mongo-780afd77baf061879b05e07b4022a81ab2470af7.tar.gz |
SERVER-41670 Add support for renaming awkward autogenerated package names via an aliasing description
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 83 |
1 files changed, 38 insertions, 45 deletions
diff --git a/SConstruct b/SConstruct index b2f834a85a7..bf733e5406e 100644 --- a/SConstruct +++ b/SConstruct @@ -113,16 +113,6 @@ add_option('ccache', help='Enable ccache support', ) -add_option('prefix', - default='$BUILD_ROOT/install', - help='installation prefix', -) - -add_option('dest-dir', - default=None, - help='root of installation as a subdirectory of $BUILD_DIR' -) - add_option('legacy-tarball', choices=['true', 'false'], default='false', @@ -721,6 +711,10 @@ env_vars.Add('CXXFLAGS', help='Sets flags for the C++ compiler', converter=variable_shlex_converter) +env_vars.Add('DESTDIR', + help='Where hygienic builds will install files', + default='$BUILD_ROOT/install') + # Note: This probably is only really meaningful when configured via a variables file. It will # also override whatever the SCons platform defaults would be. env_vars.Add('ENV', @@ -840,6 +834,10 @@ env_vars.Add('OBJCOPY', help='Sets the path to objcopy', default=WhereIs('objcopy')) +env_vars.Add('PREFIX', + help='Final installation location of files, will be made into a sub dir of $DESTDIR', + default='') + # Exposed to be able to cross compile Android/*nix from Windows without ending up with the .exe suffix. env_vars.Add('PROGSUFFIX', help='Sets the suffix for built executable files') @@ -946,12 +944,6 @@ if cacheDir[0] not in ['$', '#']: print("Do not use relative paths with --cache-dir") Exit(1) -prefix = get_option('prefix').rstrip('/') -if prefix[0] not in ['$', '#']: - if not os.path.isabs(prefix): - print("Do not use relative paths with --prefix") - Exit(1) - sconsDataDir = Dir(buildDir).Dir('scons') SConsignFile(str(sconsDataDir.File('sconsign.py3'))) @@ -1039,7 +1031,6 @@ envDict = dict(BUILD_ROOT=buildDir, BENCHMARK_LIST='$BUILD_ROOT/benchmarks.txt', CONFIGUREDIR='$BUILD_ROOT/scons/$VARIANT_DIR/sconf_temp', CONFIGURELOG='$BUILD_ROOT/scons/config.log', - PREFIX=get_option('prefix'), CONFIG_HEADER_DEFINES={}, LIBDEPS_TAG_EXPANSIONS=[], AIB_PACKAGE_PREFIX='mongodb-', @@ -1047,24 +1038,6 @@ envDict = dict(BUILD_ROOT=buildDir, env = Environment(variables=env_vars, **envDict) -if get_option('dest-dir') is None: - destDir = env.Dir('$BUILD_ROOT/install') - prefix = env.Dir(get_option('prefix')) - if str(destDir) != str(prefix): - installDir = destDir.Dir(get_option('prefix')[1:]) - else: - installDir = destDir -else: - destDir = get_option('dest-dir') - if destDir[0] not in ['$', '#']: - if not os.path.isabs(destDir): - print("Do not use relative paths with --dest-dir") - Exit(1) - installDir = destDir - -env['DESTDIR'] = destDir -if get_option('legacy-tarball') == 'true': - env['DESTDIR'] = env.Dir('$DESTDIR').Dir('$SERVER_DIST_BASENAME') del envDict @@ -1089,12 +1062,12 @@ env.AddMethod(mongo_platform.env_os_is_wrapper, 'TargetOSIs') env.AddMethod(mongo_platform.env_get_os_name_wrapper, 'GetTargetOSName') def fatal_error(env, msg, *args): - print((msg.format(*args))) + print(msg.format(*args)) Exit(1) def conf_error(env, msg, *args): - print((msg.format(*args))) - print(("See {0} for details".format(env.File('$CONFIGURELOG').abspath))) + print(msg.format(*args)) + print("See {0} for details".format(env.File('$CONFIGURELOG').abspath)) Exit(1) env.AddMethod(fatal_error, 'FatalError') @@ -1113,7 +1086,7 @@ else: env.AddMethod(lambda env: env['VERBOSE'], 'Verbose') if has_option('variables-help'): - print((env_vars.GenerateHelpText(env))) + print(env_vars.GenerateHelpText(env)) Exit(0) unknown_vars = env_vars.UnknownVariables() @@ -1327,7 +1300,7 @@ else: env['TARGET_ARCH'] = detected_processor if env['TARGET_OS'] not in os_macros: - print(("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS']))) + print("No special config for [{0}] which probably means it won't work".format(env['TARGET_OS'])) elif not detectConf.CheckForOS(env['TARGET_OS']): env.ConfError("TARGET_OS ({0}) is not supported by compiler", env['TARGET_OS']) @@ -1462,8 +1435,8 @@ if link_model.startswith("dynamic"): if env.TargetOSIs('darwin'): if link_model.startswith('dynamic'): - print(("WARNING: Building MongoDB server with dynamic linking " + - "on macOS is not supported. Static linking is recommended.")) + print("WARNING: Building MongoDB server with dynamic linking " + + "on macOS is not supported. Static linking is recommended.") if link_model == "dynamic-strict": # Darwin is strict by default @@ -2812,7 +2785,7 @@ def doConfigure(myenv): llvm_symbolizer = get_option('llvm-symbolizer') if os.path.isabs(llvm_symbolizer): if not myenv.File(llvm_symbolizer).exists(): - print(("WARNING: Specified symbolizer '%s' not found" % llvm_symbolizer)) + print("WARNING: Specified symbolizer '%s' not found" % llvm_symbolizer) llvm_symbolizer = None else: llvm_symbolizer = myenv.WhereIs(llvm_symbolizer) @@ -3276,7 +3249,7 @@ def doConfigure(myenv): # Either crypto engine is native, # or it's OpenSSL and has been checked to be working. conf.env.SetConfigHeaderDefine("MONGO_CONFIG_SSL") - print(("Using SSL Provider: {0}".format(ssl_provider))) + print("Using SSL Provider: {0}".format(ssl_provider)) else: ssl_provider = "none" @@ -3298,7 +3271,7 @@ def doConfigure(myenv): files = ['ssleay32.dll', 'libeay32.dll'] for extra_file in files: if not addOpenSslLibraryToDistArchive(extra_file): - print(("WARNING: Cannot find SSL library '%s'" % extra_file)) + print("WARNING: Cannot find SSL library '%s'" % extra_file) def checkHTTPLib(required=False): # WinHTTP available on Windows @@ -3782,7 +3755,9 @@ if get_option('install-mode') == 'hygienic': if get_option('separate-debug') == "on": env.Tool('separate_debug') + env["AIB_TARBALL_SUFFIX"] = "tgz" env.Tool('auto_install_binaries') + env.AddSuffixMapping({ "$PROGSUFFIX": env.SuffixMap( directory="$PREFIX_BINDIR", @@ -3836,6 +3811,12 @@ if get_option('install-mode') == 'hygienic': ), }) + env.AddPackageNameAlias( + component="dist", + role="runtime", + name="${{SERVER_DIST_BASENAME[{PREFIX_LEN}:]}}".format(PREFIX_LEN=len(env.get("AIB_PACKAGE_PREFIX"))) + ) + if env['PLATFORM'] == 'posix': env.AppendUnique( RPATH=[ @@ -3979,6 +3960,12 @@ def add_version_to_distsrc(env, archive): env.AddDistSrcCallback(add_version_to_distsrc) env['SERVER_DIST_BASENAME'] = env.subst('mongodb-%s-$MONGO_DISTNAME' % (getSystemInstallName())) +if get_option('legacy-tarball') == 'true': + if ('tar-dist' not in COMMAND_LINE_TARGETS and + 'zip-dist' not in COMMAND_LINE_TARGETS and + 'archive-dist' not in COMMAND_LINE_TARGETS): + env.FatalError('option --legacy-tarball only valid with an archive-dist target') + env['PREFIX'] = '$SERVER_DIST_BASENAME' module_sconscripts = moduleconfig.get_module_sconscripts(mongo_modules) @@ -4194,6 +4181,12 @@ env.Alias('cache-prune', cachePrune) if get_option('install-mode') == 'hygienic': env.FinalizeInstallDependencies() + # TODO: Remove once hygienic is driving all builds and we can make + # the evergreen.yml make this decision + if env.TargetOSIs("windows"): + env.Alias("archive-dist", "zip-dist") + else: + env.Alias("archive-dist", "tar-dist") # We don't want installing files to cause them to flow into the cache, # since presumably we can re-install them from the origin if needed. |