/usr/share/alljoyn/build_core/SConscript is in liballjoyn-common-dev-1604 16.04a-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | # Copyright AllSeen Alliance. All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
import os
import platform
def CheckCXXFlag(context, flag):
prog = "int main(void) { return 0; }"
context.Message('Checking c++ compiler support for %s flag... ' % flag)
prevCXXFLAGS = context.env.get('CXXFLAGS')
prefix = flag.split('=')[0]
checkCXXFLAGS = [x for x in prevCXXFLAGS if not x.startswith(prefix)]
checkCXXFLAGS.append(flag)
context.env.Replace(CXXFLAGS = checkCXXFLAGS)
r = context.TryCompile(prog, '.cc')
if not r:
context.env.Replace(CXXFLAGS = prevCXXFLAGS)
context.Result(r)
return r
if platform.system() == 'Linux':
default_target_os = 'linux'
allowed_target_oss = ('linux', 'android', 'openwrt')
if platform.machine() == 'x86_64':
default_target_cpu = 'x86_64'
else:
default_target_cpu = 'x86'
allowed_target_cpus = ('x86', 'x86_64', 'arm', 'openwrt', 's390x', 'aarch64', 'arm64', 'armhf', 'i386', 'mips', 'mipsel', 'powerpc', 'powerpc64le', 'alpha', 'hppa', 'm68k', 'mips64el', 'powerpcspe', 'powerpc64', 'sh4', 'sparc64')
default_msvc_version = None
default_crypto = 'openssl' # Override for OS=android is below
allowed_crypto = ('openssl', 'builtin')
elif platform.system() == 'Windows':
default_target_os = 'win7'
allowed_target_oss = ('win7', 'win10', 'android')
if platform.machine() == 'x86_64':
default_target_cpu = 'x86_64'
else:
default_target_cpu = 'x86'
allowed_target_cpus = ('x86', 'x86_64', 'arm')
default_msvc_version = '12.0'
default_crypto = 'cng'
allowed_crypto = ('cng', 'openssl', 'builtin')
elif platform.system() == 'Darwin':
default_target_os = 'darwin'
allowed_target_oss = ('darwin', 'android', 'openwrt')
default_target_cpu = 'x86_64'
allowed_target_cpus = ('x86', 'x86_64', 'arm', 'armv7', 'armv7s', 'arm64', 'openwrt')
default_msvc_version = None
default_crypto = 'openssl'
allowed_crypto = ('openssl', 'builtin')
vars = Variables()
# Common build variables
vars.Add('V', 'Build verbosity', '0')
vars.Add(EnumVariable('OS', 'Target OS', default_target_os, allowed_values = allowed_target_oss))
vars.Add(EnumVariable('CPU', 'Target CPU', default_target_cpu, allowed_values = allowed_target_cpus))
vars.Add(EnumVariable('VARIANT', 'Build variant', 'debug', allowed_values=('debug', 'release'), ignorecase=2))
vars.Add(EnumVariable('BR', 'Have bundled router built-in for C++ test samples', 'on', allowed_values=('on', 'off')))
vars.Add(EnumVariable('DOCS', '''Output doc type. Setting the doc type to "dev" will produce HTML
output that includes all developer files not just the public API.
''', 'none', allowed_values=('none', 'pdf', 'html', 'dev', 'chm', 'sandcastle')))
vars.Add(EnumVariable('WS', 'Whitespace Policy Checker', 'off', allowed_values=('check', 'detail', 'fix', 'off')))
vars.Add(PathVariable('GTEST_DIR', 'The path to Google Test (gTest) source code', os.environ.get('GTEST_DIR'), PathVariable.PathIsDir))
vars.Add(EnumVariable('NDEBUG', 'Override NDEBUG default for release variant', 'defined', allowed_values=('defined', 'undefined')))
vars.Add(PathVariable('SQLITE_DIR', 'The path to sqlite3.c and sqlite3.h, for building the Security Manager sample app', os.environ.get('SQLITE_DIR'), PathVariable.PathIsDir))
vars.Add('CXX', 'C++ compiler to use')
if default_msvc_version:
vars.Add(EnumVariable('MSVC_VERSION', 'MSVC compiler version - Windows', default_msvc_version, allowed_values=('11.0', '11.0Exp', '12.0', '12.0Exp', '14.0', '14.0Exp')))
# Standard variant directories
build_dir = 'build/${OS}/${CPU}/${VARIANT}'
vars.AddVariables(('OBJDIR', '', '#' + build_dir + '/obj'),
('DISTDIR', '', '#' + build_dir + '/dist'),
('TESTDIR', '', '#' + build_dir + '/test'))
target_os = ARGUMENTS.get('OS', default_target_os)
target_cpu = ARGUMENTS.get('CPU', default_target_cpu)
if target_os == 'android':
default_crypto = 'builtin'
if target_os == 'darwin' and target_cpu in ['x86', 'x86_64']:
default_crypto = 'builtin'
vars.Add(EnumVariable('CRYPTO', 'Crypto implementation', default_crypto, allowed_values = allowed_crypto))
if target_os in ['win10', 'win7']:
# The Win7/Win10 MSI installation package takes a long time to build. Let it be optional.
if target_os in ['win10', 'win7']:
vars.Add(EnumVariable('WIN7_MSI', 'Build the .MSI installation package', 'false', allowed_values=('false', 'true')))
path = []
if os.environ.has_key('MIKTEX_HOME'):
path = os.path.normpath(os.environ['MIKTEX_HOME'] + '/bin')
msvc_version = ARGUMENTS.get('MSVC_VERSION')
env = Environment(variables = vars, TARGET_ARCH=target_cpu, MSVC_VERSION=msvc_version, tools = ['default', 'jar'], ENV = {'PATH' : path})
else:
env = Environment(variables = vars, tools = ['gnulink', 'gcc', 'g++', 'ar', 'as', 'javac', 'javah', 'jar', 'pdf', 'pdflatex'])
if env['V'] == '0':
env.Replace(CCCOMSTR = '\t[CC] $SOURCE',
SHCCCOMSTR = '\t[CC-SH] $SOURCE',
CXXCOMSTR = '\t[CXX] $SOURCE',
SHCXXCOMSTR = '\t[CXX-SH] $SOURCE',
LINKCOMSTR = '\t[LINK] $TARGET',
SHLINKCOMSTR = '\t[LINK-SH] $TARGET',
JAVACCOMSTR = '\t[JAVAC] $SOURCE',
JARCOMSTR = '\t[JAR] $TARGET',
ARCOMSTR = '\t[AR] $TARGET',
RANLIBCOMSTR = '\t[RANLIB] $TARGET'
)
# Some tools aren't in default path
if os.environ.has_key('JAVA_HOME'):
env.PrependENVPath('PATH', os.path.normpath(os.environ['JAVA_HOME'] + '/bin'))
if os.environ.has_key('DOXYGEN_HOME'):
env.PrependENVPath('PATH', os.path.normpath(os.environ['DOXYGEN_HOME'] + '/bin'))
if os.environ.has_key('GRAPHVIZ_HOME'):
env.PrependENVPath('PATH', os.path.normpath(os.environ['GRAPHVIZ_HOME'] + '/bin'))
# Warn user about building stand alone daemon on unsupported platforms
if env['OS'] not in ['android', 'linux', 'openwrt'] and env['BR'] != "on":
print "Daemon is not supported on OS=%s, building with BR=on anyway" % (env['OS'])
env['BR'] = "on"
Help(vars.GenerateHelpText(env))
# Don't silently break people still building with BD in place of BR. We're adding the variable here
# after generating the help text above so that it does not show up in the help.
bd = Variables();
bd.Add(EnumVariable('BD', 'Have bundled router built-in for C++ test samples', 'invalid', allowed_values=('invalid', 'on', 'off')))
bd.Update(env)
if 'invalid' != env['BD']:
print 'BD has been replaced by BR, setting BR to ' + env['BD']
env['BR'] = env['BD']
# Validate build vars
if env['OS'] == 'linux':
env['OS_GROUP'] = 'posix'
env['OS_CONF'] = 'linux'
elif env['OS'] in ['win10', 'win7']:
env['OS_GROUP'] = 'windows'
env['OS_CONF'] = 'windows'
elif env['OS'] == 'android':
env['OS_GROUP'] = 'posix'
env['OS_CONF'] = 'android'
elif env['OS'] == 'darwin':
env['OS_GROUP'] = 'posix'
env['OS_CONF'] = 'darwin'
elif env['OS'] == 'openwrt':
env['OS_GROUP'] = 'posix'
env['OS_CONF'] = 'openwrt'
else:
print 'Unsupported OS/CPU combination'
if not GetOption('help'):
Exit(1)
if env['VARIANT'] == 'release' and env['NDEBUG'] == 'defined':
env.Append(CPPDEFINES = 'NDEBUG')
if env['BR'] == 'on':
env.Append(CPPDEFINES = 'ROUTER')
env.Append(CPPDEFINES = ['QCC_OS_GROUP_%s' % env['OS_GROUP'].upper()])
# "Standard" C/C++ header file include paths for all projects.
env.Append(CPPPATH = ["$DISTDIR/cpp/inc",
"$DISTDIR/c/inc"])
# "Standard" C/C++ library paths for all projects.
env.Append(LIBPATH = ["$DISTDIR/cpp/lib",
"$DISTDIR/c/lib"])
# Setup additional builders
if os.path.exists('tools/scons/doxygen.py'):
env.Tool('doxygen', toolpath=['tools/scons'])
else:
def dummy_emitter(target, source, env):
return [], []
def dummy_action(target, source, env):
pass
dummyBuilder = Builder(action = dummy_action,
emitter = dummy_emitter);
env.Append(BUILDERS = {'Doxygen' : dummyBuilder})
env.Tool('genversion', toolpath=['tools/scons'])
env.Tool('javadoc', toolpath=['tools/scons'])
env.Tool('Csharp', toolpath=['tools/scons'])
env.Tool('jsdoc3', toolpath=['tools/scons'])
# Create the builder that generates Status.h from Status.xml
import sys
import SCons.Util
sys.path.append('tools/bin')
import make_status
def status_emitter(target, source, env):
base = SCons.Util.splitext(str(target[0]))[0]
target.append(base + '.h')
return target, source
def status_action(target, source, env):
base = os.path.dirname(os.path.dirname(SCons.Util.splitext(str(target[1]))[0]))
cmdList = []
cmdList.append('--code=%s' % str(target[0]))
cmdList.append('--header=%s' % str(target[1]))
if env.has_key('STATUS_FLAGS'):
cmdList.extend(env['STATUS_FLAGS'])
cmdList.append(str(source[0]))
return make_status.main(cmdList)
statusBuilder = Builder(action = status_action,
emitter = status_emitter,
suffix = '.cc',
src_suffix = '.xml')
env.Append(BUILDERS = {'Status' : statusBuilder})
if env['OS'] in ['linux', 'openwrt']:
env['LIBTYPE'] = 'both'
else:
env['LIBTYPE'] = 'static'
# Read OS and CPU specific SConscript file
Export('env', 'CheckCXXFlag')
env.SConscript('conf/${OS_CONF}/SConscript')
# Whitespace policy
if env['WS'] != 'off' and not env.GetOption('clean'):
import sys
sys.path.append('tools/bin')
import whitespace
def wsbuild(target, source, env):
print "Evaluating whitespace compliance..."
curdir = os.path.abspath(os.path.dirname(wsbuild.func_code.co_filename))
version = whitespace.get_uncrustify_version()
if (version == "0.57"):
config = os.path.join(curdir, 'tools', 'conf', 'ajuncrustify.0.57.cfg')
else: #use latest known version
config = os.path.join(curdir, 'tools', 'conf', 'ajuncrustify.0.61.cfg')
print "Config:", config
print "Note: enter 'scons -h' to see whitespace (WS) options"
return whitespace.main([env['WS'], config])
ws = env.Command('#/ws', Dir('$DISTDIR'), wsbuild)
if env['WS'] != 'off':
env.Clean(env.File('SConscript'), env.File('#/whitespace.db'))
Return('env')
|