diff options
-rw-r--r-- | SConstruct | 56 | ||||
-rw-r--r-- | client/gridfs.cpp | 5 | ||||
-rw-r--r-- | client/model.h | 4 | ||||
-rw-r--r-- | db/jsobj.h | 8 | ||||
-rw-r--r-- | tools/Tool.h | 4 |
5 files changed, 57 insertions, 20 deletions
diff --git a/SConstruct b/SConstruct index 712e60da88e..a7e111cc183 100644 --- a/SConstruct +++ b/SConstruct @@ -130,6 +130,7 @@ nix = False useJavaHome = False linux64 = False darwin = False +windows = False force64 = not GetOption( "force64" ) is None force32 = not GetOption( "force32" ) is None release = not GetOption( "release" ) is None @@ -138,7 +139,10 @@ noOptimization = not GetOption( "noOptimization" ) is None noshell = not GetOption( "noshell" ) is None platform = os.sys.platform -processor = os.uname()[4] +if "uname" in dir(os): + processor = os.uname()[4] +else: + processor = "i386" if force32: processor = "i386" @@ -218,7 +222,15 @@ elif "sunos5" == os.sys.platform: env.Append( CPPDEFINES=[ "__linux__" ] ) elif "win32" == os.sys.platform: + windows = True boostDir = "C:/Program Files/Boost/boost_1_35_0" + + if not os.path.exists( boostDir ): + print( "can't find boost" ) + Exit(1) + + boostLibs = [] + javaHome = findVersion( "C:/Program Files/java/" , [ "jdk" , "jdk1.6.0_10" ] ) winSDKHome = findVersion( "C:/Program Files/Microsoft SDKs/Windows/" , @@ -248,8 +260,11 @@ elif "win32" == os.sys.platform: return False return True - commonFiles += filter( pcreFilter , Glob( "pcre-7.4/*.c" ) ) - commonFiles += filter( pcreFilter , Glob( "pcre-7.4/*.cc" ) ) + pcreFiles = [] + pcreFiles += filter( pcreFilter , Glob( "pcre-7.4/*.c" ) ) + pcreFiles += filter( pcreFilter , Glob( "pcre-7.4/*.cc" ) ) + commonFiles += pcreFiles + allClientFiles += pcreFiles env.Append( LIBS=Split("ws2_32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib" ) ) @@ -461,7 +476,7 @@ env.Program( "mongofiles" , allToolFiles + [ "tools/files.cpp" ] ) env.Program( "mongos" , commonFiles + coreDbFiles + Glob( "dbgrid/*.cpp" ) ) # c++ library -env.Library( "mongoclient" , allClientFiles ) +clientLibName = str( env.Library( "mongoclient" , allClientFiles )[0] ) env.Library( "mongotestfiles" , commonFiles + coreDbFiles + serverOnlyFiles ) clientTests = [] @@ -561,17 +576,23 @@ if distBuild: # binaries -env.Install( installDir + "/bin" , "mongodump" ) -env.Install( installDir + "/bin" , "mongorestore" ) +def installBinary( e , name ): + if windows: + name += ".exe" + env.Install( installDir + "/bin" , name ) + +installBinary( env , "mongodump" ) +installBinary( env , "mongorestore" ) -env.Install( installDir + "/bin" , "mongoexport" ) -env.Install( installDir + "/bin" , "mongoimportjson" ) +installBinary( env , "mongoexport" ) +installBinary( env , "mongoimportjson" ) -env.Install( installDir + "/bin" , "mongofiles" ) +installBinary( env , "mongofiles" ) + +installBinary( env , "mongod" ) -env.Install( installDir + "/bin" , "mongod" ) if not noshell: - env.Install( installDir + "/bin" , "mongo" ) + installBinary( env , "mongo" ) # NOTE: In some cases scons gets confused between installation targets and build # dependencies. Here, we use InstallAs instead of Install to prevent such confusion @@ -582,7 +603,7 @@ for id in [ "", "util/", "db/" , "client/" ]: env.Install( installDir + "/include/mongo/" + id , Glob( id + "*.h" ) ) #lib -env.Install( installDir + "/" + nixLibPrefix, "libmongoclient.a" ) +env.Install( installDir + "/" + nixLibPrefix, clientLibName ) env.Install( installDir + "/" + nixLibPrefix + "/mongo/jars" , Glob( "jars/*" ) ) #final alias @@ -620,7 +641,6 @@ def s3push( localName , remoteName=None , remotePrefix="-latest" , fixName=True import settings s = simples3.S3Bucket( settings.bucket , settings.id , settings.key ) - un = os.uname() if remoteName is None: remoteName = localName @@ -637,7 +657,7 @@ def s3push( localName , remoteName=None , remotePrefix="-latest" , fixName=True if platformDir: name = platform + "/" + name - s.put( name , open( localName ).read() , acl="public-read" ); + s.put( name , open( localName , "rb" ).read() , acl="public-read" ); print( "uploaded " + localName + " to http://s3.amazonaws.com/" + s.name + "/" + name ) def s3shellpush( env , target , source ): @@ -649,9 +669,13 @@ env.AlwaysBuild( "s3shell" ) def s3dist( env , target , source ): s3push( distFile , "mongo-db" ) -distFile = installDir + ".tgz" env.Append( TARFLAGS=" -z " ) -env.Tar( distFile , installDir ) +if windows: + distFile = installDir + ".zip" + env.Zip( distFile , installDir ) +else: + distFile = installDir + ".tgz" + env.Tar( distFile , installDir ) env.Alias( "dist" , distFile ) env.Alias( "s3dist" , [ "install" , distFile ] , [ s3dist ] ) diff --git a/client/gridfs.cpp b/client/gridfs.cpp index bd17894f7b2..92e8f79116d 100644 --- a/client/gridfs.cpp +++ b/client/gridfs.cpp @@ -1,9 +1,14 @@ // gridfs.cpp +#include "../stdafx.h" #include <fcntl.h> #include "gridfs.h" +#if defined(_WIN32) +#include <io.h> +#endif + #ifndef MIN #define MIN(a,b) ( (a) < (b) ? (a) : (b) ) #endif diff --git a/client/model.h b/client/model.h index 3b565701ff9..3437d3bdd5e 100644 --- a/client/model.h +++ b/client/model.h @@ -25,11 +25,11 @@ namespace mongo { /** Model is a base class for defining objects which are serializable to the Mongo database via the database driver. - *Definition* + Definition Your serializable class should inherit from Model and implement the abstract methods below. - *Loading* + Loading To load, first construct an (empty) object. Then call load(). Do not load an object more than once. */ diff --git a/db/jsobj.h b/db/jsobj.h index 85f78f30623..9337be5bcd7 100644 --- a/db/jsobj.h +++ b/db/jsobj.h @@ -92,8 +92,12 @@ namespace mongo { */ enum BinDataType { Function=1, ByteArray=2, bdtUUID = 3, MD5Type=5, bdtCustom=128 }; - /** Object id's for BSON objects. - When present they should be the first object member added. + /** Object ID type. + BSON objects typically have an _id field for the object id. This field should be the first + member of the object when present. class OID is a special type that is a 12 byte id which + is likely to be unique to the system. You may also use other types for _id's. + When _id field is missing from a BSON object, on an insert the database may insert one + automatically in certain circumstances. */ class OID { union { diff --git a/tools/Tool.h b/tools/Tool.h index 772301fbc29..8f7b2fa76c6 100644 --- a/tools/Tool.h +++ b/tools/Tool.h @@ -6,6 +6,10 @@ #include <boost/program_options.hpp> +#if defined(_WIN32) +#include <io.h> +#endif + #include "client/dbclient.h" using std::string; |