@@ -100,6 +100,20 @@ add_option('prefix',
100
100
help = 'installation prefix' ,
101
101
)
102
102
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
+
103
117
add_option ('install-mode' ,
104
118
choices = ['legacy' , 'hygienic' ],
105
119
default = 'legacy' ,
@@ -947,9 +961,9 @@ if cacheDir[0] not in ['$', '#']:
947
961
print ("Do not use relative paths with --cache-dir" )
948
962
Exit (1 )
949
963
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 ):
953
967
print ("Do not use relative paths with --prefix" )
954
968
Exit (1 )
955
969
@@ -1029,12 +1043,33 @@ envDict = dict(BUILD_ROOT=buildDir,
1029
1043
BENCHMARK_LIST = '$BUILD_ROOT/benchmarks.txt' ,
1030
1044
CONFIGUREDIR = '$BUILD_ROOT/scons/$VARIANT_DIR/sconf_temp' ,
1031
1045
CONFIGURELOG = '$BUILD_ROOT/scons/config.log' ,
1032
- INSTALL_DIR = installDir ,
1046
+ PREFIX = get_option ( 'prefix' ) ,
1033
1047
CONFIG_HEADER_DEFINES = {},
1034
1048
LIBDEPS_TAG_EXPANSIONS = [],
1035
1049
)
1036
1050
1037
1051
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
+
1038
1073
del envDict
1039
1074
1040
1075
for var in ['CC' , 'CXX' ]:
@@ -3633,10 +3668,65 @@ if get_option('install-mode') == 'hygienic':
3633
3668
env .Tool ('separate_debug' )
3634
3669
3635
3670
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
+
3636
3724
if env ['PLATFORM' ] == 'posix' :
3637
3725
env .AppendUnique (
3638
3726
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' ),
3640
3730
],
3641
3731
LINKFLAGS = [
3642
3732
# Most systems *require* -z,origin to make origin work, but android
@@ -3957,10 +4047,6 @@ if should_dagger:
3957
4047
# Require everything to be built before trying to extract build dependency information
3958
4048
env .Requires (dependencyDb , allTargets )
3959
4049
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
-
3964
4050
# Declare the cache prune target
3965
4051
cachePrune = env .Command (
3966
4052
target = "#cache-prune" ,
@@ -3974,6 +4060,13 @@ cachePrune = env.Command(
3974
4060
env .AlwaysBuild (cachePrune )
3975
4061
env .Alias ('cache-prune' , cachePrune )
3976
4062
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
+
3977
4070
# Substitute environment variables in any build targets so that we can
3978
4071
# say, for instance:
3979
4072
#
0 commit comments