Commit 43ac077d authored by Philippe Coval's avatar Philippe Coval Committed by C.J. Collier

build: Support scons install

Fixed some Install rules and where they were missued,
InstalTarget and UserInstall* were somehow overlapping.

If prefix is not used, then install to separate folder in tree.

See python comments for more details.

Maybe this could be refactored later, but this change tried
to keep the difference minimal.

Other related fixes are separated in obvious patches.
Instalation of supported examples to come later

This was needed for ARTIK7 on fedora-24

Bug: https://jira.iotivity.org/browse/IOT-524
Change-Id: I2143f41c6dba7356617186f2d9cb68ef82323f5e
Forwarded: https://gerrit.iotivity.org/gerrit/#/c/23403/
Origin: https://github.com/TizenTeam/iotivity/tree/sandbox/pcoval/on/master/fedoraSigned-off-by: default avatarPhilippe Coval <philippe.coval@osg.samsung.com>
parent acdf0b66
......@@ -445,42 +445,65 @@ def __set_dir(env, dir):
def __src_to_obj(env, src, home=''):
#
# make sure builds happen in BUILD_DIR (by default they
# would happen in the directory of the source file)
# Note this does not seem to be used, VariantDir is used instead
#
'''
Make sure builds happen in BUILD_DIR (by default they
would happen in the directory of the source file)
Note this does not seem to be used, VariantDir is used instead
'''
obj = env.get('BUILD_DIR') + src.replace(home, '')
if env.get('OBJSUFFIX'):
obj += env.get('OBJSUFFIX')
return env.Object(obj, src)
def __install(ienv, targets, name):
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
Alias(name, i_n)
env.AppendUnique(TS=[name])
def __install(ienv, targets, name=''):
'''
Copy files to internal place (not for install to system)
only use UserInstall() for copying files to system using "scons install"
'''
for filename in ienv.GetBuildPath(targets):
basename = os.path.basename(filename)
dst = env.get('BUILD_DIR') + basename
i_n = Command(dst, filename, Copy("$TARGET", "$SOURCE"))
if '' == name:
name = basename
ienv.Alias(name, i_n)
env.AppendUnique(TS=[name])
def __installlib(ienv, targets, name):
def __installlib(ienv, targets, name=''):
'''
Install files to system, using "scons install" and remove rpath info if present
If prefix or lib install dir is not specified, for developer convenience
files are copied in relative "deploy" folder along executables (rpath is kept)
to avoid overlap with "internal place" above
'''
user_prefix = env.get('PREFIX')
if user_prefix:
user_lib = env.get('LIB_INSTALL_DIR')
if user_lib:
i_n = ienv.Install(user_lib, targets)
dst_dir = user_lib
else:
i_n = ienv.Install(user_prefix + '/lib', targets)
ienv.Alias("install", i_n)
dst_dir = user_prefix + '/lib'
else:
i_n = ienv.Install(env.get('BUILD_DIR'), targets)
ienv.Alias("install", i_n)
dst_dir = env.get('BUILD_DIR') + '/deploy'
action = ienv.Install(dst_dir, targets)
ienv.Alias("install", action)
def __installbin(ienv, targets, name):
def __installbin(ienv, targets, name=''):
'''
' Install files to system, using "scons install"
' If prefix is not specified, for developer convenience
' files are copied in relative "deploy" folder along libraries
'''
user_prefix = env.get('PREFIX')
if user_prefix:
i_n = ienv.Install(user_prefix + '/bin', targets)
ienv.Alias("install", i_n)
dst_dir = user_prefix + '/bin'
else:
dst_dir = env.get('BUILD_DIR') + '/deploy'
ienv.Alias("install", ienv.Install(dst_dir , targets))
def __installheader(ienv, targets, dir, name):
......@@ -488,8 +511,7 @@ def __installheader(ienv, targets, dir, name):
if user_prefix:
i_n = ienv.Install(user_prefix + '/include/' + dir, targets)
else:
i_n = ienv.Install(
os.path.join(env.get('BUILD_DIR'), 'include', dir), targets)
i_n = ienv.Install(env.get('BUILD_DIR') + 'deploy/include/' + dir, targets)
ienv.Alias("install", i_n)
......@@ -502,7 +524,7 @@ def __installpcfile(ienv, targets, name):
else:
i_n = ienv.Install(user_prefix + '/lib/pkgconfig', targets)
else:
i_n = ienv.Install(env.get('BUILD_DIR') + 'lib/pkgconfig', targets)
i_n = ienv.Install(env.get('BUILD_DIR') + 'deploy/pkgconfig', targets)
ienv.Alias("install", i_n)
......@@ -604,6 +626,9 @@ with_ra_ibb = env.get('WITH_RA_IBB')
env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
if not env.get('PREFIX') and not env.get('LIB_INSTALL_DIR'):
env.AppendUnique(LIBPATH = [env.get('BUILD_DIR') + '/deploy'])
if (env.get('WITH_UPSTREAM_LIBCOAP') == '1'):
env.AppendUnique(CPPDEFINES=['WITH_UPSTREAM_LIBCOAP'])
......
......@@ -120,6 +120,7 @@ light_introspection_json = examples_env.Install(examples_env.get('BUILD_DIR') +
examples_env.get('SRC_DIR') + '/resource/examples/' + 'light_introspection.json')
examples += [clientjson, serverjson]
examples_env.Alias("install", examples)
if target_os in ['msys_nt', 'windows']:
winUIClient = examples_env.Program('winUIClient', ['winuiclientgui.cpp', 'winuiclient.cpp'])
......@@ -130,5 +131,6 @@ if target_os in ['msys_nt', 'windows']:
mediaserver = examples_env.Program('mediaserver', 'mediaserver.cpp')
examples += [mediaserver]
Alias("examples", examples)
examples_env.Alias("examples", examples)
examples_env.AppendTarget('examples')
examples_env.Alias("install", examples)
......@@ -131,8 +131,7 @@ if provisiontests_env.get('TEST') == '1':
'resource/provisioning/unittests/provisiontests',
unittests)
src_dir = provisiontests_env.get('SRC_DIR')
svr_db_src_dir = src_dir + '/resource/provisioning/examples/'
svr_db_build_dir = os.path.join(provisiontests_env.get('BUILD_DIR'), 'resource', 'provisioning', 'unittests')
provisiontests_env.Alias("install", provisiontests_env.Install( svr_db_build_dir,
svr_db_src_dir + 'oic_svr_db_client.json'))
src = File('#/resource/provisioning/examples/oic_svr_db_client.json')
dst = provisiontests_env.get('BUILD_DIR') + Dir('.').srcnode().path + "/" + src.name
i_n = provisiontests_env.Command(dst, src, Copy("$TARGET", "$SOURCE"))
provisiontests_env.Alias("install", i_n)
......@@ -108,7 +108,7 @@ CoAP_unit_test_src = CoAP_test_env.Glob('./CoAPHttpUnitTest.cpp')
CoAP_unit_test = CoAP_test_env.Program('CoAP_unit_test', CoAP_unit_test_src)
Alias("CoAP_unit_test", CoAP_unit_test)
CoAP_test_env.AppendTarget('CoAP_unit_test')
CoAP_test_env.InstallTarget(CoAP_unit_test, 'CoAP_unit_test')
CoAP_test_env.UserInstallTargetBin(CoAP_unit_test, 'CoAP_unit_test')
if CoAP_test_env.get('TEST') == '1':
if target_os in ['linux']:
......
......@@ -171,6 +171,7 @@ if target_os in ['android', 'ios', 'linux', 'tizen']:
if target_os not in ['ios']:
es_sdk_shared = easy_setup_env.SharedLibrary('ESMediatorRich',
easy_setup_env.get('es_src'))
easy_setup_env.InstallTarget(es_sdk_shared, 'libESMediatorRich')
easy_setup_env.UserInstallTargetLib(es_sdk_shared, 'libESMediatorRich')
easy_setup_env.AppendUnique(
LINKFLAGS=['-Wl,-soname,libESMediatorRich.so'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment