Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 58 lines (45 sloc) 1.986 kb
d67ce1c SCons refactoring, cleans up building and testing the C++ client.
Andy Schwerin authored
1 # -*- mode: python; -*-
2
3 # This SConscript describes construction of buildinfo.cpp, which is independent of the
4 # build variant's target.
5
6 import os
7 import sys
8
9 import buildscripts.utils
10
11 Import('env windows')
12
13 def getSysInfo():
14 if windows:
15 return "windows " + str( sys.getwindowsversion() )
16 else:
17 return " ".join( os.uname() )
18
19 buildinfo_filename = '#build/buildinfo.cpp'
20
21 buildinfo_template = '''
22 #include <string>
23 #include <boost/version.hpp>
24
25 #include "mongo/util/version.h"
26
27 namespace mongo {
28 const char * gitVersion() { return "%(git_version)s"; }
9e2543e Scott Hernandez SERVER-7856: record allocator and build flags in buildinfo
scotthernandez authored
29 const char * allocator() { return "%(allocator)s"; }
30 const char * loaderFlags() { return "%(loader_flags)s"; }
31 const char * compilerFlags() { return "%(compiler_flags)s"; }
d67ce1c SCons refactoring, cleans up building and testing the C++ client.
Andy Schwerin authored
32 std::string sysInfo() { return "%(sys_info)s BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; }
33 } // namespace mongo
34 '''
35
36 def generate_buildinfo(env, target, source, **kw):
09c5aff discover and configure modules in db/modules/
Dan Crosta authored
37 git_version = buildscripts.utils.getGitVersion()
2716c54 Andy Schwerin SERVER-7118 Change "mongo modules" to use SConscript files for modules.
andy10gen authored
38 if len(env["MONGO_MODULES"]):
39 git_version += " modules: " + ", ".join(env["MONGO_MODULES"])
09c5aff discover and configure modules in db/modules/
Dan Crosta authored
40
41 contents = str(source[0]) % dict(git_version=git_version,
9e2543e Scott Hernandez SERVER-7856: record allocator and build flags in buildinfo
scotthernandez authored
42 sys_info=getSysInfo(),
43 allocator=GetOption('allocator'),
44 loader_flags=env.subst('$LINKFLAGS $LDFLAGS',
45 source=source, target=target),
46 compiler_flags=env.subst('$CXXFLAGS $CCFLAGS $CFLAGS',
47 source=source, target=target))
d67ce1c SCons refactoring, cleans up building and testing the C++ client.
Andy Schwerin authored
48 out = open(str(target[0]), 'wb')
49 try:
50 out.write(contents)
51 finally:
52 out.close()
53
54 env.Command(buildinfo_filename, Value(buildinfo_template), generate_buildinfo)
55 env.AlwaysBuild(buildinfo_filename)
56 env.Install('$BUILD_DIR/mongo', buildinfo_filename)
57 env.Install('$BUILD_DIR/client_build/mongo', buildinfo_filename)
Something went wrong with that request. Please try again.