Files
mongo/SConscript.buildinfo
Andy Schwerin 2716c5467a SERVER-7118 Change "mongo modules" to use SConscript files for modules.
Also allows you to have modules in mongos and the shell, as well as mongod.
Requires changes to the modules, to have SConscript files, and define libraries.
Allows modules to have unit tests, interesting linking rules, dependencies into
mongo, etc.

Still may need to do some work on includes.  The mongo-enterprise module has very
simple include requirements, today.
2012-10-23 16:35:42 -04:00

50 lines
1.3 KiB
Python

# -*- mode: python; -*-
# This SConscript describes construction of buildinfo.cpp, which is independent of the
# build variant's target.
import os
import sys
import buildscripts.utils
Import('env windows')
def getSysInfo():
if windows:
return "windows " + str( sys.getwindowsversion() )
else:
return " ".join( os.uname() )
buildinfo_filename = '#build/buildinfo.cpp'
buildinfo_template = '''
#include <string>
#include <boost/version.hpp>
#include "mongo/util/version.h"
namespace mongo {
const char * gitVersion() { return "%(git_version)s"; }
std::string sysInfo() { return "%(sys_info)s BOOST_LIB_VERSION=" BOOST_LIB_VERSION ; }
} // namespace mongo
'''
def generate_buildinfo(env, target, source, **kw):
git_version = buildscripts.utils.getGitVersion()
if len(env["MONGO_MODULES"]):
git_version += " modules: " + ", ".join(env["MONGO_MODULES"])
contents = str(source[0]) % dict(git_version=git_version,
sys_info=getSysInfo())
out = open(str(target[0]), 'wb')
try:
out.write(contents)
finally:
out.close()
env.Command(buildinfo_filename, Value(buildinfo_template), generate_buildinfo)
env.AlwaysBuild(buildinfo_filename)
env.Install('$BUILD_DIR/mongo', buildinfo_filename)
env.Install('$BUILD_DIR/client_build/mongo', buildinfo_filename)