Skip to content

Commit d9c06a3

Browse files
committed
SERVER-9668 Use SCons install target tags to identify mapping of targets to install packages.
1 parent ac0e818 commit d9c06a3

File tree

17 files changed

+713
-216
lines changed

17 files changed

+713
-216
lines changed

SConstruct

Lines changed: 102 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,20 @@ add_option('prefix',
100100
help='installation prefix',
101101
)
102102

103+
add_option('dest-dir',
104+
default=None,
105+
help='root of installation as a subdirectory of $BUILD_DIR'
106+
)
107+
108+
add_option('legacy-tarball',
109+
choices=['true', 'false'],
110+
default='false',
111+
const='true',
112+
nargs='?',
113+
type='choice',
114+
help='Build a tarball matching the old MongoDB dist targets',
115+
)
116+
103117
add_option('install-mode',
104118
choices=['legacy', 'hygienic'],
105119
default='legacy',
@@ -947,9 +961,9 @@ if cacheDir[0] not in ['$', '#']:
947961
print("Do not use relative paths with --cache-dir")
948962
Exit(1)
949963

950-
installDir = get_option('prefix').rstrip('/')
951-
if installDir[0] not in ['$', '#']:
952-
if not os.path.isabs(installDir):
964+
prefix = get_option('prefix').rstrip('/')
965+
if prefix[0] not in ['$', '#']:
966+
if not os.path.isabs(prefix):
953967
print("Do not use relative paths with --prefix")
954968
Exit(1)
955969

@@ -1029,12 +1043,33 @@ envDict = dict(BUILD_ROOT=buildDir,
10291043
BENCHMARK_LIST='$BUILD_ROOT/benchmarks.txt',
10301044
CONFIGUREDIR='$BUILD_ROOT/scons/$VARIANT_DIR/sconf_temp',
10311045
CONFIGURELOG='$BUILD_ROOT/scons/config.log',
1032-
INSTALL_DIR=installDir,
1046+
PREFIX=get_option('prefix'),
10331047
CONFIG_HEADER_DEFINES={},
10341048
LIBDEPS_TAG_EXPANSIONS=[],
10351049
)
10361050

10371051
env = Environment(variables=env_vars, **envDict)
1052+
1053+
if get_option('dest-dir') is None:
1054+
destDir = env.Dir('$BUILD_ROOT/install')
1055+
prefix = env.Dir(get_option('prefix'))
1056+
if destDir != prefix:
1057+
installDir = destDir.Dir(get_option('prefix')[1:])
1058+
else:
1059+
installDir = destDir
1060+
else:
1061+
destDir = get_option('dest-dir')
1062+
if destDir[0] not in ['$', '#']:
1063+
if not os.path.isabs(destDir):
1064+
print("Do not use relative paths with --dest-dir")
1065+
Exit(1)
1066+
installDir = destDir
1067+
1068+
env['INSTALL_DIR'] = installDir
1069+
env['DEST_DIR'] = destDir
1070+
if get_option('legacy-tarball') == 'true':
1071+
env['INSTALL_DIR'] = env.Dir('$INSTALL_DIR').Dir('$SERVER_DIST_BASENAME')
1072+
10381073
del envDict
10391074

10401075
for var in ['CC', 'CXX']:
@@ -3633,10 +3668,65 @@ if get_option('install-mode') == 'hygienic':
36333668
env.Tool('separate_debug')
36343669

36353670
env.Tool('auto_install_binaries')
3671+
env.AddSuffixMapping({
3672+
"$PROGSUFFIX": env.SuffixMap(
3673+
directory="$PREFIX_BIN_DIR",
3674+
default_roles=[
3675+
"runtime",
3676+
]
3677+
),
3678+
3679+
"$LIBSUFFIX": env.SuffixMap(
3680+
directory="$PREFIX_LIB_DIR",
3681+
default_roles=[
3682+
"dev",
3683+
]
3684+
),
3685+
3686+
"$SHLIBSUFFIX": env.SuffixMap(
3687+
directory="$PREFIX_BIN_DIR" \
3688+
if mongo_platform.get_running_os_name() == "windows" \
3689+
else "$PREFIX_LIB_DIR",
3690+
default_roles=[
3691+
"runtime",
3692+
]
3693+
),
3694+
3695+
".debug": env.SuffixMap(
3696+
directory="$PREFIX_DEBUG_DIR",
3697+
default_roles=[
3698+
"debug",
3699+
]
3700+
),
3701+
3702+
".dSYM": env.SuffixMap(
3703+
directory="$PREFIX_DEBUG_DIR",
3704+
default_roles=[
3705+
"debug"
3706+
]
3707+
),
3708+
3709+
".lib": env.SuffixMap(
3710+
directory="$PREFIX_LIB_DIR",
3711+
default_roles=[
3712+
"dev"
3713+
]
3714+
),
3715+
3716+
".h": env.SuffixMap(
3717+
directory="$PREFIX_INCLUDE_DIR",
3718+
default_roles=[
3719+
"dev",
3720+
]
3721+
),
3722+
})
3723+
36363724
if env['PLATFORM'] == 'posix':
36373725
env.AppendUnique(
36383726
RPATH=[
3639-
env.Literal('\\$$ORIGIN/../lib')
3727+
# In the future when we want to improve dynamic builds
3728+
# we should set this to $PREFIX ideally
3729+
env.Literal('\\$$ORIGIN/../lib'),
36403730
],
36413731
LINKFLAGS=[
36423732
# Most systems *require* -z,origin to make origin work, but android
@@ -3957,10 +4047,6 @@ if should_dagger:
39574047
# Require everything to be built before trying to extract build dependency information
39584048
env.Requires(dependencyDb, allTargets)
39594049

3960-
# We don't want installing files to cause them to flow into the cache,
3961-
# since presumably we can re-install them from the origin if needed.
3962-
env.NoCache(env.FindInstalledFiles())
3963-
39644050
# Declare the cache prune target
39654051
cachePrune = env.Command(
39664052
target="#cache-prune",
@@ -3974,6 +4060,13 @@ cachePrune = env.Command(
39744060
env.AlwaysBuild(cachePrune)
39754061
env.Alias('cache-prune', cachePrune)
39764062

4063+
if get_option('install-mode') == 'hygienic':
4064+
env.FinalizeInstallDependencies()
4065+
4066+
# We don't want installing files to cause them to flow into the cache,
4067+
# since presumably we can re-install them from the origin if needed.
4068+
env.NoCache(env.FindInstalledFiles())
4069+
39774070
# Substitute environment variables in any build targets so that we can
39784071
# say, for instance:
39794072
#

buildscripts/runandroidsim.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ $ANDROID_SDK/platform-tools/adb push $DIRECTORY /data
6363
echo "Running the test on the virtual device"
6464
$ANDROID_SDK/platform-tools/adb shell /data/$(basename $DIRECTORY)/$TEST_PATH_IN_DIRECTORY "$@" | tee android_sim_test_output.txt 2>&1
6565

66-
# On the android sim ( possibly on nomral android as well ) if a program fails its runtime link,
66+
# On the android sim ( possibly on normal android as well ) if a program fails its runtime link,
6767
# for example because of a missing library, it will have an exit code of 0. In which case the
6868
# android_sim_test_output.txt file will not contian the test output, but instead will contain
6969
# "CANNOT LINK EXECUTABLE"

etc/evergreen.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,8 @@ functions:
13211321
"do benchmark embedded setup":
13221322
- command: manifest.load
13231323
- *git_get_project
1324+
- *set_task_expansion_macros
1325+
- *set_up_virtualenv
13241326
- *fetch_artifacts
13251327
- *get_buildnumber
13261328
- *set_up_credentials
@@ -3856,7 +3858,7 @@ tasks:
38563858
--install-mode=hygienic
38573859
--js-engine=none
38583860
--opt=size
3859-
--prefix='$BUILD_ROOT/mongo-embedded-sdk-$MONGO_VERSION'
3861+
--dest-dir='$BUILD_ROOT/mongo-embedded-sdk-$MONGO_VERSION'
38603862
--separate-debug
38613863
--ssl=off
38623864
--use-system-mongo-c=on

0 commit comments

Comments
 (0)