Fix build error with scons-4.4.0 version which is based on python3
[platform/upstream/iotivity.git] / extlibs / raxmpp / SConscript
1 #******************************************************************
2 #
3 # Copyright 2015 Intel Mobile Communications GmbH All Rights Reserved.
4 #
5 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 #
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
10 #
11 #      http://www.apache.org/licenses/LICENSE-2.0
12 #
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 #
19 #-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 ######################################################################
22 # raxmpp library build script
23 #
24 ######################################################################
25 import os
26 import subprocess
27
28 Import('env')
29
30 src_dir = env.get('SRC_DIR')
31 target_os = env.get('TARGET_OS')
32 target_arch = env.get('TARGET_ARCH')
33 with_ra = env.get('WITH_RA')
34 with_ra_ibb = env.get('WITH_RA_IBB')
35 if with_ra and not with_ra_ibb :
36         # check 'raxmppl' library, if it doesn't exits, ask user to download it
37         if not os.path.exists('raxmpp'):
38                 print('''
39         *********************************** Error: ***********************************************
40         * Please download ra_xmpp as following :
41         *     $ git clone https://gerrit.iotivity.org/gerrit/iotivity-xmpp extlibs/raxmpp/raxmpp
42         ******************************************************************************************
43         ''')
44                 Exit(1)
45
46         print('building with ra_xmpp')
47         if env.get('RELEASE'):
48                 print(src_dir)
49                 build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out', target_os, target_arch, 'release/')
50         else:
51                 build_dir = os.path.join(src_dir, 'extlibs/raxmpp/raxmpp/out/', target_os, target_arch, 'debug/')
52         os.chdir('raxmpp')
53         sconsflags = ' RELEASE=true' if  env['RELEASE'] else ' RELEASE=false'
54         foo=subprocess.getoutput('scons external' + sconsflags )
55         print(foo)
56         foo=subprocess.getoutput('scons' + sconsflags )
57         print(foo)
58
59         env.AppendUnique(CPPPATH = src_dir+'/extlibs/raxmpp/raxmpp/ra_xmpp/',
60                                 LIBPATH=build_dir,
61                                 RPATH = build_dir)