forked from finos/OpenMAMA
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SConstruct
151 lines (113 loc) · 4.4 KB
/
SConstruct
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import os,re
import sys
import posixpath,string
from custom_utils import *
from SCons.Script import *
import subprocess,time,shlex
from config import ParseIni
host = getHostInfo()
if host['os'] == 'Windows':
buildWrapper = Windows()
if host['os'] == 'Linux':
buildWrapper = Linux()
if host['os'] == 'Darwin':
buildWrapper = Darwin()
parseconfig = ParseIni()
## Parse Available Products
#
# Go through the scons.ini and pull the products that are valid choices from it
ValidProducts = parseconfig.getProducts()
## Version Definitions
#
# declare the versions for each product
VERSIONS = get_project_versions( '.' )
## Get Command Line Options
opts = get_command_line_opts( host, ValidProducts, VERSIONS )
env = buildWrapper.create( opts )
opts.Save('omama.conf', env)
Help(opts.GenerateHelpText(env, sort=True))
if env['jobs'] == 'n':
env['jobs'] = host['cpus']
SetOption('num_jobs', env['jobs'])
if (env['prefix'] == '#wombat_products_%s' % (VERSIONS['mama']['releaseString'])
or env['prefix'] == '#openmama_install_%s' % (VERSIONS['mama']['releaseString'])):
env.LogDefaultValue( 'Prefix',env['prefix'] )
if ('wombat_products_%s' % (VERSIONS['mama']['releaseString']) not in env['prefix']
and os.path.isdir ('site_scons/enterprise')):
env['prefix'] = posixpath.join( env['prefix'], 'wombat_products_%s' % (VERSIONS['mama']['releaseString']) )
env.LogUserValue( 'Prefix',env['prefix'] )
env.LogConfig( 'Object Directory', env['blddir'], '#objdir' )
if env.has_key('cache_dir'):
CacheDir(env['cache_dir'])
env.LogUserValue( 'SCons Cache', env['cache_dir'] )
# If the timestamp on the file is the same as before then don't bother checking
# the contents of the file by summing
env.Decider('MD5-timestamp')
# From the website:
#
# By default SCons will calculate the MD5 checksum of every source file in your
# build each time it is run, and will only cache the checksum after the file is
# 2 days old. This default of 2 days is to protect from clock skew from NFS or
# revision control systems. You can tweak this delay using --max-drift=SECONDS
# where SECONDS is some number of seconds. Decreasing SECONDS can improve build
# speed by eliminating superfluous MD5 checksum calculations. Instead of
# specifying this on the command line each run, you can set this option inside
# your SConstruct or SConscript file using "SetOption('max_drift', SECONDS)".
env.SetOption('max_drift', 1)
env['versions'] = VERSIONS
prefix = env['prefix']
blddir = env['blddir']
product = env['product']
env['incdir'] = '$prefix/include'
env['libdir'] = '$prefix/lib'
env['bindir'] = '$prefix/bin'
env['host'] = host
StaticLibs = {}
Jars = {}
# Media is used for the management of files which do not fall within the Windows
# dynamic,static etc. buildtypes e.g. example app src code. If installed without
# any catches SCons will report errors concerning multiple build environments for
# output
Media = {}
Lock = {}
Export('StaticLibs')
Export('Jars')
Export('Media')
Export('Lock')
env['tarball'] = buildWrapper.getReleaseTarball(env)
env['TARFLAGS'] = '-c -z'
env['TARSUFFIX'] = 'tgz'
env['TOPLEVEL'] = Dir('#').abspath
## Build Modules
#
# Setup the modules that are to be built, and then call each of the appropriate
# SConscript files.
modules = parseconfig.getProductModules(product)
if 'wmw' in env['middleware']:
modules.append('wombatmw/c_cpp')
env['modules'] = modules
if not env.GetOption('help'):
# # Build Environment Setup
#
# Setup the appropriate flags for each of the build environments in this section
# using the wrapper class
buildWrapper.configure(env)
log_api_config(env)
buildWrapper.build(env, modules)
if env['package'] == True:
env.Tar('%s/%s' % (Dir( env['blddir'] ).abspath,env['tarball']),'$prefix')
env.Command( '$prefix/openmama.tgz', [], generate_source_tarball )
Clean( '.', ['openmama.tgz'] )
#if env['with_docs'] == True:
# env.Command( '$prefix/VERSIONS', [], write_versions_file )
# env.Command( '$prefix/RELEASE_NOTES/',[], generate_release_notes )
# # Clean Target
#
# Define the Clean target. Both folders will be removed as part of the Clean
# operation
Clean( '.', [env['prefix'], env['blddir']] )
# # Variables Save
#
# Saves all non-default values within the Variables class to the omama.conf
if env.get('test',None) == True:
Test.run( env )