~evarlast/ubuntu/utopic/mongodb/upstart-workaround-debian-bug-718702

« back to all changes in this revision

Viewing changes to src/mongo/SConscript

  • Committer: Package Import Robot
  • Author(s): James Page, James Page, Robie Basak
  • Date: 2013-05-29 17:44:42 UTC
  • mfrom: (44.1.7 sid)
  • Revision ID: package-import@ubuntu.com-20130529174442-z0a4qmoww4y0t458
Tags: 1:2.4.3-1ubuntu1
[ James Page ]
* Merge from Debian unstable, remaining changes:
  - Enable SSL support:
    + d/control: Add libssl-dev to BD's.
    + d/rules: Enabled --ssl option.
    + d/mongodb.conf: Add example SSL configuration options.
  - d/mongodb-server.mongodb.upstart: Add upstart configuration.
  - d/rules: Don't strip binaries during scons build for Ubuntu.
  - d/control: Add armhf to target archs.
  - d/p/SConscript.client.patch: fixup install of client libraries.
  - d/p/0010-install-libs-to-usr-lib-not-usr-lib64-Closes-588557.patch:
    Install libraries to lib not lib64.
* Dropped changes:
  - d/p/arm-support.patch: Included in Debian.
  - d/p/double-alignment.patch: Included in Debian.
  - d/rules,control: Debian also builds with avaliable system libraries
    now.
* Fix FTBFS due to gcc and boost upgrades in saucy:
  - d/p/0008-ignore-unused-local-typedefs.patch: Add -Wno-unused-typedefs
    to unbreak building with g++-4.8.
  - d/p/0009-boost-1.53.patch: Fixup signed/unsigned casting issue.

[ Robie Basak ]
* d/p/0011-Use-a-signed-char-to-store-BSONType-enumerations.patch: Fixup
  build failure on ARM due to missing signed'ness of char cast.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
Import("has_option")
13
13
Import("usesm usev8")
14
14
Import("installSetup")
 
15
Import("enforce_glibc")
15
16
Import("darwin windows solaris linux nix")
16
17
 
17
 
env.SConscript(['platform/SConscript',
 
18
env.SConscript(['base/SConscript',
 
19
                'db/auth/SConscript',
 
20
                'db/fts/SConscript',
 
21
                'db/SConscript',
 
22
                'platform/SConscript',
 
23
                's/SConscript',
18
24
                'unittest/SConscript'])
19
25
 
20
26
def add_exe( v ):
26
32
                  [ 'util/assert_util.cpp',
27
33
                    'util/concurrency/mutexdebugger.cpp',
28
34
                    'util/debug_util.cpp',
 
35
                    'util/exception_filter_win32.cpp',
 
36
                    'util/file.cpp',
29
37
                    'util/log.cpp',
 
38
                    'util/platform_init.cpp',
30
39
                    'util/signal_handlers.cpp',
31
40
                    'util/text.cpp',
32
41
                    'util/time_support.cpp',
 
42
                    'util/timer.cpp'
33
43
                    ],
34
44
                  LIBDEPS=['stacktrace',
 
45
                           '$BUILD_DIR/mongo/base/base',
 
46
                           '$BUILD_DIR/mongo/platform/platform',
35
47
                           '$BUILD_DIR/third_party/shim_allocator',
36
48
                           '$BUILD_DIR/third_party/shim_boost'])
37
49
 
 
50
env.CppUnitTest('text_test', 'util/text_test.cpp', LIBDEPS=['foundation'])
 
51
 
38
52
env.StaticLibrary('stringutils', ['util/stringutils.cpp', 'util/base64.cpp',])
39
53
 
40
54
env.StaticLibrary('md5', [
41
 
        'util/md5.cpp',
42
 
        'util/md5main.cpp',
 
55
        'util/md5.cpp'
43
56
        ])
44
57
 
 
58
env.CppUnitTest( "md5_test", ["util/md5_test.cpp", "util/md5main.cpp" ],
 
59
                 LIBDEPS=["md5"] )
 
60
 
 
61
env.CppUnitTest( "stringutils_test", [ "util/stringutils_test.cpp" ],
 
62
                 LIBDEPS=["stringutils"] )
 
63
 
45
64
env.StaticLibrary('bson', [
 
65
        'bson/mutable/mutable_bson.cpp',
 
66
        'bson/mutable/mutable_bson_builder.cpp',
 
67
        'bson/mutable/mutable_bson_heap.cpp',
 
68
        'bson/mutable/mutable_bson_internal.cpp',
 
69
        'bson/util/bson_extract.cpp',
 
70
        'util/safe_num.cpp',
 
71
        'bson/bson_validate.cpp',
46
72
        'bson/oid.cpp',
47
 
        'db/nonce.cpp',
48
73
        'db/jsobj.cpp',
49
 
        'db/json.cpp',
 
74
        'db/json.cpp'
50
75
        ], LIBDEPS=[
 
76
        'base/base',
51
77
        'md5',
52
78
        'stringutils',
 
79
        '$BUILD_DIR/mongo/platform/platform',
53
80
        ])
54
81
 
 
82
env.CppUnitTest('builder_test', ['bson/util/builder_test.cpp'],
 
83
                LIBDEPS=['bson'])
 
84
 
 
85
env.CppUnitTest('mutable_bson_test', ['bson/mutable/mutable_bson_test.cpp'],
 
86
                 LIBDEPS=['bson'])
 
87
 
 
88
env.CppUnitTest('mutable_bson_heap_test', ['bson/mutable/mutable_bson_heap_test.cpp'],
 
89
                 LIBDEPS=['bson'])
 
90
 
 
91
env.CppUnitTest('mutable_bson_builder_test', ['bson/mutable/mutable_bson_builder_test.cpp'],
 
92
                LIBDEPS=['bson'])
 
93
 
 
94
env.CppUnitTest('mutable_bson_algo_test', ['bson/mutable/mutable_bson_algo_test.cpp'],
 
95
                LIBDEPS=['bson'])
 
96
 
 
97
env.CppUnitTest('safe_num_test', ['util/safe_num_test.cpp'],
 
98
                LIBDEPS=['bson'])
 
99
 
 
100
env.CppUnitTest('string_map_test', ['util/string_map_test.cpp'],
 
101
                LIBDEPS=['bson','foundation'])
 
102
 
 
103
 
 
104
env.CppUnitTest('bson_field_test', ['bson/bson_field_test.cpp'],
 
105
                LIBDEPS=['bson'])
 
106
 
 
107
env.CppUnitTest('bson_validate_test', ['bson/bson_validate_test.cpp'],
 
108
                LIBDEPS=['bson'])
 
109
 
 
110
env.CppUnitTest('namespacestring_test', ['db/namespacestring_test.cpp'],
 
111
                LIBDEPS=['bson'])
 
112
 
 
113
env.CppUnitTest('index_set_test', ['db/index_set_test.cpp'],
 
114
                LIBDEPS=['bson','index_set'])
 
115
 
 
116
 
 
117
env.CppUnitTest('bson_extract_test', ['bson/util/bson_extract_test.cpp'], LIBDEPS=['bson'])
 
118
 
 
119
env.CppUnitTest('descriptive_stats_test',
 
120
                ['util/descriptive_stats_test.cpp'],
 
121
                LIBDEPS=['foundation', 'bson']);
 
122
 
 
123
env.CppUnitTest('sock_test', ['util/net/sock_test.cpp'],
 
124
                LIBDEPS=['mongocommon', 'notmongodormongos'],
 
125
                NO_CRUTCH=True)
 
126
 
 
127
env.StaticLibrary( 'mongohasher', [ "db/hasher.cpp" ] )
 
128
 
 
129
 
55
130
commonFiles = [ "pch.cpp",
56
131
                "buildinfo.cpp",
57
 
                "db/hasher.cpp",
58
132
                "db/lasterror.cpp",
59
133
                "db/namespace.cpp",
60
134
                "shell/mongo.cpp",
61
135
                "util/background.cpp",
62
136
                "util/intrusive_counter.cpp",
63
 
                "util/timer.cpp",
64
137
                "util/util.cpp",
65
138
                "util/file_allocator.cpp",
66
139
                "util/trace.cpp",
76
149
                "util/stack_introspect.cpp",
77
150
                "util/concurrency/synchronization.cpp",
78
151
                "util/net/sock.cpp",
 
152
                "util/net/ssl_manager.cpp",
79
153
                "util/net/httpclient.cpp",
80
154
                "util/net/message.cpp",
81
155
                "util/net/message_port.cpp",
82
156
                "util/net/listen.cpp",
83
157
                "util/startup_test.cpp",
84
 
                "client/authentication_table_common.cpp",
 
158
                "util/version.cpp",
85
159
                "client/connpool.cpp",
86
160
                "client/dbclient.cpp",
87
161
                "client/dbclient_rs.cpp",
88
162
                "client/dbclientcursor.cpp",
89
163
                "client/model.cpp",
 
164
                'client/sasl_client_authenticate.cpp',
90
165
                "client/syncclusterconnection.cpp",
91
 
                "client/distlock.cpp",
 
166
                "db/dbmessage.cpp"
92
167
                ]
93
168
 
 
169
commonSysLibdeps = []
 
170
 
 
171
if env['MONGO_BUILD_SASL_CLIENT']:
 
172
    commonFiles.extend(['client/sasl_client_authenticate_impl.cpp',
 
173
                        'util/gsasl_session.cpp'])
 
174
    commonSysLibdeps.append('gsasl')
 
175
 
 
176
# handle processinfo*
 
177
processInfoFiles = [ "util/processinfo.cpp" ]
 
178
 
 
179
processInfoPlatformFile = env.File( "util/processinfo_${PYSYSPLATFORM}.cpp" )
 
180
# NOTE( schwerin ): This is a very un-scons-y way to make this decision, and prevents one from using
 
181
# code generation to produce util/processinfo_$PYSYSPLATFORM.cpp.
 
182
if not os.path.exists( str( processInfoPlatformFile ) ):
 
183
    processInfoPlatformFile = env.File( "util/processinfo_none.cpp" )
 
184
 
 
185
processInfoFiles.append( processInfoPlatformFile )
 
186
 
 
187
env.StaticLibrary("processinfo",
 
188
                  processInfoFiles,
 
189
                  LIBDEPS=["foundation", "bson"])
 
190
 
 
191
env.CppUnitTest("processinfo_test",
 
192
                ["util/processinfo_test.cpp"],
 
193
                LIBDEPS=["processinfo"])
 
194
 
 
195
env.StaticLibrary("server_parameters",
 
196
                  ["db/server_parameters.cpp"],
 
197
                  LIBDEPS=["foundation","bson"])
 
198
 
 
199
env.CppUnitTest("server_parameters_test",
 
200
                [ "db/server_parameters_test.cpp" ],
 
201
                LIBDEPS=["server_parameters"] )
 
202
 
 
203
 
 
204
env.StaticLibrary("fail_point",
 
205
                  ["util/fail_point.cpp",
 
206
                   "util/fail_point_registry.cpp",
 
207
                   "util/fail_point_service.cpp"],
 
208
                  LIBDEPS=["foundation", "bson"])
 
209
 
94
210
env.StaticLibrary('mongocommon', commonFiles,
95
211
                  LIBDEPS=['bson',
96
212
                           'foundation',
 
213
                           'mongohasher',
97
214
                           'md5',
 
215
                           'processinfo',
98
216
                           'stacktrace',
99
217
                           'stringutils',
 
218
                           'fail_point',
100
219
                           '$BUILD_DIR/third_party/pcrecpp',
101
220
                           '$BUILD_DIR/third_party/murmurhash3/murmurhash3',
102
 
                           '$BUILD_DIR/third_party/shim_boost'],)
 
221
                           '$BUILD_DIR/third_party/shim_boost'],
 
222
                  SYSLIBDEPS=commonSysLibdeps)
103
223
 
104
224
env.StaticLibrary("coredb", [
105
 
        "client/authentication_table_server.cpp",
106
225
        "client/parallel.cpp",
107
226
        "db/commands.cpp",
 
227
        "db/commands/authentication_commands.cpp",
 
228
        "db/commands/connection_status.cpp",
 
229
        "db/commands/fail_point_cmd.cpp",
 
230
        "db/commands/find_and_modify_common.cpp",
108
231
        "db/commands/hashcmd.cpp",
109
232
        "db/commands/isself.cpp",
 
233
        "db/commands/mr_common.cpp",
 
234
        "db/commands/rename_collection_common.cpp",
 
235
        "db/commands/server_status.cpp",
 
236
        "db/commands/parameters.cpp",
110
237
        "db/pipeline/pipeline.cpp",
111
238
        "db/dbcommands_generic.cpp",
112
239
        "db/dbwebserver.cpp",
 
240
        "db/keypattern.cpp",
113
241
        "db/matcher.cpp",
114
242
        "db/pipeline/accumulator.cpp",
115
243
        "db/pipeline/accumulator_add_to_set.cpp",
128
256
        "db/pipeline/document_source_command_shards.cpp",
129
257
        "db/pipeline/document_source_filter.cpp",
130
258
        "db/pipeline/document_source_filter_base.cpp",
 
259
        "db/pipeline/document_source_geo_near.cpp",
131
260
        "db/pipeline/document_source_group.cpp",
132
261
        "db/pipeline/document_source_limit.cpp",
133
262
        "db/pipeline/document_source_match.cpp",
143
272
        "db/projection.cpp",
144
273
        "db/querypattern.cpp",
145
274
        "db/queryutil.cpp",
146
 
        "db/security_commands.cpp",
147
 
        "db/security_common.cpp",
 
275
        "db/stats/timer_stats.cpp",
148
276
        "db/stats/top.cpp",
149
277
        "s/shardconnection.cpp",
150
 
        ])
 
278
        ],
 
279
                  LIBDEPS=['db/auth/serverauth',
 
280
                           'db/common',
 
281
                           'server_parameters',
 
282
                           'geoparser',
 
283
                           'geoquery',
 
284
                           '$BUILD_DIR/mongo/foundation'])
151
285
 
152
 
coreServerFiles = [ "util/version.cpp",
 
286
coreServerFiles = [ "db/client_basic.cpp",
153
287
                    "db/common.cpp",
154
288
                    "util/net/miniwebserver.cpp",
155
 
                    "db/dbmessage.cpp",
156
289
                    "db/indexkey.cpp",
157
290
                    "db/stats/counters.cpp",
158
291
                    "db/stats/service_stats.cpp",
159
292
                    ]
160
293
 
161
 
env.StaticLibrary('ntservice', ['util/ntservice.cpp'])
 
294
env.StaticLibrary('ntservice', ['util/ntservice.cpp'], LIBDEPS=['foundation'])
 
295
if windows:
 
296
    env.CppUnitTest('ntservice_test', 'util/ntservice_test.cpp',
 
297
                    LIBDEPS=['ntservice'],
 
298
                    LIBS=['shell32', env['LIBS']])
162
299
 
163
300
scripting_common_files = [ "scripting/engine.cpp",
164
301
                           "scripting/utils.cpp",
171
308
                LIBDEPS=['bson_template_evaluator'])
172
309
 
173
310
if usesm:
174
 
    env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp'],
 
311
    env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_spidermonkey.cpp',
 
312
                                                             'scripting/sm_db.cpp'],
175
313
                      LIBDEPS=['$BUILD_DIR/third_party/js-1.7/js', 'bson_template_evaluator'])
176
314
elif usev8:
177
315
    env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_v8.cpp',
178
316
                                                             'scripting/v8_db.cpp',
179
317
                                                             'scripting/v8_utils.cpp',
180
 
                                                             'scripting/v8_wrapper.cpp'],
181
 
                       LIBDEPS=['bson_template_evaluator'])
 
318
                                                             'scripting/v8_profiler.cpp'],
 
319
                       LIBDEPS=['bson_template_evaluator', '$BUILD_DIR/third_party/shim_v8'])
182
320
else:
183
321
    env.StaticLibrary('scripting', scripting_common_files + ['scripting/engine_none.cpp'],
184
322
                      LIBDEPS=['bson_template_evaluator'])
185
323
 
186
 
mmapFiles = [ "util/mmap.cpp", "util/touch_pages.cpp" ]
 
324
mmapFiles = [ "util/mmap.cpp" ]
187
325
 
188
326
if has_option( "mm" ):
189
327
    mmapFiles += [ "util/mmap_mm.cpp" ]
190
328
else:
191
329
    mmapFiles += [ "util/mmap_${OS_FAMILY}.cpp" ]
192
330
 
193
 
# handle processinfo*
194
 
processInfoFiles = [ "util/processinfo.cpp" ]
195
 
 
196
 
processInfoPlatformFile = env.File( "util/processinfo_${PYSYSPLATFORM}.cpp" )
197
 
# NOTE( schwerin ): This is a very un-scons-y way to make this decision, and prevents one from using
198
 
# code generation to produce util/processinfo_$PYSYSPLATFORM.cpp.
199
 
if not os.path.exists( str( processInfoPlatformFile ) ):
200
 
    processInfoPlatformFile = env.File( "util/processinfo_none.cpp" )
201
 
 
202
 
processInfoFiles.append( processInfoPlatformFile )
203
 
 
204
 
coreServerFiles += processInfoFiles
205
 
 
206
331
# handle systeminfo*
207
332
systemInfoPlatformFile = env.File( "util/systeminfo_${PYSYSPLATFORM}.cpp" )
208
333
# NOTE( schwerin ): This is a very un-scons-y way to make this decision, and prevents one from using
215
340
if has_option( "asio" ):
216
341
    coreServerFiles += [ "util/net/message_server_asio.cpp" ]
217
342
 
 
343
env.StaticLibrary('index_set', [ 'db/index_set.cpp' ] )
 
344
 
218
345
# mongod files - also files used in tools. present in dbtests, but not in mongos and not in client libs.
219
346
serverOnlyFiles = [ "db/curop.cpp",
 
347
                    "db/kill_current_op.cpp",
220
348
                    "db/memconcept.cpp",
221
349
                    "db/interrupt_status_mongod.cpp",
222
350
                    "db/d_globals.cpp",
230
358
                    "db/btreebuilder.cpp",
231
359
                    "util/logfile.cpp",
232
360
                    "util/alignedbuilder.cpp",
 
361
                    "util/elapsed_tracker.cpp",
 
362
                    "util/touch_pages.cpp",
233
363
                    "db/mongommf.cpp",
234
364
                    "db/dur.cpp",
235
365
                    "db/durop.cpp",
240
370
                    "db/dur_journal.cpp",
241
371
                    "db/introspect.cpp",
242
372
                    "db/btree.cpp",
 
373
                    "db/btree_stats.cpp",
243
374
                    "db/clientcursor.cpp",
244
375
                    "db/tests.cpp",
245
376
                    "db/repl.cpp",
259
390
                    "db/prefetch.cpp",
260
391
                    "db/repl_block.cpp",
261
392
                    "db/btreecursor.cpp",
 
393
                    "db/intervalbtreecursor.cpp",
 
394
                    "db/btreeposition.cpp",
262
395
                    "db/cloner.cpp",
263
396
                    "db/namespace_details.cpp",
264
397
                    "db/cap.cpp",
272
405
                    "db/pdfile.cpp",
273
406
                    "db/record.cpp",
274
407
                    "db/cursor.cpp",
275
 
                    "db/security.cpp",
276
408
                    "db/queryoptimizer.cpp",
277
409
                    "db/queryoptimizercursorimpl.cpp",
278
410
                    "db/extsort.cpp",
279
411
                    "db/index.cpp",
280
412
                    "db/index_update.cpp",
 
413
                    "db/index_rebuilder.cpp",
281
414
                    "db/scanandorder.cpp",
282
415
                    "db/explain.cpp",
283
416
                    "db/geo/2d.cpp",
 
417
                    "db/geo/geonear.cpp",
284
418
                    "db/geo/haystack.cpp",
 
419
                    "db/geo/s2common.cpp",
 
420
                    "db/geo/s2cursor.cpp",
 
421
                    "db/geo/s2index.cpp",
 
422
                    "db/geo/s2nearcursor.cpp",
285
423
                    "db/hashindex.cpp",
286
424
                    "db/ops/count.cpp",
287
425
                    "db/ops/delete.cpp",
296
434
                    "db/commands/distinct.cpp",
297
435
                    "db/commands/find_and_modify.cpp",
298
436
                    "db/commands/group.cpp",
 
437
                    "db/commands/index_stats.cpp",
299
438
                    "db/commands/mr.cpp",
300
439
                    "db/commands/pipeline_command.cpp",
 
440
                    "db/commands/storage_details.cpp",
301
441
                    "db/pipeline/pipeline_d.cpp",
302
442
                    "db/pipeline/document_source_cursor.cpp",
303
443
                    "db/driverHelpers.cpp" ]
304
444
 
305
 
env.Library( "dbcmdline", "db/cmdline.cpp" )
 
445
env.Library( "dbcmdline", "db/cmdline.cpp", LIBDEPS=['bson', 'server_parameters'] )
 
446
env.CppUnitTest('cmdline_test', 'db/cmdline_test.cpp', LIBDEPS=['dbcmdline'])
 
447
 
 
448
env.CppUnitTest('diskloc_test', 'db/diskloc_test.cpp', LIBDEPS=[])
 
449
 
 
450
env.CppUnitTest('v8_deadline_monitor_test', 'scripting/v8_deadline_monitor_test.cpp', LIBDEPS=[])
306
451
 
307
452
env.Library('stacktrace', 'util/stacktrace.cpp')
308
453
 
309
454
env.Program('lame_stacktrace_test', 'util/lame_stacktrace_test.cpp',
310
 
            LIBDEPS=['stacktrace'])
 
455
            LIBDEPS=['stacktrace',
 
456
                     '$BUILD_DIR/mongo/base/base'])
311
457
 
312
458
serverOnlyFiles += mmapFiles
313
459
 
314
460
serverOnlyFiles += [ "db/stats/snapshots.cpp" ]
315
461
 
316
 
env.Library( "coreshard", [ "s/config.cpp",
317
 
                            "s/grid.cpp",
318
 
                            "s/chunk.cpp",
319
 
                            "s/shard.cpp",
320
 
                            "s/shardkey.cpp"] )
321
 
 
 
462
env.Library('coreshard', ['client/distlock.cpp',
 
463
                          's/config.cpp',
 
464
                          's/grid.cpp',
 
465
                          's/chunk.cpp',
 
466
                          's/shard.cpp',
 
467
                          's/shardkey.cpp'],
 
468
            LIBDEPS=['s/base']);
 
469
    
322
470
mongosLibraryFiles = [
323
471
    "s/interrupt_status_mongos.cpp",
324
472
    "s/strategy.cpp",
329
477
    "s/request.cpp",
330
478
    "s/client_info.cpp",
331
479
    "s/cursors.cpp",
332
 
    "s/config_migrate.cpp",
333
480
    "s/s_only.cpp",
334
 
    "s/stats.cpp",
335
481
    "s/balance.cpp",
336
482
    "s/balancer_policy.cpp",
337
483
    "s/writeback_listener.cpp",
338
 
    "s/shard_version.cpp",
339
 
    "s/security.cpp",
 
484
    "s/version_manager.cpp",
340
485
    ]
341
486
 
342
 
env.Library( "mongoscore" , mongosLibraryFiles )
 
487
env.Library( "mongoscore",
 
488
             mongosLibraryFiles,
 
489
             LIBDEPS=['db/auth/authmongos',
 
490
                      'db/fts/ftsmongos'
 
491
                      ] )
343
492
 
344
493
env.CppUnitTest( "balancer_policy_test" , [ "s/balancer_policy_tests.cpp" ] ,
345
 
                 LIBDEPS=["mongoscore", "coreshard","mongocommon","coreserver","coredb","dbcmdline","mongodandmongos"] ,
 
494
                 LIBDEPS=["mongoscore", "coreshard", "mongocommon","coreserver","coredb","dbcmdline","mongodandmongos"] ,
 
495
                 NO_CRUTCH=True)
 
496
 
 
497
env.CppUnitTest("dbclient_rs_test", [ "client/dbclient_rs_test.cpp" ],
 
498
                 LIBDEPS=[
 
499
                    "coredb",
 
500
                    "coreserver",
 
501
                    "coreshard",
 
502
                    "dbcmdline",
 
503
                    "mocklib",
 
504
                    "mongocommon",
 
505
                    "mongodandmongos",
 
506
                    "mongoscore"],
 
507
                 NO_CRUTCH=True)
 
508
 
 
509
env.CppUnitTest("scoped_db_conn_test", [ "client/scoped_db_conn_test.cpp" ],
 
510
                 LIBDEPS=[
 
511
                    "coredb",
 
512
                    "coreserver",
 
513
                    "coreshard",
 
514
                    "dbcmdline",
 
515
                    "mongocommon",
 
516
                    "mongodandmongos",
 
517
                    "mongoscore"],
 
518
                 NO_CRUTCH=True)
 
519
 
 
520
env.CppUnitTest("shard_conn_test", [ "s/shard_conn_test.cpp" ],
 
521
                 LIBDEPS=[
 
522
                    "mongoscore",
 
523
                    "coreshard",
 
524
                    "mongocommon",
 
525
                    "coreserver",
 
526
                    "coredb",
 
527
                    "dbcmdline",
 
528
                    "mongodandmongos",
 
529
                    "mocklib"],
346
530
                 NO_CRUTCH=True)
347
531
 
348
532
env.CppUnitTest("shard_test", [ "s/shard_test.cpp" ],
352
536
                          "coreserver",
353
537
                          "coredb",
354
538
                          "dbcmdline",
355
 
                          "mongodandmongos"],
 
539
                          "mongodandmongos",
 
540
                          "mocklib"],
356
541
                NO_CRUTCH=True)
357
542
 
 
543
 
 
544
# Should only need stuff from util, unittest and platform
 
545
env.CppUnitTest("fail_point_test", [ "util/fail_point_test.cpp" ],
 
546
                LIBDEPS=["fail_point"])
 
547
 
358
548
serverOnlyFiles += [ "s/d_logic.cpp",
359
549
                     "s/d_writeback.cpp",
360
550
                     "s/d_migrate.cpp",
362
552
                     "s/d_split.cpp",
363
553
                     "client/distlock_test.cpp",
364
554
                     "s/d_chunk_manager.cpp",
365
 
                     "db/module.cpp",
366
 
                     "db/modules/mms.cpp", ]
 
555
                     "db/module.cpp" ]
367
556
 
368
557
env.StaticLibrary("defaultversion", "s/default_version.cpp")
369
558
 
 
559
env.StaticLibrary("geometry", [ "db/geo/hash.cpp", "db/geo/shapes.cpp", ], LIBDEPS = [ "bson" ])
 
560
env.StaticLibrary("geoparser", [ "db/geo/geoparser.cpp", ],
 
561
                  LIBDEPS = [ "bson",
 
562
                              "geometry",
 
563
                              '$BUILD_DIR/third_party/s2/s2' ])
 
564
env.StaticLibrary("geoquery", [ "db/geo/geoquery.cpp", ],
 
565
                  LIBDEPS = [ "bson",
 
566
                              "geometry",
 
567
                              '$BUILD_DIR/third_party/s2/s2' ])
 
568
 
 
569
env.CppUnitTest("hash_test", [ "db/geo/hash_test.cpp" ], LIBDEPS = ["geometry" ])
 
570
env.CppUnitTest("geoparser_test", [ "db/geo/geoparser_test.cpp" ], LIBDEPS = ["geoparser"])
 
571
 
370
572
env.StaticLibrary("serveronly", serverOnlyFiles,
371
573
                  LIBDEPS=["coreshard",
 
574
                           "db/auth/authmongod",
 
575
                           "db/fts/ftsmongod",
 
576
                           "db/common",
372
577
                           "dbcmdline",
373
578
                           "defaultversion",
 
579
                           "geoparser",
 
580
                           "geoquery",
 
581
                           "index_set",
374
582
                           '$BUILD_DIR/third_party/shim_snappy'])
375
583
 
376
584
# These files go into mongos and mongod only, not into the shell or any tools.
377
585
mongodAndMongosFiles = [
378
586
    "db/connection_factory.cpp",
 
587
    "db/initialize_server_global_state.cpp",
 
588
    "db/server_extra_log_context.cpp",
379
589
    "util/net/message_server_port.cpp",
380
590
    ]
381
591
env.StaticLibrary("mongodandmongos", mongodAndMongosFiles)
388
598
 
389
599
mongodOnlyFiles = [ "db/db.cpp", "db/compact.cpp", "db/commands/touch.cpp" ]
390
600
 
391
 
# create a library per module, and add it as a dependency
392
 
# for the mongod target; as of now, modules are only included
393
 
# in mongod, as though they were part of serverOnlyFiles
394
 
modules = []
395
 
for modName, modSources in env["MONGO_MODULES"].items():
396
 
    libName = "mod%s" % modName
397
 
    env.StaticLibrary(libName, modSources)
398
 
    modules.append(libName)
399
 
 
400
601
# ----- TARGETS ------
401
602
 
402
603
env.StaticLibrary("gridfs", "client/gridfs.cpp")
403
604
 
404
605
if has_option( 'use-cpu-profiler' ):
405
606
    coreServerFiles.append( 'db/commands/cpuprofile.cpp' )
406
 
    env.Append( LIBS=['profiler'] )
 
607
    env.Append(LIBS=['unwind'])
407
608
 
408
609
env.StaticLibrary("coreserver", coreServerFiles, LIBDEPS=["mongocommon", "scripting"])
409
610
 
410
611
# main db target
411
612
mongod = env.Install(
412
613
    '#/', env.Program( "mongod", mongodOnlyFiles,
413
 
                       LIBDEPS=["coreserver", "serveronly", "coredb", "ntservice",
414
 
                                "mongodandmongos"] + modules ) )
 
614
                       LIBDEPS=["coredb",
 
615
                                "coreserver",
 
616
                                "mongodandmongos",
 
617
                                "ntservice",
 
618
                                "serveronly",
 
619
                                ] + env['MODULE_LIBDEPS_MONGOD'] ) )
415
620
Default( mongod )
416
621
 
417
622
# tools
441
646
mongos = env.Program(
442
647
    "mongos", [ "s/server.cpp"] ,
443
648
    LIBDEPS=["mongoscore", "coreserver", "coredb", "mongocommon", "coreshard", "dbcmdline", "ntservice",
444
 
             "mongodandmongos"])
 
649
             "mongodandmongos", "s/upgrade"] + env['MODULE_LIBDEPS_MONGOS'])
445
650
env.Install( '#/', mongos )
446
651
 
447
 
env.Library("clientandshell", ["client/authentication_table_client.cpp",
448
 
                               "client/clientAndShell.cpp"],
 
652
env.Library("clientandshell", ["client/clientAndShell.cpp"],
449
653
                              LIBDEPS=["mongocommon",
450
654
                                       "defaultversion",
451
655
                                       "gridfs",
458
662
# dbtests test binary
459
663
env.StaticLibrary('testframework', ['dbtests/framework.cpp'], LIBDEPS=['unittest/unittest'])
460
664
 
 
665
env.StaticLibrary('mocklib', [
 
666
        'dbtests/mock/mock_conn_registry.cpp',
 
667
        'dbtests/mock/mock_dbclient_connection.cpp',
 
668
        'dbtests/mock/mock_dbclient_cursor.cpp',
 
669
        'dbtests/mock/mock_remote_db_server.cpp',
 
670
        'dbtests/mock/mock_replica_set.cpp'
 
671
    ],
 
672
    LIBDEPS=['mongocommon'])
 
673
 
461
674
test = testEnv.Install(
462
675
    '#/',
463
 
    testEnv.Program( "test", [ f for f in Glob( "dbtests/*.cpp" ) if not str( f ).endswith( 'framework.cpp' ) ],
464
 
                     LIBDEPS=["mongocommon", "serveronly", "coreserver", "coredb", "testframework", "gridfs", "notmongodormongos" ] ) )
 
676
    testEnv.Program("test",
 
677
                    [ f for f in Glob("dbtests/*.cpp") if not str(f).endswith('framework.cpp') ],
 
678
                    LIBDEPS = [
 
679
                       "mongocommon",
 
680
                       "serveronly",
 
681
                       "coreserver",
 
682
                       "coredb",
 
683
                       "testframework",
 
684
                       "gridfs",
 
685
                       "notmongodormongos",
 
686
                       "s/upgrade",
 
687
                       "mocklib"]))
465
688
 
466
689
if len(testEnv.subst('$PROGSUFFIX')):
467
690
    testEnv.Alias( "test", "#/${PROGPREFIX}test${PROGSUFFIX}" )
481
704
        sniffEnv.Append( LIBS=[ "wpcap" ] )
482
705
 
483
706
    sniffEnv.Install( '#/', sniffEnv.Program( "mongosniff", "tools/sniffer.cpp",
484
 
                                              LIBDEPS=["gridfs", "serveronly", "coreserver", "coredb", "notmongodormongos"] ) )
 
707
                                              LIBDEPS=["gridfs", "serveronly", "coreserver", "coredb", "notmongodormongos"]))
485
708
 
486
709
# --- shell ---
487
710
 
488
711
# if you add a file here, you need to add it in scripting/engine.cpp and shell/createCPPfromJavaScriptFiles.js as well
489
 
env.JSHeader( "shell/mongo.cpp" , 
490
 
              [ "shell/utils.js","shell/utils_sh.js","shell/db.js","shell/mongo.js","shell/mr.js","shell/query.js","shell/collection.js"] )
 
712
env.JSHeader("shell/mongo.cpp",
 
713
             ["shell/assert.js", "shell/types.js", "shell/utils.js", "shell/utils_sh.js",
 
714
              "shell/db.js", "shell/mongo.js", "shell/mr.js", "shell/query.js",
 
715
              "shell/collection.js"])
491
716
 
492
717
# if you add a file here, you need to add it in shell/shell_utils.cpp and shell/createCPPfromJavaScriptFiles.js as well
493
 
env.JSHeader( "shell/mongo-server.cpp" ,
494
 
              ["shell/servers.js", "shell/shardingtest.js", "shell/servers_misc.js", "shell/replsettest.js", "shell/replsetbridge.js"] )
 
718
env.JSHeader("shell/mongo-server.cpp",
 
719
             ["shell/servers.js", "shell/shardingtest.js",
 
720
              "shell/servers_misc.js", "shell/replsettest.js", "shell/replsetbridge.js"])
495
721
 
496
722
coreShellFiles = [ "shell/dbshell.cpp",
497
723
                   "shell/shell_utils.cpp",
506
732
    mongo_shell = shellEnv.Program(
507
733
        "mongo",
508
734
        coreShellFiles,
509
 
        LIBDEPS=["coreserver", "clientandshell",
510
 
                 "$BUILD_DIR/third_party/pcrecpp"] )
 
735
        LIBDEPS=[ "clientandshell", "mongocommon", "scripting", 
 
736
                 "$BUILD_DIR/third_party/pcrecpp"] + env['MODULE_LIBDEPS_MONGOSHELL'] )
511
737
 
512
738
    shellEnv.Install( '#/', mongo_shell )
513
739
 
517
743
 
518
744
def checkGlibc(target,source,env):
519
745
    import subprocess
 
746
    import SCons.Errors
520
747
    stringProcess = subprocess.Popen( [ "strings", str( target[0] ) ], stdout=subprocess.PIPE )
521
748
    stringResult = stringProcess.communicate()[0]
522
749
    if stringResult.count( "GLIBC_2.4" ) > 0:
523
750
        print( "************* " + str( target[0] ) + " has GLIBC_2.4 dependencies!" )
524
 
        Exit(-3)
 
751
        raise SCons.Errors.BuildError(
 
752
            node=target[0],
 
753
            errstr="target has GLIBC_2.4 dependencies!")
525
754
 
526
755
distBinaries = []
527
756
 
533
762
 
534
763
    name = add_exe( name )
535
764
 
536
 
    if (not has_option( "no-glibc-check" ) and linux and "s3dist" in COMMAND_LINE_TARGETS):
 
765
    if enforce_glibc:
537
766
        e.AddPostAction( name, checkGlibc )
538
767
 
539
768
    if (solaris or linux) and (not has_option("nostrip")):
571
800
 
572
801
#headers
573
802
if installSetup.headers:
574
 
    for id in [ "", "util/", "util/net/", "util/mongoutils/", "util/concurrency/", "db/", "db/stats/", "db/repl/", "db/ops/", "client/", "bson/", "bson/util/", "s/", "scripting/" ]:
 
803
    for id in [ "", "util/", "util/net/", "util/mongoutils/", "util/concurrency/", "db/",
 
804
                "db/stats/", "db/repl/", "db/ops/", "client/", "bson/", "bson/util/", "s/",
 
805
                "scripting/", "base/", "platform/" ]:
575
806
        env.Install( "$INSTALL_DIR/include/" + id, Glob( id + "*.h" ) )
576
807
        env.Install( "$INSTALL_DIR/include/" + id, Glob( id + "*.hpp" ) )
577
808